This is a personal project I took on to try and learn GLSL. I’m a Unity dev, generally, so I have more experience with HLSL/NVidia Cg, but it’s good to broaden your horizons. Anyway, aside from some syntax, they’re very similar to work in.
I wanted to challenge myself, so I decided to write a ray marcher. Of course that led me to rendering a fractal. You can view my code on ShaderToy, though be warned, shaders can be a bit opaque at the best of times, and my code isn’t the cleanest. It’s not hard to just change some colors, though.
I first started this way back in 2022, and I worked on it off and on. I haven’t touched it much in months, so I decided to make a post, here. It renders an animated mandelbulb — a kind of 3D version of the Mandelbrot set. The animation is just based on a sine wave, with some extra math that mostly just slows it down a bit.
You can even move the camera, though the controls are pretty janky. Either on the ShaderToy page or the embedded shader here, first click on it to make sure it’s selected then use WASD to move around, QE to rotate, and SPACE/LSHIFT to move up & down. Note that movement is in absolute world space, i.e. it’s not dependent on where you’re looking. I never quite worked out that gremlin.