Fix T62862 Eevee: Glitchy reflections in ortographic view
authorClément Foucault <foucault.clem@gmail.com>
Wed, 27 Mar 2019 14:18:33 +0000 (15:18 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Wed, 27 Mar 2019 18:15:32 +0000 (19:15 +0100)
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.

source/blender/draw/engines/eevee/shaders/octahedron_lib.glsl

index ec13c885bbb6480d0f8ea3eb694ff633b8a11d22..dfd8fa8a56c98ef70c22939adc5e3d0335e10110 100644 (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 */