Stripes and Bands
fract repeats the 0–1 range multiple times across the canvas. step splits each repetition into two halves. Together they make stripes.
fract creates repetition
vUv.x * 12.0 stretches 0–1 into 0–12. fract takes only the fractional part, resetting to 0 every time it crosses a whole number — dividing the canvas into 12 equal segments, each with x running 0–1.
step splits each segment
Within each segment, x < 0.5 gives mask 0 (colorA) and x >= 0.5 gives mask 1 (colorB). The result is evenly-spaced alternating stripes.
Exercise
The exercise starts with stripeCount = 8.0 (8 stripes). Change stripeCount to 12.0 to match the reference output.
Answer Breakdown
Higher stripeCount means narrower, denser stripes. The threshold 0.5 in step(0.5, x) makes both colors equal width. Change it to step(0.3, x) and colorA takes 30% while colorB takes 70%.
Swap vUv.x for vUv.y to get horizontal stripes, or use (vUv.x + vUv.y) * 0.5 for diagonal stripes.