Merge pull request #44293 from lawnjelly/normal_compression
Fix bug in normal map decompression
This commit is contained in:
commit
00d9ffe012
2 changed files with 2 additions and 2 deletions
|
@ -455,7 +455,7 @@ void main() {
|
||||||
|
|
||||||
if (use_default_normal) {
|
if (use_default_normal) {
|
||||||
normal.xy = texture2D(normal_texture, uv).xy * 2.0 - 1.0;
|
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;
|
normal_used = true;
|
||||||
} else {
|
} else {
|
||||||
normal = vec3(0.0, 0.0, 1.0);
|
normal = vec3(0.0, 0.0, 1.0);
|
||||||
|
|
|
@ -549,7 +549,7 @@ void main() {
|
||||||
|
|
||||||
if (use_default_normal) {
|
if (use_default_normal) {
|
||||||
normal.xy = textureLod(normal_texture, uv, 0.0).xy * 2.0 - 1.0;
|
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;
|
normal_used = true;
|
||||||
} else {
|
} else {
|
||||||
normal = vec3(0.0, 0.0, 1.0);
|
normal = vec3(0.0, 0.0, 1.0);
|
||||||
|
|
Loading…
Reference in a new issue