LYGIA Shader Library

quartic (lygia/math/quartic)

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

Use:

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

Check it on Github


#ifndef FNC_QUARTIC
#define FNC_QUARTIC 

float quartic(const in float v) { return v*v*(2.0-v*v); }
vec2  quartic(const in vec2 v)  { return v*v*(2.0-v*v); }
vec3  quartic(const in vec3 v)  { return v*v*(2.0-v*v); }
vec4  quartic(const in vec4 v)  { return v*v*(2.0-v*v); }

#endif

Use:

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

Check it on Github


#ifndef FNC_QUARTIC
#define FNC_QUARTIC

float   quartic(const in float v)   { return v*v*(2.0-v*v); }
float2  quartic(const in float2 v)  { return v*v*(2.0-v*v); }
float3  quartic(const in float3 v)  { return v*v*(2.0-v*v); }
float4  quartic(const in float4 v)  { return v*v*(2.0-v*v); }

#endif

Check it on Github


fn quartic(v: f32) -> f32 { return v*v*(2.0-v*v); }
fn quartic2(v: vec2f) -> vec2f { return v*v*(2.0-v*v); }
fn quartic3(v: vec3f) -> vec3f { return v*v*(2.0-v*v); }
fn quartic4(v: vec4f) -> vec4f { return v*v*(2.0-v*v); }

Dependencies:

Use:

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

Check it on Github



#ifndef FNC_QUARTIC
#define FNC_QUARTIC

inline __host__ __device__ float   quartic(float v)   { return v*v*(2.0f-v*v); }
inline __host__ __device__ float2  quartic(const float2& v)  { return v*v*(2.0f-v*v); }
inline __host__ __device__ float3  quartic(const float3& v)  { return v*v*(2.0f-v*v); }
inline __host__ __device__ float4  quartic(const float4& v)  { return v*v*(2.0f-v*v); }

#endif

Examples

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