LYGIA Shader Library

lab2srgb (lygia/v1.2.0/color/space/lab2srgb)

Converts a Lab color to RGB color space. https://en.wikipedia.org/wiki/CIELAB_color_space

Dependencies:

Use:

<vec3|vec4> lab2srgb(<vec3|vec4> color)

Check it on Github



#ifndef FNC_LAB2SRGB
#define FNC_LAB2SRGB
vec3 lab2srgb(const in vec3 lab) { return xyz2srgb( lab2xyz( lab ) ); }
vec4 lab2srgb(const in vec4 lab) { return vec4(lab2srgb(lab.rgb), lab.a); }
#endif

Dependencies:

Use:

<float3|float4> lab2srgb(<float3|float4> color)

Check it on Github



#ifndef FNC_LAB2SRGB
#define FNC_LAB2SRGB
float3 lab2srgb(const in float3 lab) {
    return xyz2srgb( lab2xyz( lab ) );
    // return xyz2srgb( lab2xyz( float3( 100.0 * lab.x,
    //                                 2.0 * 127.0 * (lab.y - 0.5),
    //                                 2.0 * 127.0 * (lab.z - 0.5)) ) );
}
float4 lab2srgb(const in float4 lab) { return float4(lab2srgb(lab.rgb), lab.a); }
#endif

Dependencies:

Check it on Github


fn lab2srgb(lab: vec3f) -> vec3f { return xyz2srgb( lab2xyz( lab ) ); }

License

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