EEVEE: Fix sky zenith bug

Careless use of acos() in spherical coordinates transformation was
deteriorating the precision near zenith (and nadir) and producing
glitchy pixels (best seen in longer focal lengths).

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D8266
This commit is contained in:
Szymon Ulatowski 2020-07-13 17:02:19 +02:00 committed by Clément Foucault
parent 16989c4d1d
commit 29da019cb3
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ float sky_angle_between(float thetav, float phiv, float theta, float phi)
vec3 sky_spherical_coordinates(vec3 dir)
{
return vec3(acos(dir.z), atan(dir.x, dir.y), 0);
return vec3(M_PI_2 - atan(dir.z, length(dir.xy)), atan(dir.x, dir.y), 0);
}
/* Preetham */