The fract() function repeats space by tiling UV coordinates into a 0–1 grid, enabling fractal-like layering
fract(x) returns only the fractional part of x (digits after the decimal point), so its output always ranges from 0 to 1. Applied to UV coordinates (fract(uv * n)) this creates n×n repetitions of the original space across the canvas. Each tile contains an independent copy of whatever shape or calculation follows. To make the centered coordinate system work correctly in each tile, the UVs must be scaled first then recentered (subtract 0.5, multiply by 2). When combined with iterative loops, fract-based repetition is the core mechanism for building fractal patterns: each loop iteration scales space differently, and the contributions stack.
Examples
vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
uv = fract(uv * 2.0) - 0.5; // 2x2 tiling
float d = length(uv); // repeated circles
Assessment
Describe what fract(uv * 3.0) - 0.5 looks like applied to the x-axis only (a 1D repetition). Then add a for loop (3 iterations, each scaling by 1.5 and applying fract) and predict qualitatively what the nested repetitions produce.