rtx: cull triangles by their orientation

This commit is contained in:
Ivan Avdeev 2021-12-29 12:37:24 -08:00
parent dcf787274c
commit e98d7d0d7f
1 changed files with 4 additions and 1 deletions

View File

@ -61,7 +61,10 @@ void sampleEmissiveSurface(vec3 throughput, vec3 view_dir, MaterialProperties ma
v[1] = to_shading * vec4(vertices[vi2].pos, 1.);
v[2] = to_shading * vec4(vertices[vi3].pos, 1.);
// TODO cull by normal
// cull by triangle orientation
const vec3 tri_normal_dir = cross(v[1] - v[0], v[2] - v[0]);
if (dot(tri_normal_dir, v[0]) <= 0.)
continue;
// Clip
/* const uint vertex_count = clip_polygon(3, v); */