LYGIA Shader Library

palette (lygia/color/palette)

Procedural generation of color palette algorithm explained here http://www.iquilezles.org/www/articles/palettes/palettes.htm)

Dependencies:

Use:

<vec3|vec4> palette(<float> t, <vec3|vec4> a, <vec3|vec4> b, <vec3|vec4> c, <vec3|vec4> d)

Check it on Github



#ifndef FNC_PALETTE
#define FNC_PALETTE
vec3 palette (in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d) { return a + b * cos(TAU * ( c * t + d )); }
vec4 palette (in float t, in vec4 a, in vec4 b, in vec4 c, in vec4 d) { return a + b * cos(TAU * ( c * t + d )); }
#endif

Dependencies:

Use:

palette(<float> t, <float3|float4> a, <float3|float4> b, <float3|float4> c, <float3|float4> d)

Check it on Github



#ifndef FNC_PALETTE
#define FNC_PALETTE
float3 palette (in float t, in float3 a, in float3 b, in float3 c, in float3 d) {
    return a + b * cos(TAU * ( c * t + d ));
}

float4 palette (in float t, in float4 a, in float4 b, in float4 c, in float4 d) {
    return a + b * cos(TAU * ( c * t + d ));
}
#endif

Dependencies:

Use:

palette(<float> t, <float3|float4> a, <float3|float4> b, <float3|float4> c, <float3|float4> d)

Check it on Github



#ifndef FNC_PALETTE
#define FNC_PALETTE
float3 palette (float t, float3 a, float3 b, float3 c, float3 d) { return a + b * cos(TAU * ( c * t + d )); }
float4 palette (float t, float4 a, float4 b, float4 c, float4 d) { return a + b * cos(TAU * ( c * t + d )); }
#endif

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