aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/shaders/modules/utils.glsl
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-10-02 19:38:12 +0530
committerAkshay Nair <phenax5@gmail.com>2026-10-03 01:11:58 +0530
commit592603fdeedfd4e6784606b9e7c9c8fdb306af42 (patch)
tree50831dd6c4e84b0f069ecbc36fc6ce7cfa54e6d8 /src/main/resources/shaders/modules/utils.glsl
parentb04c4008e73d1515d1f78f993ca25826847d7207 (diff)
downloadart-playground-openrndr-592603fdeedfd4e6784606b9e7c9c8fdb306af42.tar.gz
art-playground-openrndr-592603fdeedfd4e6784606b9e7c9c8fdb306af42.zip
More eye stuff
Diffstat (limited to 'src/main/resources/shaders/modules/utils.glsl')
-rw-r--r--src/main/resources/shaders/modules/utils.glsl21
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)
+ );
+}