aboutsummaryrefslogtreecommitdiff
path: root/resources/shaders/objects/sphere.frag
diff options
context:
space:
mode:
Diffstat (limited to 'resources/shaders/objects/sphere.frag')
-rw-r--r--resources/shaders/objects/sphere.frag7
1 files changed, 7 insertions, 0 deletions
diff --git a/resources/shaders/objects/sphere.frag b/resources/shaders/objects/sphere.frag
new file mode 100644
index 0000000..e69deaa
--- /dev/null
+++ b/resources/shaders/objects/sphere.frag
@@ -0,0 +1,7 @@
+/**
+ * Compute the Signed Distance Function (SDF)
+ * of a sphere.
+ */
+float SphereSDF(vec3 ray_position, vec3 sphere_position, float radius){
+ return(length(ray_position - sphere_position)-radius);
+} \ No newline at end of file