This page is created automatically. Click here to view this shader on Shadertoy.
I wanted to create a reference shader similar to "Raymarching - Primitives" (https://www.shadertoy.com/view/Xds3zN), but with ray-primitive intersection routines instead of sdf routines.
As usual, I ended up mostly just copy-pasting code from Íñigo Quílez:
https://iquilezles.org/articles/intersectors
Please let me know if there are other routines that I should add to this shader.
You can find all intersection routines in the Common tab. The routines have a similar signature: a routine returns the distance to the first hit inside the [distBound.x, distBound.y] interval and will set the normal if an intersection is found. If no intersection is found, the routine will return MAX_DIST.
I made a simple ray tracer (Buffer A) to visualize a scene with all primitives.
Use your mouse to change the camera viewpoint.
Source code
You can find (the full source of) Ray Tracing - Primitives on Shadertoy.