fixed incorrect mesh normals in shaders

This commit is contained in:
Ayush Singla 2022-11-18 16:24:56 +05:30
parent 879aac9db4
commit 75ba0a7957
4 changed files with 4 additions and 4 deletions

View file

@ -102,7 +102,7 @@ vec3 oct_to_vec3(vec2 e) {
vec3 v = vec3(e.xy, 1.0 - abs(e.x) - abs(e.y));
float t = max(-v.z, 0.0);
v.xy += t * -sign(v.xy);
return v;
return normalize(v);
}
#ifdef USE_INSTANCING

View file

@ -62,7 +62,7 @@ vec3 oct_to_vec3(vec2 e) {
vec3 v = vec3(e.xy, 1.0 - abs(e.x) - abs(e.y));
float t = max(-v.z, 0.0);
v.xy += t * -sign(v.xy);
return v;
return normalize(v);
}
/* Varyings */

View file

@ -63,7 +63,7 @@ vec3 oct_to_vec3(vec2 e) {
vec3 v = vec3(e.xy, 1.0 - abs(e.x) - abs(e.y));
float t = max(-v.z, 0.0);
v.xy += t * -sign(v.xy);
return v;
return normalize(v);
}
/* Varyings */

View file

@ -63,7 +63,7 @@ vec3 oct_to_vec3(vec2 oct) {
vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));
float t = max(-v.z, 0.0);
v.xy += t * -sign(v.xy);
return v;
return normalize(v);
}
vec3 decode_uint_oct_to_norm(uint base) {