advanced

#14 Domain Repetition

Infinite shapes with mod()

Domain repetition is one of the most powerful tricks in shader art. By applying mod() to your coordinates, you fold infinite space into repeating cells — define one shape and it appears everywhere. Use floor() to get each cell's unique ID, then feed that ID into a hash to give every copy a different rotation, color, or animation. This is how shader artists create infinite grids, city scapes, and kaleidoscopic patterns from a single distance function.

Key Concepts

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

Source Code


    
← Previous Polar Coordinates Next → Smooth Blending (SDF)

All Tutorials