danielepanozzo / cg-old

44 stars 16 forks source link

Any hint on normal of ray-triangle intersection ? #88

Closed LihengGong closed 5 years ago

LihengGong commented 5 years ago

For ray-sphere intersection, the computation of normal is straightforward, it is pointing from sphere center to the intersection point, but for triangle, although normal is also straightforward(a cross product), the direction of this normal is confusing.

Would you please kindly give any hint on the direction of the normal of ray-triangle intersection ?

danielepanozzo commented 5 years ago

The triangles in the provided mesh files are all oriented consistently, i.e. if you take the dot product between the edge between vertices 1 and 2 of every triangle, and the edge between vertices 2 and 3 of every triangle, you will consistently get a normal pointing inside (or outside, I don't remember what is the convention used for off files).

LihengGong commented 5 years ago

Thanks. That helps me a lot.