Tweetjam 3D Donut

It's a frosted 3D donut, drawn in 265 chars of Lua!
I'm including the code here, with spacing and indents for legibility (instead of minimizing chars like in the cart).
Variable meanings:
XYZ: Current sample position (moves along a camera ray), +Y is up
IJ: Screenspace position
UVW: Ray direction (normalized)
C: Output color of the current ray
K: Raymarch iterator
Q: Distance to the unextruded torus on XZ plane
L: Shortest distance to the surface of the extruded 3D torus
A: Angular position of sample pos around the torus (0-1, repeating)
(Both distance values are signed: a negative distance means that a point is inside a shape)



Close
Connection Error!

Please check your connection and try again.