← All Projects

Ray Marcher

A WebGL fragment shader that renders 3D scenes using ray marching. Real-time constructive solid geometry, soft shadows, and ambient occlusion.

WebGLGLSLRayMarching

What Is Ray Marching?

Unlike traditional rasterization, ray marching traces rays through a signed distance field (SDF) to find surface intersections. This enables rendering complex shapes like fractals, blobs, and CSG operations that would be difficult with polygons.

Features

The Shader

The entire renderer fits in a single fragment shader. The SDF defines the scene geometry; the ray march loop steps along each ray until it hits a surface or exceeds the max distance.