sandpiles

sandpile art
git clone git://git.rr3.xyz/sandpiles
Log | Files | Refs | README | LICENSE

README (1352B)


      1 Tools for creating sandpile [1] art in farbfeld [2] format
      2 
      3 Example:
      4 	spgen 64 64 \         # Create a 64x64 sandpile
      5 	    00,00:16,16:256 \ # Place 256 sand on each cell in the upper left 16x16 block
      6 	    48,00:16,16:256 \ # Same, for the lower left 16x16 block
      7 	    48,48:16,16:256 \ # Same, for the lower right 16x16 block
      8 	    00,48:16,16:256 \ # Same, for the upper right 16x16 block
      9 	| spstabilize4        # Topple the sandpile until it's stable
     10 	| sp2ff               # Convert to farbfeld by assigning colors to sand amounts
     11 	| ff2png > out.png    # Convert to PNG for real use
     12 
     13 There is also spstabilize8, which topples sand into the surrounding 8
     14 neighbours instead of the adjacent 4 with spstabilize4.
     15 
     16 sp2ff accepts arguments to control the output colours. See `sp2ff -h`.
     17 
     18 There is also ff2sp, which converts a grayscale farbfeld image to a sandpile by
     19 placing a given amount of sand on each pixel that is whiter than a threshold
     20 (which is 0x8888 by default).
     21 
     22 spstabilize{4,8} are implemented using AVX2 and are therefore reasonably fast,
     23 but they are still sluggish are enormous sandpiles (e.g., I created an
     24 animation of 600 frames of a 1080p video, and it took over an hour on an AMD
     25 5800X CPU), so I ought to make a GPU implementation.
     26 
     27 [1] https://en.wikipedia.org/wiki/Abelian_sandpile_model
     28 [2] https://tools.suckless.org/farbfeld