Vertex Shader Baking
With the Vertex Shader Baking function you can bake (or burn in) the illumination colors of the scene directly to the vertices of the geometry as a vertex color map. This type of map is often used in real-time environments, such as games, as a way to limit processing requirements by pre-computing lighting in a scene. Because the color map stores values with the vertices themselves, the resolution of the resulting map is dependent on the resolution of the mesh.
RayGL in-viewport render preview |
The resulting baked Vertex Color map |
Usage
Before baking, set up the target surfaces with the desired colorations. The resulting vertex color map takes not only illumination (all lighting including global illumination) into account, but is a combination of the surfacing and the lighting in the scene. Make sure that the target items are selected either in the 3D viewport or in the Items list. Then, from the menu bar, click Vertex Map > Vertex Shader Baking and set the function's options.
• Vertex Map - Provides a way to name the resulting vertex color map. You can accept the default name or type a different name. If the name already exists in the scene, Modo overwrites the values from the existing map with the new values.
• Enable Global Illumination - When enabled, Modo takes all global illumination (GI) from the scene into account. When disabled, Modo only uses illumination from direct light sources.
• Global Illumination Rays - Determines the number of rays used to calculate the global illumination. Vertices in a mesh are generally at a lower resolution than any bitmap that could be applied to them; therefore, very low values are generally acceptable. However, if there are obvious variances between vertex colors, increase this value from the default.
• Reset Polygon Normals - When enabled, Modo automatically fixes any degenerated polygon normals that might otherwise cause errors in the resulting vertex color map.
• Bake Type - Provides two options to control what Modo bakes (based on the Bake Type set) and where it stores the result of the bake (based on the Output Channels set):
• Illumination - Bakes illumination on all surfaces in the scene using the light in your scene.
• Selected Render Output - Bakes the render output based on your selection in the Shader Tree. Modo computes the effect of the selected render output at every vertex. For example, if you select a render output using the Segment ID effect, the vertices are colored by the segment color.
• Output Channels - Sets the output channels. The following options are available: RGB, RGBA, R, G, B, and A.
Tip: You can set different effects in each channel. For example, if you set the Output Channel to red, the blue and green channels are not affected. You can bake one effect into one channel and another effect into another channel. This is useful when scripting.
Viewing a Vertex Color Map
To view any vertex color map in the 3D viewport, set the viewport display option to Vertex Map and then select the map from the Lists viewport under Other Maps. Depending on the particular lighting and the desired effect, you may also apply vertex smoothing to the vertex illumination result to provide a softer result. For more information on smoothing, see Smooth Vertex Map.
Note: The illumination colors are baked in to the individual vertices themselves, so, for the best results, the geometry needs to be present for the effect to work properly. To visualize the illumination baking, enable the viewport RayGL rendering option to provide an in-viewport reference of the results. When you apply the Vertex Shader Baking command, Modo samples the color at each vertex point in 3D space (including cast shadows and the effects of global illumination and surfacing) and applies the color at that particular point to the vertex. With well-modeled geometry, this can produce very realistic results that take little time to render or display. Many real-time gaming engines use these maps to simulate lighting in an environment without the processing overhead of calculating the lighting per frame.
Tip: Game engines usually display vertex color maps differently than Modo does. Therefore, test geometry in your target application to confirm the expected results.