Skip to content
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

Reference geometric normal in mx_forward_facing_normal #2167

Open
jstone-lucasfilm opened this issue Jan 3, 2025 · 0 comments
Open

Reference geometric normal in mx_forward_facing_normal #2167

jstone-lucasfilm opened this issue Jan 3, 2025 · 0 comments

Comments

@jstone-lucasfilm
Copy link
Member

jstone-lucasfilm commented Jan 3, 2025

As of today, our GLSL implementation of mx_forward_facing_normal uses the per-pixel shading normal to compute whether a surface is forward or back-facing, flipping that same per-pixel normal when the surface is found to be back-facing:

vec3 mx_forward_facing_normal(vec3 N, vec3 V)

Ideally, we should be using the geometric normal to test the facing of the surface, flipping the per-pixel shading normal when the dot product between the geometric normal and view direction is negative. See the OSL codebase for a good reference of this approach:

https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/71dd75945f5257f00ecac1fe151901e81410680b/src/shaders/stdosl.h#L204

@jstone-lucasfilm jstone-lucasfilm changed the title Reference geometric normal in mx_face_forward_normal Reference geometric normal in mx_forward_facing_normal Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant