This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/engines/eevee/shaders/octahedron_lib.glsl
Clément Foucault 7dd0be9554 EEVEE: Replace octahedron reflection probe by cubemap array
We implement cubemap array support for EEVEE's lightcache reflection probes.
This removes stretched texels and bottom hemisphere seams artifacts caused
by the octahedral projection previously used.

This introduce versioning code for the lightcache which will discard any
lightcache version that is not compatible.

Differential Revision: https://developer.blender.org/D7066
2020-03-11 17:12:16 +01:00

21 lines
504 B
GLSL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
vec2 mapping_octahedron(vec3 cubevec, vec2 texel_size)
{
/* projection onto octahedron */
cubevec /= dot(vec3(1.0), abs(cubevec));
/* out-folding of the downward faces */
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 */
vec2 uvs = cubevec.xy * (0.5) + 0.5;
/* edge filtering fix */
uvs = (1.0 - 2.0 * texel_size) * uvs + texel_size;
return uvs;
}