LYGIA Shader Library

quintic (lygia/math/quintic)

quintic polynomial https://iquilezles.org/articles/smoothsteps/

Use:

<float|vec2|vec3|vec4> quintic(<float|vec2|vec3|vec4> value);

Check it on Github


#ifndef FNC_QUINTIC
#define FNC_QUINTIC 

float quintic(const in float v) { return v*v*v*(v*(v*6.0-15.0)+10.0); }
vec2  quintic(const in vec2 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }
vec3  quintic(const in vec3 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }
vec4  quintic(const in vec4 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }

#endif

Use:

<float|float2|float3|float4> quintic(<float|float2|float3|float4> value);

Check it on Github


#ifndef FNC_QUINTIC
#define FNC_QUINTIC 

float   quintic(const in float v)   { return v*v*v*(v*(v*6.0-15.0)+10.0); }
float2  quintic(const in float2 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }
float3  quintic(const in float3 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }
float4  quintic(const in float4 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }

#endif

Use:

<float|float2|float3|float4> quintic(<float|float2|float3|float4> value);

Check it on Github


#ifndef FNC_QUINTIC
#define FNC_QUINTIC 

float quintic(const float v) { return v*v*v*(v*(v*6.0-15.0)+10.0); }
float2  quintic(const float2 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }
float3  quintic(const float3 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }
float4  quintic(const float4 v)  { return v*v*v*(v*(v*6.0-15.0)+10.0); }

#endif

Check it on Github


fn quintic(v: f32) -> f32 { return v*v*v*(v*(v*6.0-15.0)+10.0); }
fn quintic2(v: vec2f) -> vec2f { return v*v*v*(v*(v*6.0-15.0)+10.0); }
fn quintic3(v: vec3f) -> vec3f { return v*v*v*(v*(v*6.0-15.0)+10.0); }
fn quintic4(v: vec4f) -> vec4f { return v*v*v*(v*(v*6.0-15.0)+10.0); }

Dependencies:

Use:

<float|float2|float3|float4> quintic(<float|float2|float3|float4> value);

Check it on Github



#ifndef FNC_QUINTIC
#define FNC_QUINTIC 

inline __host__ __device__ float   quintic(float v)   { return v*v*v*(v*(v*6.0f-15.0f)+10.0f); }
inline __host__ __device__ float2  quintic(const float2& v)  { return v*v*v*(v*(v*6.0f-15.0f)+10.0f); }
inline __host__ __device__ float3  quintic(const float3& v)  { return v*v*v*(v*(v*6.0f-15.0f)+10.0f); }
inline __host__ __device__ float4  quintic(const float4& v)  { return v*v*v*(v*(v*6.0f-15.0f)+10.0f); }

#endif

Examples

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