Unity little toy shaders
Here’s a small but growing collection of little Unity toys with more or less typical mathematical tricks implemented in a fragment shader. What’s impressive is, as often happens in maths, the simplicity of most formulas when implemented. I’ve always found coding things that have a visual output a really good way of understanding maths. I adapted these old snippets I made in Processing to ShaderLab/CG. I intentionally shared them in their most basic form to leave room to creativity.
How much I love this stuff I just can’t explain.
To use these toys in Unity, you need to:
- Create a shader asset.
- Create a material and assign the new shader to it (this is done automagically if you right click on the shader and create a Material from there).
- Create a quad in your scene.
- Assign the material to the quad.
- Position the camera so the quad faces it (or viceversa) and fills the camera frustum.
#1: Mandelbrot Julia Set
|
|
#2: 3n plus 1 rule
|
|