A visualization of different iterated function systems (IFS) fractals using Three.js.
This was my submission for the university lecture 186.186 Fractals
The 3D fractals are implemented by placing base objects (like tetrahedra) at recursively calculated positions using instancing, scaled according to their respective iteration level. To improve performance, all positions are pre-calculated and stored in buffers during initialization. At runtime, the user can select up to which iteration depth the fractal should be displayed.
The movement of the Sierpinski tetrahedron is controlled by 8 matrices, which are passed as uniforms to the vertex shader. A "mask" buffer determines which matrix should be applied to each vertex. The first 4 matrices describe the initial movement where the 3 outer triangles fold inward. The remaining 4 matrices then describe the folding of the inner sub-triangles of all 4 triangular faces.
Additionally, this visualization also includes other simple fractals based on cubes (like Cantor Dust and Menger Sponge) without iteration animation.
- Left Mouse Button: Rotate camera
- Right Mouse Button: Pan camera
- Mouse Wheel: Zoom
- Fractal type selector
- Animation speed control (0.125x - 8x)
- Information display (Hausdorff dimension, iteration depth, instance count)
- Timeline controls:
- Play/Pause
- Stop/Reset
- Reverse Direction
- Timeline scrubbing
Open index.html in any WebGL-supported browser or check it out online.