Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix IBL with anisotropic shading in Mobile renderer

BlueCube33100cbed43e371a
diff --git a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
index d05ae23fac6..3b05e999a99 100644
--- a/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
+++ b/servers/rendering/renderer_rd/shaders/forward_mobile/scene_forward_mobile.glsl
@@ -1603,7 +1603,7 @@ void main() {
hvec3 anisotropic_direction = anisotropy >= 0.0 ? binormal : tangent;
hvec3 anisotropic_tangent = cross(anisotropic_direction, view);
hvec3 anisotropic_normal = cross(anisotropic_tangent, anisotropic_direction);
- hvec3 bent_normal = normalize(mix(indirect_normal, anisotropic_normal, anisotropy * clamp(half(5.0) * roughness, half(0.0), half(1.0))));
+ hvec3 bent_normal = normalize(mix(indirect_normal, anisotropic_normal, abs(anisotropy) * clamp(half(5.0) * roughness, half(0.0), half(1.0))));
hvec3 ref_vec = reflect(-view, bent_normal);
ref_vec = mix(ref_vec, bent_normal, roughness * roughness);
#else