-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculation of the normal of bvh::Triangle #18
Comments
This normal is primarily designed to speed up the intersection routine, not really as a normal you would use for rendering. This normal is what you would get in a left-handed coordinate system, which might not be what you would expect. I think this can be changed by just inverting the two arguments to |
Commit 1f2bd69 allows to change the triangle's normal orientation. |
Thank you for the quick fix. FYI: here follows part of the code I used to benchmark.
|
Well now the change is only enabled if you use |
Hi,
I'm trying to understand why the normal of bvh::Triangle is calculated differently than the 'standard' way...
By 'standard', I am referring to the way of calculating the normal of a trial that I found described on many internet sources...
If a triangle is given by vertices
p0
,p1
,p2
, the standard way states that the normal is calculated as follows:normal = cross(p1 - p0, p2 - p0)
If I understand correctly, in bvh::Triangle the edges are stored
e1 = (p0 - p1)
ande2 = (p2 - p0)
.In the constructor
n
is calculated ascross(e1,e2)
, which makes the normal point in the opposite direction than the normal of the 'standard' case.Could you please enlighten me on this subject?
The text was updated successfully, but these errors were encountered: