OgreMax Scene Exporter for 3DS Max - Create Light Maps with the 3DS Max 'Render to Texture' Feature

Create Light Maps with the 3DS Max 'Render to Texture' Feature

This tutorial demonstrates how to use the 3DS Max 'Render to Texture' feature with OgreMax materials to create light maps.

First, create a simple scene. In this tutorial, a target directional light has been created, and its shadow casting property has been turned on:

Perform a render to make sure the shadows are visible:

Now it's time to create an OgreMax material. This material will later be applied to all the objects:

Next...

- Add a technique to the material.
- In the technique, add a pass.
- In the pass, add a texture unit.
- In the texture unit, select a bitmap. This tutorial uses BeachStones.jpg, included with the OgreMax Viewer samples.
- As an optional, but very useful step, this bitmap can be set into the top level OgreMax Material's View/Render Material (as a diffuse map) so that the 3DS Max and Ogre renderings look similar.

Apply the newly created material to all of the objects in the scene. If you set up the View/Render material to use the same bitmap as the OgreMax material, the scene will look something like this:

In order for the 3DS Max 'Render to Texture' feature to work correctly, all of the objects need to have their own material. This is because each object receives its own rendered texture. Make sure all the objects are selected, and select the Create Master/Slave Materials item in the OgreMax Menu.

Now it's time to choose where 3DS Max sends its render-to-texture bitmap for each OgreMax material. With all of the objects selected, select Set Render to Texture Destinations... from the OgreMax menu. For the texture unit, choose 2 since texture unit 1 is already being used by the BeachStones.jpg bitmap.

With all of the objects selected, bring up the 3DS Max render-to-texture window. This is found under the Rendering -> Render to Texture... menu. Make the following changes:

- Output Path - Set it to be the directory where you plan to later export your scene.
- Output - Click the Add button and add a LightingMap output.
- Mapping Coordinates Channel - This specifies the texture channel (in each object) to be created during the render-to-texture process. Set it to 2. This value will automatically be put into each affected texture unit after the render-to-texture process is complete.
- Selected Element Common Settings/Target Map Slot - Make sure Technique1 is selected.
- Baked Material Settings - Choose Output Into Source. This will send each render-to-texture bitmap to the material of each object.

Press the Render button. That's it! That light maps are now generated.

At this point you can export the scene and load it into the OgreMax Scene Viewer to see the finished results. Note that there was no need to modify the blending settings for the texture units created to hold the rendered textures because the default mode is modulate, which multiplies the light map with the previous texture unit (which uses the BeachStones.jpg bitmap).