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

Ensure schlick is available when using clearcoat with GGX #100081

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,8 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, bool is_di
float ccNdotL = max(min(A + dot(vertex_normal, L), 1.0), 0.0);
float ccNdotH = clamp(A + dot(vertex_normal, H), 0.0, 1.0);
float ccNdotV = max(dot(vertex_normal, V), 1e-4);

#if !defined(SPECULAR_SCHLICK_GGX)
float cLdotH5 = SchlickFresnel(cLdotH);
#endif

float Dr = D_GGX(ccNdotH, mix(0.001, 0.1, clearcoat_roughness));
float Gr = 0.25 / (cLdotH * cLdotH);
float Fr = mix(.04, 1.0, cLdotH5);
Expand Down Expand Up @@ -212,7 +210,9 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, bool is_di
float G = V_GGX(cNdotL, cNdotV, alpha_ggx);
#endif // LIGHT_ANISOTROPY_USED
// F
#if !defined(LIGHT_CLEARCOAT_USED)
float cLdotH5 = SchlickFresnel(cLdotH);
#endif
// Calculate Fresnel using specular occlusion term from Filament:
// https://google.github.io/filament/Filament.html#lighting/occlusion/specularocclusion
float f90 = clamp(dot(f0, vec3(50.0 * 0.33)), metallic, 1.0);
Expand Down