Creating a fractal texture using the compute shader
The Mandelbrot set is based on iterations of the following complex polynomial:
z and c are complex numbers. Starting with the value z = 0 + 0i, we apply the iteration repeatedly until a maximum number of iterations is reached or the value of z exceeds a specified maximum. For a given value of c, if the iteration remains stable (z doesn't increase above the maximum) the point is inside the Mandelbrot set and we color the position corresponding to c black. Otherwise, we color the point based on the number of iterations it took for the value to exceed the maximum.
In the following image, the image of the Mandelbrot set is applied as a texture to a cube:
We'll use the compute shader to evaluate the Mandelbrot set. Since this is another image-based technique, we'll use a two-dimensional compute space with one compute shader invocation per pixel. Each invocation can work independently, and doesn't need to share any data with other invocations.