LYGIA Shader Library

cmyk2rgb (lygia/color/space/cmyk2rgb)

Convert CMYK to RGB

Dependencies:

Use:

cmyk2rgb(<vec4> cmyk)

Check it on Github



#ifndef FNC_CMYK2RGB
#define FNC_CMYK2RGB
vec3 cmyk2rgb(const in vec4 cmyk) {
    float invK = 1.0 - cmyk.w;
    return saturate(1.0-min(vec3(1.0), cmyk.xyz * invK + cmyk.w));
}
#endif

Use:

cmyk2rgb(<float 4> cmyk)

Check it on Github


#ifndef FNC_CMYK2RGB
#define FNC_CMYK2RGB
float3 cmyk2rgb(float4 cmyk) {
    float invK = 1.0 - cmyk.w;
    return saturate(1.0-min(float3(1.0, 1.0, 1.0), cmyk.xyz * invK + cmyk.w));
}
#endif

Dependencies:

Use:

cmyk2rgb(<float4> cmyk)

Check it on Github



#ifndef FNC_CMYK2RGB
#define FNC_CMYK2RGB
float3 cmyk2rgb(float4 cmyk) {
    float invK = 1.0 - cmyk.w;
    return saturate(1.0-min(float3(1.0), cmyk.xyz * invK + cmyk.w));
}
#endif

Check it on Github


fn cmyk2rgb(cmyk: vec4f) -> vec3f {
    let invK: f32 = 1.0 - cmyk.w;
    return saturate(1.0 - min(vec3f(1.0), cmyk.xyz * invK + cmyk.w));
}

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