LYGIA Shader Library

xyz2srgb (lygia/color/space/xyz2srgb)

Converts a XYZ color to sRGB. From http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html

Dependencies:

Use:

xyz2srgb(<vec3|vec4> color)

Check it on Github



#ifndef FNC_XYZ2SRGB
#define FNC_XYZ2SRGB
vec3 xyz2srgb(const in vec3 xyz) { return rgb2srgb(xyz2rgb(xyz)); }
vec4 xyz2srgb(const in vec4 xyz) { return vec4(xyz2srgb(xyz.rgb), xyz.a); }
#endif

Dependencies:

Use:

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

Check it on Github



#ifndef FNC_XYZ2SRGB
#define FNC_XYZ2SRGB
float3 xyz2srgb(const in float3 xyz) { return rgb2srgb(xyz2rgb(xyz)); }
float4 xyz2srgb(const in float4 xyz) { return float4(xyz2srgb(xyz.rgb), xyz.a); }
#endif

Dependencies:

Check it on Github


fn xyz2srgb(xyz: vec3f) -> vec3f { return rgb2srgb(xyz2rgb(xyz)); }

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