diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-10-02 19:38:12 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-10-03 01:11:58 +0530 |
| commit | b9ac03823953b8552d0909a0297884224c5e96fa (patch) | |
| tree | 7ec98b2d89b9e044de71dcd2085fe1bb0524fa5a /src/main/resources/shaders/modules/utils.glsl | |
| parent | 8638d1d00e30396a243c228c3e97c1c0fda3a9e8 (diff) | |
| download | art-playground-openrndr-b9ac03823953b8552d0909a0297884224c5e96fa.tar.gz art-playground-openrndr-b9ac03823953b8552d0909a0297884224c5e96fa.zip | |
More eye stuff
Diffstat (limited to 'src/main/resources/shaders/modules/utils.glsl')
| -rw-r--r-- | src/main/resources/shaders/modules/utils.glsl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/resources/shaders/modules/utils.glsl b/src/main/resources/shaders/modules/utils.glsl index 3520df1..10e3a48 100644 --- a/src/main/resources/shaders/modules/utils.glsl +++ b/src/main/resources/shaders/modules/utils.glsl @@ -7,9 +7,30 @@ float ssubtract(float a, float b, float k) { return -smin(-a, b, k); } +// Easing +float ease_in_out_quart(in float x) { + return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2; +} +vec2 ease_in_out_quart(in vec2 v) { + return vec2(ease_in_out_quart(v.x), ease_in_out_quart(v.y)); +} + +// Color utils vec3 srgb(float r, float g, float b) { return vec3(pow(r, 2.2), pow(g, 2.2), pow(b, 2.2)); } vec3 srgb(vec3 c) { return srgb(c.r, c.g, c.b); } +vec3 srgb(float c) { + return srgb(c, c, c); +} + +vec3 saturation(vec3 color, float s) { + float y = 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b; + return vec3( + y + s * (color.r - y), + y + s * (color.g - y), + y + s * (color.b - y) + ); +} |
