Computer Graphics · 2020

Sierpinski 3D

Sierpinski pyramid: the same fractal as the triangle, now on three faces spinning in WebGL. Raise the level and watch them split.

The trick

Each face is a Sierpinski triangle: join the midpoints, keep the three corners and repeat. Then the same face is copied three times, each turned 120° from the next around the vertical axis.

The math

Each level triples the triangles on each face (3n). With three faces, level 3 draws 81 triangles and level 6 is already 2,187.

Made with

Plain WebGL with its own shaders and gl-matrix: recursion builds the vertices, each triangle gets a random color from the palette, and it rotates a bit every frame. One full turn every 10 seconds.