Quinn Le Lievre
← All projects
CourseworkCOSC422

SDF Ray Marcher with Volumetric Clouds

A GPU ray marcher in a single compute shader, with soft shadows, reflections, smooth blending and volumetric clouds.

C++ · OpenGL 4.3 · GLSL · Compute Shaders

A COSC422 project that renders a scene of signed distance fields entirely in an OpenGL compute shader, writing each pixel to a texture drawn on a full-screen quad. Rays march up to 256 steps through spheres, boxes, a box frame and a fractal, with Blinn-Phong lighting, normals from a tetrahedral arrangement of SDF samples, soft shadows from a shadow ray that tracks its closest approach, and up to two reflection bounces. Objects are combined with smooth CSG, and I extended the smooth minimum function to return a blend factor so colour, specularity and reflectivity blend across each join instead of switching abruptly. The fractal is procedurally textured by sampling the SDF around each hit to estimate surface roughness, putting gold on the rough edges and a dark reflective finish on the smoother regions. A volumetric cloud is shaped from smoothly unioned spheres and fractal noise, then lit by marching towards the light. Getting it to cast soft, partial shadows rather than solid ones meant treating it separately from the solid geometry in the shadow pass.

Ray-marched scene with reflective spheres, a box frame, a gold-edged fractal and a volumetric cloud
Close-up of the noise-driven volumetric cloud lit by the sun