diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-03-27 17:18:33 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-03-27 21:15:32 +0300 |
commit | 6d1921dd81664c74318b62ae1b2d5e609abce1b4 (patch) | |
tree | 21df4315fcd2807b4801b979abe82b698307c94e | |
parent | 021333ae3afc4ce03dd5a657f0ee2966fe9867b5 (diff) |
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.
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/octahedron_lib.glsl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/octahedron_lib.glsl b/source/blender/draw/engines/eevee/shaders/octahedron_lib.glsl index ec13c885bbb..dfd8fa8a56c 100644 --- a/source/blender/draw/engines/eevee/shaders/octahedron_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/octahedron_lib.glsl @@ -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 */ |