Thursday, August 30, 2007

Tutorial: AO and Baked Light Maps - Part 4

... continued from part 3

Normally, baking out a light-map is relatively straightforward, but in this case, we have mapped light (the custom Occlusion texture in the grounds Extra Light slot), skylight exclusions and GI exclusions, which creates a much more complex environment to create our baked lights in.

The key part from the original assignment for this part of the tutorial is, "baking in the more processor-intensive lighting, without losing shadow detail...". We said we'd leave the key light out of the bake so that we could preserve the shadow's clarity.

  1. Open the Starting-Point File
    1. File|Open... field-guide_ao_bake_end_part_3.max
    2. Render.
      This is the point we left off from in part 3 of this tutorial. Since we're going to be changing the global light settings again, lets start by creating a new render preset to work with:
  2. Create a new render presets called "bake" by copying our "full render" preset.
    1. Open the Render Dialog and click the Render Tab
    2. Go to the "Brazil Bridge Renderer" rollout, and click "Manage..."
    3. Select "full render" from the list, and click "Clone"
    4. Rename the new preset ("Copy of full render") to "bake"
    5. Close the "Manage Brazil r/s Renderers" dialog box
    6. In the render panel, in the Brazil Bridge Renderer rollout, change the "Active Setup:" to "bake"
  3. turn off light-source direct illum for the bake pass
    1. In the Renderer Panel of the render dialog, open the "Brazil: Luma Server" rollout
    2. Turn off "Point Lights" and "Area Lights" in the Direct Illumination section
    3. Render. This will give us a render that's just our skylight, AO, and GI
  4. Convert the teapot's material to white plaster for capturing the illumination
    The goal of these next two sections is to convert the current materials to a material that will capture both the direct and indirect (bounce) light falling on the object. We don't want to capture the actual surface colors, specular highlights, etc., but we do want to capture the bounce light created by those surfaces. We do this using a Brazil2 Utiltiy material, using a simple white plaster material as the capturing material, with copies of our original materials used to generate all secondary illumination
    1. In the Material Editor, select the "teapot" material.
    2. drag and drop the "teapot" material swatch to an unused slot to make a copy of it.
    3. Working on the copy you just made, click the material's "Type Button", which says "Brazil2 Advanced" and select a Brazil2 Utility Material.
    4. Select "Keep old material as sub-material?" when prompted.
    5. Open the "Global Illumination Parameters" in the Brazil2 Utility material and drag/drop the "plane (Brazil2 Advanced)" material from the "Base" slot above into the "Material" slot of the Util mtl's GI params.
    6. Select "Copy" when prompted.
    7. Click the map button in the "Base" slot of the Utility Material
    8. Change this material to a white-plaster type:
      1. Set the Material's "Diffuse (Cs)" color to white (255,255,255)
      2. In the Material's "Highlight Shader" rollout, change the highlight shader from "Phong Highlight" to "None"
    9. Click the "Put to Scene" button
      to apply this material to the teapot.
    10. Render.
  5. Convert the plane's material to white plaster types for capturing the illumination
    1. drag and drop the "plane" mtl swatch to an unused slot to make a copy of it.
    2. Working on the copy you just made, click the material's "Type Button", which says "Brazil2 Utility Material" and select a new Brazil2 Utility Material.
    3. Select "Keep old material as sub-material" when prompted.
    4. Open the "Global Illumination Parameters" in the Brazil2 Utility material and drag/drop the "plane (Brazil2 Advanced)" material from the "Base" slot above into the "Material" slot of the Util mtl's GI params.
    5. Select "Copy" when prompted.
    6. Click the map button in the "Base" slot our top-level Utility Material
    7. Click the material "Type Button" and select a new Brazil2 Advanced Material
    8. Change this new material to a white-plaster type:
      1. Set the Material's "Diffuse (Cs)" color to white (255,255,255)
      2. In the Material's "Highlight Shader" rollout, change the highlight shader from "Phong Highlight" to "None"
    9. Click the "Put Material to Scene" button to apply this material to the plane object.
    10. Render.
      The plane comes out black... not what we want. Why? Because the plane is excluded from the scene's skylight illumination and GI -- Once again, we need to explicitly map the illumination onto the plane, using that same Occlusion map we created before.
    11. In the material editor, on the white-plaster material we just created, open the Brazil2 Advanced material "Basic Surfaces Properties" rollout, and click the button that says, "(None)" in the "Extra Light" channel.
    12. In the "Material/Map Browser" Click the "Browse From: Scene" radio button.
    13. Double Click one of the "Brazil2 Occlusion" textures that you see to assign the Ambient Occlusion texture to the Extra Light slot.
    14. Choose "Instance" when prompted for to choose "Instance or Copy".
    15. Render.
      Now the ground renders as white, with our modified skylight shadow.
  6. bake the light map using render to texture
    1. In your max scene, select all your objects (multi-select both the teapot and the plane)
    2. In the Menu, select Rendering | Render To Texture...
    3. In the "Render To Texture" dialog, Change the "Output" path to a location of your choice.
    4. In the "Output" rollout, click "Add" and choose "CompleteMap" from the "Add Texture Elements" list.
    5. Change the output size to 512x512
    6. In the "Baked Material" rollout, select "Render to Files Only" -- we will remap these into the scene by hand so that we have an understanding of how these are used.
    7. Click the "Render" button in the Render To Texture dialog. The baked light maps are rendered and saved.
This last step has rendered out our light maps. In the next step of this tutorial, we will apply these light-maps to our objects using the Extra Light slots in their materials, and change our render settings to include only area and point lights.
Next: Part 5 -- finishing up