Easy3D 3.0.0
Loading...
Searching...
No Matches
surface_mesh_ambient_occlusion.h
1
27#ifndef EASY3D_ALGO_SURFACE_MESH_AMBIENT_OCCLUSION_H
28#define EASY3D_ALGO_SURFACE_MESH_AMBIENT_OCCLUSION_H
29
30#include <easy3d/core/surface_mesh.h>
31
32
33namespace easy3d {
34
54 public:
58 struct Parameters {
60 float radius_ratio = 0.1f;
62 int sample_count = 128;
64 float bias_ratio = 0.001f;
66 unsigned int thread_count = 0;
67 };
68
76
86 static SurfaceMesh::VertexProperty<float> bake(SurfaceMesh *mesh, const Parameters &parameters);
87
97 static void colorize(SurfaceMesh *mesh, const SurfaceMesh::VertexProperty<float> &ao,
98 const vec3 &color = vec3(1.0f));
99 };
100
101} // namespace easy3d
102
103
104#endif // EASY3D_ALGO_SURFACE_MESH_AMBIENT_OCCLUSION_H
Vertex property of type T.
Definition surface_mesh.h:255
Per-vertex ambient occlusion computed by hemisphere ray casting.
Definition surface_mesh_ambient_occlusion.h:53
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".
Definition surface_mesh_ambient_occlusion.cpp:274
static SurfaceMesh::VertexProperty< float > bake(SurfaceMesh *mesh)
Computes per-vertex ambient occlusion with the default parameters and stores it in the vertex propert...
Definition surface_mesh_ambient_occlusion.cpp:191
A halfedge data structure for polygonal meshes of 2-manifold topology.
Definition surface_mesh.h:51
Definition collider.cpp:182
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition types.h:44
Bake parameters.
Definition surface_mesh_ambient_occlusion.h:58
unsigned int thread_count
The number of worker threads; 0 uses the hardware concurrency.
Definition surface_mesh_ambient_occlusion.h:66
float bias_ratio
The ray origin offset along the normal, as a fraction of the search radius.
Definition surface_mesh_ambient_occlusion.h:64
int sample_count
The number of cosine-weighted hemisphere rays per vertex.
Definition surface_mesh_ambient_occlusion.h:62
float radius_ratio
The search radius, as a fraction of the mesh bounding-sphere radius.
Definition surface_mesh_ambient_occlusion.h:60