Calculates ambient occlusion (AO) information for the mesh and saves it in the mesh as a vertex color attribute.
- iOS 9.0+
- macOS 10.11+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- Model I/O
A value between
1that determines the fidelity and performance of AO calculation. Higher values 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 color data 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 vertex color data.
true 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 per-vertex colors. Using vertex colors to modulate shading can result in similar results without the texture memory and vertex attribute overhead of a texture map, but the fidelity of this effect depends on the vertex complexity of the mesh. Vertex colors are saved 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 AO calculation process and its output using an arbitrary scale. To control quality based on raytracing parameters, use the