-
Notifications
You must be signed in to change notification settings - Fork 362
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
Add color82 to generalized_schlick_bsdf #1727
Add color82 to generalized_schlick_bsdf #1727
Conversation
vec3 mx_fresnel_hoffman_schlick(float cosTheta, vec3 F0, vec3 F82, vec3 F90, float exponent) | ||
{ | ||
const float COS_THETA_MAX = 1.0 / 7.0; | ||
const float COS_THETA_FACTOR = 1.0 / (COS_THETA_MAX * pow(1.0 - COS_THETA_MAX, 6.0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency you could use the added mx_pow6 function here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good note, @niklasharrysson, and I had wanted to use the approach you describe, but some GLSL compilers require that a const
value be defined entirely in terms of constant expressions.
So I actually see a compile-time error in my GLSL environment if I use the non-const mx_pow6
as a sub-expression of COS_THETA_FACTOR.
For simplicity, I went back to using the built-in pow
function, but there may be a more clever way of notating mx_pow6
so that it can also be used in this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's fine, this was just a tiny thing I noticed.
This looks good to me @jstone-lucasfilm, and I only had a nitpick comment above. |
2be5b11
to
fe99673
Compare
This changelist adds a color82 input to the generalized_schlick_bsdf node in MaterialX, with a full implementation in hardware shading languages (GLSL/MSL/ESSL) and simple fallback behavior in closure-based shading languages (OSL/MDL). The real-time implementation is based on Naty Hoffman's generalization of Adobe Fresnel (https://renderwonk.com/publications/wp-generalization-adobe/gen-adobe.pdf), which is visually consistent with previous versions of generalized_schlick_bsdf when color82 is left at its default setting.
cb9a99d
into
AcademySoftwareFoundation:dev_1.39
This changelist adds a color82 input to the generalized_schlick_bsdf node in MaterialX, with a full implementation in hardware shading languages (GLSL/MSL/ESSL) and simple fallback behavior in closure-based shading languages (OSL/MDL).
The real-time implementation is based on Naty Hoffman's generalization of Adobe Fresnel (https://renderwonk.com/publications/wp-generalization-adobe/gen-adobe.pdf), which is visually consistent with previous versions of generalized_schlick_bsdf when color82 is left at its default setting.