Post subject: Quick and Dirty Max To Game Engine Export (mesh+tcol)
Posted: Wed Jul 07, 2010 10:06 am
Site Admin
Joined: Fri Mar 26, 2010 10:06 am Posts: 351
Note: If images do not show, reload the page.
If you need installation directions, check here:
I wanted to quickly throw together a guide for all new users to easily execute the steps for exporting and previewing works in the game engine. I have grabbed some screenshots from a simple export process and made some extras to show differences between aspects of workflow.
This won't explain how to model anything, and I could miss something perhaps, it just assumes you have your model with centered pivot and ready to export and see it in game. The aim is just to keep it simple and elaborate in replies if needed. Let me know if there is more I can do or more I should elaborate on.
First picture: Above, you can see I have a textured mesh for the game and a normal primitive Sphere with just enough geometry to make my shape. In some cases, you will want accurate geometry, and in others, it is really a non issue and better to save polygons for performance. It is named tcol_EARF for me, upon export, the tcol will need to be renamed to simple EARF.tcol. More later.
We will begin by getting the mesh out of the way UPDATE: The XML converter (shown in image below, and mentioned in following text, is now moved. The converter is now found at: "%Grit%\grit_core\media\Tools" : I am using one diffuse texture, thus I am blending only 1 texture. My earth will have a normal map, so I check this box. Since all of my UV space is unique and there are no mirrored or rotated clones to make it, I do not need the other options. Press the button, let the mesh export to the chosen place, and close the dialog. Quick note: If it is the first time you've run the exporter since installing it, you will need to define the path to the XML converter in the Grit tools folder. This will not always be required of new users.
Next, I can prepare the tcol collision mesh for export: I use a default blinn material and name it the collision surface I wish to use. UPDATE: The above picture is outdated. A correct useful pmat can be found at:
Code:
/common/pmat/Stone
You can find a list in the wiki and at common/pmat/init.lua, so no need to add them here, as they are also subject to expand for a while. You can use more than one material per collision mesh, and you can color them in the diffuse color box to differentiate surfaces when working in the viewport. Take special note of the name of the material. The / in the beginning is important so grit can find the common folder, don't forget it!
After applying materials, we can run the tcol exporter: I want this to be a dynamic rigid body in the game, so I check dynamic. My earth is very big, so 100kg is not enough - no matter, I can make this higher in the text file when I inspect the results (tcol will not always be text, for now, it is good to check results while Grit matures). The tcol of a simple primitive should look like this, notice that I have made it heavier and how little data is in the file:
It is typically ideal to use primitives, and linking them all as first generation children under a dummy, and exporting that dummy rather than exporting trimesh. The results of a trimesh is a lot more data, but sometimes it must be done (if you have errors with primitives at this time of writing, use trimesh anyway) Here is a trimesh exported, significantly more data:
I'm sure the performance tradeoff isn't as bad as it looks, but it is a big deal. So, avoid a trimesh!
Now, I usually do this right before I look at the tcol and check my files in the project folder, but I had to show you that first to complete the point before those pictures, but before going any further, the first thing I always do to avoid conflicts with version control/subversion is to update my local copy of grit. Notice my tcol is not yet named EARF.tcol here:
NOTICE: Now, any mesh named tcol_ for user's keeping a clean scene will automatically remove the first 5 letters and thus no need to rename.
After an update, I need to put my files into the init.lua of the project folder. There are a lot of ways to do this (see JostVice's Playground init file for a more compartmentalized, cleaner, and readable layout, Urban [and only urban] is in chaos at this time of writing) Above you can examine the easy 3 lines of text it takes to put models into Grit. The materials are defined, you can see other lines with more options exposed, the class is defined, and the object is called to place it. Easy peasy. Take note of the blue box BaseClass, this is not just for LOD that don't need collisions, other things like shrubs etc may not use collisions either.
Post subject: Re: Quick and Dirty Max To Game Engine Export (mesh+tcol)
Posted: Thu Jul 08, 2010 4:42 am
Site Admin
Joined: Fri Mar 26, 2010 10:06 am Posts: 351
by all means, you and the rest with privs edit away or post suggestions. Feel free to add creds for contribution, and we'll eventually move it over to the wiki with perhaps more uniform imagery.
It would be more complete with an export of the map data too, but currently I use copy paste and seek a more streamlined solution for that, but if the steps were laid out I'd make use of it later when I'm doing more permanent scenes.
Post subject: Re: Quick and Dirty Max To Game Engine Export (mesh+tcol)
Posted: Thu Jul 08, 2010 8:11 am
Site Admin
Joined: Fri Mar 26, 2010 10:06 am Posts: 351
Also, now you don't have to rename your tcol if your tcol is named tcol_ as mine - I got Spark to update the exporter so that it will remove tcol_ from any mesh whose first 5 letters is tcol_, Awesome!!!
Moving this to the grit technical section. Will rewrite and change it eventually, for now quick and dirty quick and dirty.
Also, now you don't have to rename your tcol if your tcol is named tcol_ as mine - I got Spark to update the exporter so that it will remove tcol_ from any mesh whose first 5 letters is tcol_, Awesome!!!
Post subject: Re: Quick and Dirty Max To Game Engine Export (mesh+tcol)
Posted: Sat May 28, 2011 6:16 pm
Newbie
Joined: Sun Jul 04, 2010 9:42 am Posts: 26 Location: Netherlands (holland)
My TCOL exporter doesn't work longer.. :s After export i will get a small document (31kb normally it is 300~400kb) Also he won't use "Common/Stone" but the normally textures. (already removed?)
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum