Overview
The start of a ‘falling sand’ shader using cellular automaton modeling.
As of yet:
- it doesnt’ have the sand fall to either direction when it stacks
- Uses a naive implementation to look at the 1000 pixels below the current cell to see if the whole stack is going to fall.
- Doesn’t stack well (layers form; I think this is due to some anti-aliasing, but I’m not 100% certain).
Controls
- Press
C
or the GUI button to clear the canvas - Click and drag to add new sand to the canvas
References:
- Coding Train’s - Ep. #180 on Falling Sand - what originally brought this to my attention.
- Jason.today - Series on Falling Sand - Well written 3-part article series on implementing falling sand.
- YouTube - Yusef28 ‘I Made Falling Sand Games in a Fragment Shader’ - A video that is ‘on-deck’ in my list of resoruces to read through / watch.
- Wikipedia - Falling Sand Games - list of some games that have used this algorithm as a game mechanic.