Calculates ambient occlusion (AO) information for the mesh and saves it in the mesh as a material property texture of the specified size.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- Model I/O
The size of texture image to generate.
The number of rays to trace for each texel in the generated texture to test for potential occlusion. Higher numbers produce more accurate output at the cost of more processing time and memory usage.
A value between
1that scales the strength of the AO effect. Higher values result in higher contrast when the AO texture is used for shading.
An array of other objects in the scene that should affect static ambient 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 AO calculation succeeded; otherwise
Ambient occlusion (AO) is a measure, for each point on a surface, of how much ambient light can reach that point. For example, a narrow, concave section of a mesh does not receive much ambient light compared with a wide, flat section—thus, in a realistic rendering of the mesh, the concave sections should appear darker than the flat sections. This method analyzes the mesh (and, optionally, static elements of its local environment, specified in the
objects parameter) to precompute (or “bake”) AO information for each point on the mesh’s surface. You can then use the resulting information in shading to produce a more realistic render.
This method saves AO 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.
rays parameters together control the fidelity and performance of the AO calculation process and its output. To control quality without specifying a texture size or raytracing options, use the