aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/shaders/modules/sdf.glsl
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-09-14 11:46:56 +0530
committerAkshay Nair <phenax5@gmail.com>2026-09-14 11:46:56 +0530
commit707c8896cef6bff291f5d2f3339cf9bf46ee2242 (patch)
treefd62d97b8d92c0b0cc8ff817ce2477df771d20d7 /src/main/resources/shaders/modules/sdf.glsl
parent42b66232530f933b184d446a7461e2e9f8d42bce (diff)
downloadart-playground-openrndr-707c8896cef6bff291f5d2f3339cf9bf46ee2242.tar.gz
art-playground-openrndr-707c8896cef6bff291f5d2f3339cf9bf46ee2242.zip
Refactor stuff
Diffstat (limited to 'src/main/resources/shaders/modules/sdf.glsl')
-rw-r--r--src/main/resources/shaders/modules/sdf.glsl12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/resources/shaders/modules/sdf.glsl b/src/main/resources/shaders/modules/sdf.glsl
new file mode 100644
index 0000000..8121b18
--- /dev/null
+++ b/src/main/resources/shaders/modules/sdf.glsl
@@ -0,0 +1,12 @@
+float sdf_circle(in vec3 p, in float radius) {
+ return length(p) - radius;
+}
+
+float sdf_plane(in vec3 p, in vec3 normal, in float offset) {
+ return dot(p, normal) + offset;
+}
+
+float sdf_box(in vec3 p, in vec3 dimens, in float rounding) {
+ vec3 q = abs(p) - dimens + rounding;
+ return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0) - rounding;
+}