Mastering GLSL in TouchDesigner, Lesson 9: Fractals

In this lesson of Mastering GLSL in TouchDesigner, we explore fractals, their mathematical foundations, and how to implement them in shaders. Fractals exhibit self-similarity at different scales, appearing in nature, financial markets, and computer graphics. Weโ€™ll introduce complex numbers, explain their role in fractal generation, and dive into Mandelbrot and Julia sets, demonstrating how recursion and iteration create infinitely detailed structures.

๐Ÿ“Œ Key Topics Covered:
โœ… What is a fractal, and how does it exhibit infinite complexity?
โœ… Understanding self-similarity, fractional dimension, and recursion
โœ… Real-world examples of fractals (coastlines, snowflakes, stock markets)
โœ… Complex numbers in GLSL and how to perform arithmetic operations
โœ… Implementing Mandelbrot and Julia sets in shaders
โœ… Using distance metrics and coloring techniques to visualize fractals

๐ŸŽจ Exercises & Challenges:
๐Ÿ› ๏ธ Apply a cosine color palette to the Mandelbrot set
๐Ÿ› ๏ธ Implement a smooth, animated Julia set shader
๐Ÿ› ๏ธ Use domain manipulation, noise textures, or custom palettes to enhance your fractals
๐Ÿ› ๏ธ Experiment with different rendering techniques to create something unique

๐Ÿ”— Further Learning & References:
๐Ÿ“– Inigo Quilez – Distance Fractals
๐Ÿ“– Fractals & Rendering Techniques
๐Ÿ“– Mandelbrot Set Smoothing
๐Ÿ“– [Antifragile by Nassim Taleb]

Find me online:
๐Ÿ”น Project Files & Patreon: https://www.patreon.com/water__shed
๐Ÿ”น Portfolio: https://www.lakeheckaman.com
๐Ÿ”น Instagram: https://instagram.com/lake_heckaman

00:00 – Start
00:01 – Intro – Fractals in GLSL Shaders in TouchDesigner
03:09 – What is a fractal?
05:50 – Complex Numbers Crash Course
10:30 – Working with complex numbers in GLSL
13:09 – Defining a fractal in GLSL
17:48 – Simple Mandelbrot shader example
20:51 – Marker 7
23:06 – Write mandelbrot fractal shader from scratch
27:58 – Continuous iteration count (smoothing) implementation in GLSL
32:23 – Implementing infinite zoom
36:34 – Raymarched 3D Fractal Example
38:27 – Supersampling
42:17 – Exercises

About The Author