LYGIA Shader Library

lab2rgb (lygia/v1.1.6/color/space/lab2rgb)

Converts a Lab color to RGB color space.

Dependencies:

Use:

lab2rgb(<vec3|vec4> color)

Check it on Github



#ifndef FNC_LAB2RGB
#define FNC_LAB2RGB
vec3 lab2rgb(in vec3 lab) {
    return xyz2rgb( lab2xyz( vec3(100. * lab.x,
                                    2. * 127. * (lab.y - .5),
                                    2. * 127. * (lab.z - .5)) ) );
}

vec4 lab2rgb(in vec4 lab) { return vec4(lab2rgb(lab.rgb), lab.a); }
#endif

Dependencies:

Use:

lab2rgb(<float3|float4> color)

Check it on Github



#ifndef FNC_LAB2RGB
#define FNC_LAB2RGB
float3 lab2rgb(in float3 lab) {
    return xyz2rgb( lab2xyz( float3(100. * lab.x,
                                    2. * 127. * (lab.y - .5),
                                    2. * 127. * (lab.z - .5)) ) );
}

float4 lab2rgb(in float4 lab) { return float4(lab2rgb(lab.rgb), lab.a); }
#endif

Dependencies:

Check it on Github


fn lab2rgb(lab : vec3<f32>) -> vec3<f32> {
    return xyz2rgb( lab2xyz( vec3<f32>( 100.0 * lab.x,
                                        2.0 * 127.0 * (lab.y - 0.5),
                                        2.0 * 127.0 * (lab.z - 0.5)) ) );
}

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