Skip to content

Commit

Permalink
Merge pull request #44293 from lawnjelly/normal_compression
Browse files Browse the repository at this point in the history
Fix bug in normal map decompression
  • Loading branch information
akien-mga authored Dec 11, 2020
2 parents b5e8b48 + e13040b commit 00d9ffe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/gles2/shaders/canvas.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ void main() {

if (use_default_normal) {
normal.xy = texture2D(normal_texture, uv).xy * 2.0 - 1.0;
normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
normal.z = sqrt(max(0.0, 1.0 - dot(normal.xy, normal.xy)));
normal_used = true;
} else {
normal = vec3(0.0, 0.0, 1.0);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gles3/shaders/canvas.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ void main() {

if (use_default_normal) {
normal.xy = textureLod(normal_texture, uv, 0.0).xy * 2.0 - 1.0;
normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
normal.z = sqrt(max(0.0, 1.0 - dot(normal.xy, normal.xy)));
normal_used = true;
} else {
normal = vec3(0.0, 0.0, 1.0);
Expand Down

0 comments on commit 00d9ffe

Please sign in to comment.