Real 3D, drawn by maths
What it takes to build
Level 3's maze faked 3D. This is the real thing — and there's still no 3D model anywhere. There are no shapes, no vertices, no mesh. The scene is described as a formula.
How it works: write one function that answers a single question: "from this point in space, how far is the nearest surface?" For a sphere that's the distance to its centre minus its radius. One line.
Now, for every pixel, fire a ray and ask that question. If the answer is "4 units away", you can safely jump 4 units forward — nothing can be in the way. Ask again. Jump again. Within about sixty jumps you've either hit something or left the scene. That's raymarching.
The two blobs melt into each other because of one extra line that blends the two distances smoothly. Try doing that with normal 3D models.
And the real jump: this code doesn't run on your processor. It runs on your graphics card, which does all the pixels at the same time instead of one after another. That's why it's smooth.
What to ask for:
WebGL raymarching fragment shader on a fullscreen triangle. Signed distance functions for two spheres and a ground plane, combined with a smooth minimum so they melt together. March up to 64 steps per ray, get the surface normal by sampling the distance field either side on each axis, and shade with one directional light plus distance fog. Animate the spheres with a time uniform.