Merge pull request #51782 from clayjohn/GLES3-octahedral-normalize
Normalize the results of octahedral decompression
This commit is contained in:
commit
2bc1d82098
3 changed files with 3 additions and 3 deletions
|
@ -115,7 +115,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);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -264,7 +264,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);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ Vector3 VisualServer::oct_to_norm(const Vector2 v) {
|
|||
float t = MAX(-res.z, 0.0f);
|
||||
res.x += t * -SGN(res.x);
|
||||
res.y += t * -SGN(res.y);
|
||||
return res;
|
||||
return res.normalized();
|
||||
}
|
||||
|
||||
// Convert Octohedron-mapped normalized tangent vector back to Cartesian
|
||||
|
|
Loading…
Reference in a new issue