Calculates static lighting information for the mesh and saves it in the mesh as a material property texture.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- Model I/O
A value between
1that determines the fidelity and performance of light map calculation. Higher values produce more accurate output at the cost of more processing time and memory usage.
An array of lights that should affect the mesh.
An array of other objects in the scene that should affect static lighting for the mesh.
The name of the vertex attribute for storing generated texture coordinate data.
The name of the material for storing the generated texture image.
YES if light map generation succeeded; otherwise
A light map contains, for each point on a surface, information about how light sources in a scene affect the shading of that surface. Because many of the lighting effects in a scene are static—that is, the positions of lights relative to the surfaces they illuminate do not change over time—you can achieve high-fidelity lighting effects with little render-time performance cost by using this method to precalculate (or “bake”) light information into a mesh. You can then use the resulting information in shading to produce a more realistic render.
This method saves light map data as a texture image and associates that image with the mesh through the material property specified in the
material parameter. To map the texture onto the mesh’s surface, this method also generates texture coordinates and writes them in the vertex attribute specified in the
vertex parameter. If the mesh already contains that attribute, this method overwrites the contents of the corresponding vertex buffer. If the mesh does not contain that attribute, this method creates a new attribute and updates the mesh’s
vertex object accordingly.
bake parameter controls the fidelity and performance of the lighting calculation process and its output using an arbitrary scale. To control quality based on texture size, use the