advanced

#29 3D Domain Repetition

Infinite 3D grids with mod()

Extend mod() domain repetition to 3D for infinite raymarched grids. Before evaluating the SDF, apply mod(p, spacing) - spacing * 0.5 to all three axes. Use floor(p / spacing) as a cell ID to vary each repeated object. Combine with lighting and fog for an infinite architectural look.

Key Concepts

Try this shader live in the Shader Sandbox editor with real-time preview.
Open in Sandbox

Source Code


    
← Previous Fire & Smoke Next → FBM Terrain

All Tutorials