Medium Patterns
Truchet maze
Random quarter-circle tiles that join into a flowing maze.
How this challenge works
You write a fragment shader that draws the picture above, live in your browser. A match bar shows how close you are, and the score combines accuracy, code size (the par is 411 characters in Unity (Built-in)) and GPU speed. Work in HLSL, GLSL, WGSL, Metal or Godot and export the result when you are done.
The numbers you need
- Grid
uv * float2(16.0, 12.0)- Flip
if hash(id) > 0.5, mirror the cell: f.x = 1.0 - f.x- Distance
d = min(abs(length(f) - 0.5), abs(length(f - 1.0) - 0.5))- Line
1.0 - smoothstep(0.03, 0.06, d)- Colors
float3(0.08,0.1,0.2) / float3(0.4,0.9,0.8)
Helper functions provided
The toolbox has: hash(). Add them above your frag function with one click.
Solve it in your language
Unity (Built-in), Unity (URP), Unreal, Shadertoy / WebGL, OpenGL (LWJGL, raylib), three.js, GameMaker, LÖVE (Lua), Godot, Apple (iOS, macOS), WebGPU / Bevy.
Start coding