Raymarching & SDF

Version 3 of 4

Infinite repetition.

GPU · 4K-intro style · 2009

This version

One column and one ball, repeated forever with mod(), lit warm and reflected once. A whole city of pillars from four lines of code.

How this version works

At a render scale of 0.6, the shader folds horizontal coordinates into four-unit cells containing a rippling column and smoothly blended spheres repeated every two units vertically. The spheres move along the vertical axis, while a floor and ceiling bound the scene. A forward-moving camera gently turns from side to side, and each pixel traces a primary ray followed by one reflected ray, with up to 90 steps each. Warm diffuse lighting varies with depth, an emissive-looking band brightens the ceiling area, and each ray receives purple distance fog before the reflection is added at 35 per cent strength.

The trick in this version

Modulo operations repeat the geometry without storing separate copies. The reflection is calculated inside the same fragment shader by reflecting the ray about the sampled normal, rather than using a reflection texture or a separate rendering pass.

Historical context · GPU

  1. 2009 · Still, Loonies and others

    The year of raymarching

    In his ‘Behind Elevated’ talk, Quilez calls 2009 a year of ‘AO*Reflection Raymarching’, adoption across the intro scene, documented.

  2. 2008 · Iñigo Quilez · NVScene 2008

    Rendering worlds with two triangles

    The talk that tied full-screen shaders, 4K intros and distance-field acceleration together, with modelling operators, ambient occlusion and soft shadows.

  3. 2013 · Iñigo Quilez & Pol Jeremias

    Shadertoy

    Public shader code with live output: the place where procedural techniques, distance fields above all, are studied, forked and shared.

Platform
GPU · 4K-intro style
Era
GPU
Rendered on
GPU
Tags
domain repetition · reflection
Sources
The year of raymarching (2009)Rendering worlds with two triangles (2008)Shadertoy (2013)