View shader on Shadertoy - Published on 2019-06-03
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: Common.glsl
Source: Buffer A.glsl
- iChannel0: Buffer A (linear, clamp, vflipped)
Source: Image.glsl
- iChannel0: Buffer A (linear, clamp, vflipped)
- Ray Tracing - Primitives on Shadertoy
- An overview of all my shaders
- My public profile on Shadertoy