LYGIA Shader Library

xyz2equirect (lygia/space/xyz2equirect)

3D vector to equirect 2D projection

Dependencies:

Use:

<vec2> xyz2equirect(<vec2> d)

Check it on Github



#ifndef FNC_XYZ2EQUIRECT
#define FNC_XYZ2EQUIRECT
vec2 xyz2equirect(vec3 d) {
    return vec2(atan(d.z, d.x) + PI, acos(-d.y)) / vec2(2.0 * PI, PI);
}
#endif

Dependencies:

Use:

<float2> xyz2equirect(<float2> d)

Check it on Github



#ifndef FNC_XYZ2EQUIRECT
#define FNC_XYZ2EQUIRECT
float2 xyz2equirect(float3 d) {
    return float2(atan(d.z, d.x) + PI, acos(-d.y)) / float2(TAU, PI);
}
#endif

Dependencies:

Use:

<float2> xyz2equirect(<float2> d)

Check it on Github



#ifndef FNC_XYZ2EQUIRECT
#define FNC_XYZ2EQUIRECT
float2 xyz2equirect(float3 d) {
    return float2(atan(d.z, d.x) + PI, acos(-d.y)) / float2(2.0 * PI, PI);
}
#endif

Licenses

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