-
-
Notifications
You must be signed in to change notification settings - Fork 23.5k
Clearcoat improvements and fixes #111464
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
base: master
Are you sure you want to change the base?
Clearcoat improvements and fixes #111464
Conversation
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index a4e61e8..bd98ee1 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1551,17 +1551,17 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, bool is_di
#endif
#if defined(LIGHT_CLEARCOAT_USED)
- // Clearcoat ignores normal_map, use vertex normal instead
- float ccNdotH = clamp(A + dot(vertex_normal, H), 0.0, 1.0);
- float cLdotH5 = SchlickFresnel(cLdotH);
+ // Clearcoat ignores normal_map, use vertex normal instead
+ float ccNdotH = clamp(A + dot(vertex_normal, H), 0.0, 1.0);
+ float cLdotH5 = SchlickFresnel(cLdotH);
- float Dr = D_GGX(ccNdotH, mix(0.001, 0.1, clearcoat_roughness));
- float Gr = V_Kelemen(cLdotH);
- float Fr = mix(0.04, 1.0, cLdotH5) * clearcoat;
- cc_attenuation = 1.0 - Fr;
- float clearcoat_specular_brdf_NL = clearcoat * Gr * Fr * Dr * cNdotL;
+ float Dr = D_GGX(ccNdotH, mix(0.001, 0.1, clearcoat_roughness));
+ float Gr = V_Kelemen(cLdotH);
+ float Fr = mix(0.04, 1.0, cLdotH5) * clearcoat;
+ cc_attenuation = 1.0 - Fr;
+ float clearcoat_specular_brdf_NL = clearcoat * Gr * Fr * Dr * cNdotL;
- specular_light += clearcoat_specular_brdf_NL * light_color * attenuation * specular_amount;
+ specular_light += clearcoat_specular_brdf_NL * light_color * attenuation * specular_amount;
#endif // LIGHT_CLEARCOAT_USED
if (metallic < 1.0) {The github actions is complaining about formatting. |
|
@fire I'm having trouble with the CHANGELOG.md. The pre-commit hook is giving me this message: "CHANGELOG.md:1297: hidding ==> hiding, hidden." I assume it's because of a typo or spelling error. |
fbe3e95 to
e58b2ee
Compare
|
I already solved it. |
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.
Tested locally, it works as expected in Forward+ and Compatibility.
In Mobile, I get a shader compilation error (and subsequent error spam) though: test_clearcoat_mobile.zip
Visual comparison in Forward+:
| Type | Before | After |
|---|---|---|
| None | ![]() |
![]() |
| ReflectionProbe | ![]() |
![]() |
| SSR | ![]() |
![]() |
| ReflectionProbe + SSR | ![]() |
![]() |
On my end, it's not giving me any error. Could you please show me the error you're getting? |
e58b2ee to
99cc0ae
Compare








Currently, the implementation of Godot's clearcoat is broken as it doesn't correctly reflect the sky and doesn't take the reflection probe's reflections into account, resulting in the clearcoat effect being almost nonexistent.
Improvements and Fixes
The following table shows the before and after.