|
Easy3D 3.0.0
|
Per-vertex ambient occlusion computed by hemisphere ray casting. More...
#include <easy3d/algo/surface_mesh_ambient_occlusion.h>
Classes | |
| struct | Parameters |
| Bake parameters. More... | |
Static Public Member Functions | |
| static SurfaceMesh::VertexProperty< float > | bake (SurfaceMesh *mesh) |
| Computes per-vertex ambient occlusion with the default parameters and stores it in the vertex property "v:ao". | |
| static SurfaceMesh::VertexProperty< float > | bake (SurfaceMesh *mesh, const Parameters ¶meters) |
| Computes per-vertex ambient occlusion and stores it in the vertex property "v:ao". | |
| static void | colorize (SurfaceMesh *mesh, const SurfaceMesh::VertexProperty< float > &ao, const vec3 &color=vec3(1.0f)) |
| Writes the ambient occlusion term to the vertex color property "v:ao_color". | |
Per-vertex ambient occlusion computed by hemisphere ray casting.
Unlike the screen-space ambient occlusion driven by RenderSettings, this is a view-independent bake: around every vertex a set of rays is cast into the cosine-weighted hemisphere of its normal, and the fraction of rays that escape the mesh within the search radius is stored. The result depends only on the geometry (not on a camera or a viewport), is deterministic, and is accurate enough to render publication-quality figures.
Example usage:
The mesh must be a triangle mesh; vertex normals are updated by bake().
|
static |
Computes per-vertex ambient occlusion with the default parameters and stores it in the vertex property "v:ao".
| mesh | The surface mesh (must be a triangle mesh). |
|
static |
Computes per-vertex ambient occlusion and stores it in the vertex property "v:ao".
| mesh | The surface mesh (must be a triangle mesh). |
| parameters | The bake parameters (see Parameters). |
The bake is deterministic: the same mesh and parameters always produce the same values, independent of the thread count.
|
static |
Writes the ambient occlusion term to the vertex color property "v:ao_color".
| mesh | The surface mesh. |
| ao | The per-vertex occlusion term returned by bake(). |
| color | The unoccluded surface color (default: white). |
The resulting color is color * ao, so it can be used directly as a material or exported as vertex colors. The scalar term in "v:ao" stays intact, so the mesh can be colorized repeatedly.