Baking Global Illumination to Polygon Vertices
Project files: vertexbaking.zip
Scene Setup
The project contains a scene with an extruded
polygon box and some other objects. The box as been subdivided to get enough
vertices along the walls. It's lit by one area light.

A render with default settings looks like this.

Global Illumination Setup
We will use a combination of photon mapping and final gather to calculate global illumination.
First we set the photon mapping parameters. Enable Global Illumination
photons and set the Algorithm to Liquid Light Photon Mapping, set
Photon Accuracy to 200 and Photon Radius to 2.0. Select the area
light and open the Attribute Editor. Under Turtle -> Photon Emission enable
Emit Photons, set Photon Energy to 500 and increase Global
Illum Photons to 100.000. Render the scene again.


Baking Setup
We are now ready to bake this lighting into the polygon vertices.
- Place the p_roomShape in a Bake Layer. You do this by opening up the Turtle Bake Layer Editor. It is found under Window -> Rendering Editors -> Turtle -> Bake Layer Editor.
- Change Turtle to operate in Vertex Baking Mode. Select Vertex Bake from the Render Type drop down in the Turtle Render Globals.
- Open the Vertex Bake tab in the Render Globals. Make sure that the Bake Layer that is selected is the same one you assigned the p_roomShape to.
- Since we are essentially baking the inside of a cube you'll need to change the Normal Direction to Surface Back. You'll find the setting under the Vertex Bake -> Bake Options roll-out in the Render Globals.
- Hit the Render button.

Vertex Bias
When using final gather there is a problem when a sample position is placed
exactly in a corner. Some gathering rays can then escape out through the walls
and the result is an incorrect lighting. The Vertex Bias is used to
solved this. It moves the sample position towards the center of the triangle.
This is demonstrated in the following two images. The default Vertex Bias
0.001 is often enough to remove this problem.

- Vertex Bias 0.0

- Vertex Bias: 0.005
Vertex Color Filter
The Vertex Color Filter can be used to smooth the baked colors. This is
demonstrated in the following images.

- Vertex Color Filter: 0.0

- Vertex Color Filter: 0.05

- Vertex Color Filter: 0.1
Finally we bake the other objects as well. Make sure to use the right Normal Direction (set it to Surface Front for the sphere and boxes).

These vertex colors can now be exported for use in real-time applications. If you want to test render in Turtle, you can assign a ilrPolyColorPerVertex node to an appropriate channel. For example, if you have baked the Indirect Light on the p_roomShape, connect a ilrPolyColorPerVertex shader to the Ambient slot on the p_roomShape shader.