LYGIA Shader Library

debugCube (lygia/lighting/debugCube)

Debuging cube http://the-witness.net/news/2012/02/seamless-cube-map-filtering/

Use:

<vec3> debugCube(<vec3> _normal, <float> cube_size, <float> lod)

Check it on Github


#ifndef FNC_DEBUGCUBE
#define FNC_DEBUGCUBE

vec3 debugCube(const in vec3 v, const in float cube_size, const in float lod ) {
    float M = max(max(abs(v.x), abs(v.y)), abs(v.z));
    float scale = 1.0 - exp2(lod) / cube_size;
    if (abs(v.x) != M) v.x *= scale;
    if (abs(v.y) != M) v.y *= scale;
    if (abs(v.z) != M) v.z *= scale;
    return v;
}

#endif

Use:

<float3> debugCube(<float3> _norma, <float> cube_size, <float> lod)

Check it on Github


#ifndef FNC_DEBUGCUBE
#define FNC_DEBUGCUBE

float3 debugCube( float3 v, float cube_size, float lod ) {
    float M = max(max(abs(v.x), abs(v.y)), abs(v.z));
    float scale = 1.0 - exp2(lod) / cube_size;
    if (abs(v.x) != M) v.x *= scale;
    if (abs(v.y) != M) v.y *= scale;
    if (abs(v.z) != M) v.z *= scale;
    return v;
}

#endif

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository