Normals computation

Normals computation

Hi,

I've been wondering about the way Embree computes normals after an intersection with a triangle. After looking at intersect_vec3f, my guess is that each triangle is given a normal Ng that is transferred to each ray intersecting the primitive and computed while initiating the accelerating structures?
Is that so?

In addition, if I wanted to compute the ray normal using, for instance, this formula :

normal = vertice_0.normal + u * (vertice_1 - vertice_0) + v * (vertice_2 - vertice_0)

(or even something more custom using angles or so), what would be the best way? Should I change the code giving the geometric normal for each ray or should I compute it by myself outside Embree core?

By the way, many thanks for your awesome work on Embree, I don't know how my thesis would be going without it!

Cheers,

Hamza

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Embree returns the not normalized geometry normal of the hit triangle in the ray.Ng component. For shading one typically uses interpolated per vertex normals. These should be calculated by the application itself using the formula (1-u-v)*n0 + u*n1 + v*n2.

Leave a Comment

Please sign in to add a comment. Not a member? Join today