Skip to content
Stefan Keim edited this page Jul 24, 2021 · 3 revisions

In addition to regular cubemaps, kubi allows to generate two optimized mappings:

Both transforms are univariate and therefore very easy to implement. They both significantly reduce the distortion of the cubemap and thus optimize the pixel yield. However, support in other tools and libraries is rather scarce.

error ltr: regular cubemap, EAC, OTC
area error_area
distance error_distance

To ensure the correct representation of a transformed cubemap, the reverse transformation must be performed at some point. The following example shows this for the OTC transformation in a fragment shader.

//FRAGMENT SHADER for OTC

vec3 n = vNormal.xyz; // or vPosition

n /= max(max(abs(n.x),abs(n.y)),abs(n.z));
n = atan(n * tan(0.8687));

gl_FragColor = textureCube(otcSampler, n);

(This is a copies a section of the README.md that allows to link directly without an anchor - I'm looking at you hackernews ;-)

Clone this wiki locally