by date
Free Resource for 3dsmax Users
Free Resource for 3dsmax Users
| Name: | Ryan Mounts | |
|---|---|---|
| Date Posted: | Jan 09, 2008 | |
| Rating: | 4.6 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Ryan Mounts |
Blog post
Here is a set of two macroscripts for 3dsmax that I'd like to share with all who might find them useful. They were developed out of a desire to create interiors directly in 3dsmax, where I could take advantage of max's advanced feature set, especially in the UV mapping department. After trying many different pipelines, each involving several conversions, I could never get my geometry into Constructor with the texture coordinates preserved. So I wrote my own script, called "Max2Ctor", to export a max scene directly to the Constructor format (.csx). The second is a helper script, called "Explode Brushes", particularly used to aid in texture baking. It allows you to attach multiple brushes into one object, bake the materials and lighting into one or more textures, and then "explode" the brushes back out before exporting while preserving the texture coordinates. I use these scripts in 3dsmax 9, but I think they should work back to version 5.
Below is an example of a simple house (included in the zip file) with global illumination baked into a single 1024x1024 texture. Since the lighting is in the texture, I checked "useGLLighting" in the World Editor Inspector after dropping the interior into Torque to disable its lightmap.

As a side note, you can also use max2ctor to export spheres properly into Constructor, which could be helpful since Constructor's sphere tool is not very robust yet. Feel free to add comments or suggestions. Hope someone finds these useful!!
Max2Ctor.zip
Below is an example of a simple house (included in the zip file) with global illumination baked into a single 1024x1024 texture. Since the lighting is in the texture, I checked "useGLLighting" in the World Editor Inspector after dropping the interior into Torque to disable its lightmap.

As a side note, you can also use max2ctor to export spheres properly into Constructor, which could be helpful since Constructor's sphere tool is not very robust yet. Feel free to add comments or suggestions. Hope someone finds these useful!!
Max2Ctor.zip
Recent Blog Posts
| List: | 07/16/08 - Resource: Ambient Occlusion for TGEA Interiors 07/11/08 - Resource: Ambient Occlusion for TGE Interiors 06/25/08 - Native Ambient Occlusion for Interiors in TGE 06/17/08 - Custom Lightmaps for TGEA Interiors 04/03/08 - Add Custom Lightmaps to Interiors 01/24/08 - Update: Max2Ctor 1.0.1 01/10/08 - Tutorial: Export 3dsmax directly to Constructor 01/09/08 - Free Resource for 3dsmax Users |
|---|
Submit your own resources!| Florian (Jan 09, 2008 at 13:12 GMT) |
I will try this out immediatly :D!
Sounds really helpfull, thanks.
Btw, what does the explode brush script exactly do, I don't quite understand it.
You said it aids in texture baking, but the torque engine bakes the lightning map in, when it is doing the lightning mission right?
Or is this something that bakes the lightning straight into the texture?
| Surge (Jan 09, 2008 at 14:18 GMT) |
Edited on Jan 09, 2008 14:59 GMT
| Ryan Mounts (Jan 09, 2008 at 15:16 GMT) Resource Rating: 3 |
Here's the workflow I used to create that house above... first I created the geometry, which is just 11 boxes ("convex brushes") just like how you'd expect to see it in Constructor. Then I converted them all to editable poly and used the "Attach" command to combine them all into one object. That is so I can bake one large texture for the whole house. Then I applied a Multi-subobject material to the house object with 7 different textures. I went in by hand and selected the house's polygons and gave them the corresponding material ID. Then in the Modifier panel, I added a Poly Select, selected the polys with a material ID of 1 and applied a UVWmap. This allows you to tile, rotate, or shift the texture, or change the mapping to planar, box, etc for just material 1. When I got that material looking right, I added another Poly Select, selected all polys with material ID 2, added a UVWmap... well, you get the idea. I just continued that process until I had all the UV's mapped the way I wanted. Now here's the trick. The very last modifier should be an UnwrapUVW with a Map Channel that's different from the UVWmap modifiers (I used a Map Channel of 2). In UnwrapUVW I selected all the polys that a player would see ingame (not the small faces between touching brushes), and in Edit mode selected Mapping > Flatten Mapping. Then I clicked Select > Select Inverted Faces and scaled these way down and moved them to a small unused portion of the texture. We don't want unseen polys using up our valuable texture realistate! Now I lit the scene the way I wanted, using V-Ray to do the GI. Mental Ray can only bake occlusion maps properly. Then I used Render To Texture with Channel 2 selected under Mapping Coordinates (the channel the UVWunwrap is using). This allowed me to bake all the texture and advanced lighting into a singe 1024x1024 texture. After baking, I created a new Standard material with my baked texture in the diffuse slot (Map Channel 2) and applied it to the house object. Whew, almost done...
Here's where those scripts come into play. I selected the house object and used "Explode Brushes" to break it back out into individual brushes, without disturbing my baked texture. Then I used "Max2Ctor" with Map Channel set to 2 to export the house to Constructor (Note: you have to load the texture into the material library in Constructor). Now just export to Dif! If you bake the lighting into the texture like this, you need to set "useGLLighting" in Torque to disable its lightmap.
Now, you don't have to use these scripts to bake advanced lighting into your textures... that's just one of the cool tricks. :) Max2Ctor is a simple standalone exporter. Simply create some objects, texture them with either Standard or Multi-subobject materials and your choice of UV mapping, maybe add some lights, and export them! This might be useful if you want to use 3dsmax's powerful tools to create your interior, like snaps, advanced array, maxscripting, Paritcle Flow, UVWunwrap, precise and easy placement/alignment, etc. Explode Brushes is used specifically for the workflow outlined above, to take advantage of advanced lighting and Render To Texture. Of course you could have just baked each object individually, but then you would have ended up with 11 textures instead of just 1, which would quickly eat up texture memory ingame for a complex interior. It's more efficient to bake a few larger textures. Hope that helps. I might try to write up a short tutorial or something later... :)
| Ryan Mounts (Jan 09, 2008 at 15:23 GMT) Resource Rating: 3 |
Sure, you can create your geometry any way you choose. Max2Ctor will simply export any visible geometry and omni lights. And you can do your texture mapping either in max or Constructor, whatever your preference. If you texture map in max, you have to make sure your textures are loaded in Constructor's material library for them to show up.
| David Montgomery-Blake (Jan 09, 2008 at 15:30 GMT) |
| Surge (Jan 09, 2008 at 15:59 GMT) |
Edited on Jan 09, 2008 16:10 GMT
| Bobby Leighton (Jan 09, 2008 at 16:08 GMT) |
| Mario Selvaggio (Jan 10, 2008 at 18:53 GMT) |
you just made my newyears very happy =)
| Kevin Lee (Jan 10, 2008 at 22:43 GMT) |
| Ryan Mounts (Jan 11, 2008 at 00:30 GMT) Resource Rating: 3 |
Edited on Jan 11, 2008 00:46 GMT
| H.W. Kim (Jan 11, 2008 at 04:54 GMT) |
www.rendertotexture.com/
Cheers,
Edited on Jan 11, 2008 04:55 GMT
| Matt Fairfax (Jan 11, 2008 at 21:16 GMT) |
| UZON (Jan 26, 2008 at 13:48 GMT) |
You must be a member and be logged in to either append comments or rate this resource.


4.6 out of 5


