diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-09-11 17:25:39 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-09-11 17:25:39 +0530 |
| commit | f4ec01f09dbe4b731bee44e12d2c1f93268ca705 (patch) | |
| tree | 7ed1d824edb31ddcd45072920d4f9ee353844918 /src/main/resources/shaders/modules | |
| parent | 41246c0567f4c48ec5788a291386e377241e0eed (diff) | |
| download | art-playground-openrndr-f4ec01f09dbe4b731bee44e12d2c1f93268ca705.tar.gz art-playground-openrndr-f4ec01f09dbe4b731bee44e12d2c1f93268ca705.zip | |
Overdid the raymarch experiment
Diffstat (limited to 'src/main/resources/shaders/modules')
| -rw-r--r-- | src/main/resources/shaders/modules/sdf.cs | 12 | ||||
| -rw-r--r-- | src/main/resources/shaders/modules/utils.cs | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/main/resources/shaders/modules/sdf.cs b/src/main/resources/shaders/modules/sdf.cs new file mode 100644 index 0000000..8121b18 --- /dev/null +++ b/src/main/resources/shaders/modules/sdf.cs @@ -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; +} diff --git a/src/main/resources/shaders/modules/utils.cs b/src/main/resources/shaders/modules/utils.cs new file mode 100644 index 0000000..1616e8c --- /dev/null +++ b/src/main/resources/shaders/modules/utils.cs @@ -0,0 +1,4 @@ +float smin(float a, float b, float k) { + float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0); + return mix(b, a, h) - k * h * (1.0 - h); +} |
