LYGIA Shader Library

parabola (lygia/v1.1.6/math/parabola)

A nice choice to remap the 0..1 interval into 0..1, such that the corners are mapped to 0 and the center to 1. You can then rise the parabolar to a power k to control its shape. From https://iquilezles.org/articles/functions/

Use:

<float> parabola(<float> x, <float> k)

Check it on Github


#ifndef FNC_PARABOLA
#define FNC_PARABOLA
float parabola(const in float x, const in float k ) { return pow( 4.0*x*(1.0-x), k ); }
#endif

Use:

<float> parabola(<float> x, <float> k)

Check it on Github


#ifndef FNC_PARABOLA
#define FNC_PARABOLA

float parabola( float x, float k ) { return pow( 4.0*x*(1.0-x), k ); }

#endif

Dependencies:

Use:

<float> parabola(<float> x, <float> k)

Check it on Github



#ifndef FNC_PARABOLA
#define FNC_PARABOLA

inline __device__ __host__ float parabola( float x, float k ) { return pow( 4.0f * x * (1.0f - x), k ); }

#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