Fix T62862 Eevee: Glitchy reflections in ortographic view

This was caused by sign(cubevec.xy) returning 0.0 when one component was 0.
Thus making the resulting component component 0.0 instead of 0.0.
This commit is contained in:
Clément Foucault 2019-03-27 15:18:33 +01:00
parent 021333ae3a
commit 6d1921dd81
Notes: blender-bot 2023-02-14 03:15:44 +01:00
Referenced by issue #62862, Materials in LookDev in Orthographic experience inconsistent shading.
1 changed files with 4 additions and 3 deletions

View File

@ -2,11 +2,12 @@
vec2 mapping_octahedron(vec3 cubevec, vec2 texel_size)
{
/* projection onto octahedron */
cubevec /= dot( vec3(1), abs(cubevec) );
cubevec /= dot(vec3(1.0), abs(cubevec));
/* out-folding of the downward faces */
if ( cubevec.z < 0.0 ) {
cubevec.xy = (1.0 - abs(cubevec.yx)) * sign(cubevec.xy);
if (cubevec.z < 0.0) {
vec2 cubevec_sign = step(0.0, cubevec.xy) * 2.0 - 1.0;
cubevec.xy = (1.0 - abs(cubevec.yx)) * cubevec_sign;
}
/* mapping to [0;1]ˆ2 texture space */