Home » Renegade Discussions » Mod Forum » Faked "Lightmap" Creation in 3D Studio Max - A Tutorial
() 2 Votes
Faked "Lightmap" Creation in 3D Studio Max - A Tutorial [message #182658] |
Sun, 18 December 2005 22:10 |
|
Aircraftkiller
Messages: 8213 Registered: February 2003
Karma:
|
General (5 Stars) |
|
|
Since Reborn refuses to show how simple their technique was, even though it was blatently obvious (Texture baking in Max, press the zero key and you're almost at their skill level!), I've decided to make this tutorial so that everyone can use lightmaps in their creations if you feel it's worth the ridiculous amount of time necessary to do so.
You're going to need 3D Studio Max, any version that natively supports texture baking via the zero key will suffice. You will also need the BFF Export plugin. You can find the BFF Export plugin at FileFront's download service:
http://www.filefront.com/?filepath=/renalert/BFFExporter.zip
Okay, now that you have the necessary files (ignore the MultiUnwrap plugin), now you need to know how to install them! Drag and drop the BFF script into your Max viewport. Once you've done that, select the Customize menu and select the Customize UI option. Click the Menu tab and select the "Bobo_s Tools" category. Click the plus sign next to the File menu to open it, and drag the "BFF_Exporter" item below the Export item. You're all done setting up your scripts, congratulations!
This step can be slightly tricky, so if you need help please feel free to e-mail me at aircraftkiller@cncgames.com if you have any questions.
Now to start helping you set up the faked lightmaps:
Load your Max file. For example, if you're making a building interior with lightmapping applied, be sure to load said building interior so you can begin work with it. Make sure your scene's geometry is complete. Set up all your lights the way you want them to look in-game, and make sure you've got a Shadow Map applied for your lights, or Ray Traced Shadows. Either will produce great results for the purpose we're using them for. Once all your lights are set up, select your main piece of geometry (For reason's sake, the largest piece so it's easier to work with) and attach all the scene's geometry to it. Before you do that, though, be absolutely sure to save your work before doing the attachment so you don't have to worry about having a single instanced piece of geometry if you wanted to have separate smaller pieces to work with. Add the Unwrap UVW modifier and set it to UV channel 3.
Select the Mapping menu after you've brought up the UV vertex editing menu. Select the Flatten Mapping option and leave the settings at default, press enter to allow Max to chug away for however long it will take. On a 2.8 GHz machine, my Refinery interior (About 4,000 polygons) takes about two seconds to finish. A slight delay is to be expected with any complicated scene, so heads up if you have a slower system.
After you've run that, select the Tools menu and select the Pack UVs option. Change the packing type to Recursive, change the spacing to 0.01, and check all the options beneath the spacing spinner. Allow Max to restructure your UV coordinates to optimize map space (Since this is really pointless to do yourself unless you're the masochistic type) and then convert everything to an editable poly object or an editable mesh object. Either one is irrelevant, just make sure not to convert it to an editable patch object.
Once you've done that, keep the object selected and press zero on your keyboard's number strip. When the Render to Texture (Texture bake menu) opens, make sure to tell Max the UV coordinate your lightmaps are working off. Generally the number would be 2 or 3, depending on which you used earlier. You tell Max how to bake the scene's radiosity into a texture by selecting the Use Existing Channel option and setting it accordingly. On the output menu, click the Add button and add the LightingMap option. Set the texture size at whatever you feel appropriate. 256 to 512 is more than enough for a building. 1024 is pushing it in any case.
Next to where your new lightmap's filename is, a button with three periods inside needs to be clicked to set up your export path for the lightmap. Set it to some easy to find location, since the default Max location is C:\YourMaxPath\Images.
Select the Render option and let Max chug away. Once you've done that, select File > BFF_Exporter and uncheck everything but Geometry, Materials, and Progress Report. Export this file to your workspace folder and close Max, or do whatever you want with it at that point. Load RenX; the output will be a *.ms file. This MaxScript file can be read in gMax by using the MaxScript > Run Script menu option. This saves your extra texture channel, allowing the lightmaps to exist in the engine without having to remap everything in gMax to your lightmap's UV coordinates (Again, unless you're the masochistic type, this really isn't recommended.).
Set up your textures in RenX as usual, but this time go to the Vertex Material tab. Set the detail texture's UV channel to whatever your lightmap channel is. On the Shader tab, set the Detail Color to Scale. On the Textures tab, set your Stage 1 (Detail Texture) to the lightmap's filename. The Pass Hint should be set at Emissive Lightmap so the engine code knows exactly why it's there, in case anyone decides to do a WDump analysis of your soon to be W3D file. Export to W3D and check our your newly lightmapped building!
There's more work than this once you get it into LevelEdit, but I'll let you figure that out on your own. I hope this helps everyone since Reborn seems to think that they're slick with an obvious texture baking technique.
[Updated on: Sun, 18 December 2005 22:17] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Nov 15 20:23:58 MST 2024
Total time taken to generate the page: 0.00817 seconds
|