r/generative • u/OrdinaryOstrich6240 • 1d ago
Gray-Scott reaction-diffusion rendered by gradient magnitude (C++ / OpenMP / SFML)
64
Upvotes
r/generative • u/OrdinaryOstrich6240 • 1d ago
6
u/OrdinaryOstrich6240 1d ago
built this from scratch in c++17 with openmp and sfml 3 to mess around with reaction-diffusion on cpu. grid is 640x640, running a 9-point periodic laplacian on flat ping-pong buffers.
the clip switches parameters mid-run from maze (f=0.0290, k=0.0570) to spirals (f=0.0180, k=0.0510). mapping raw V directly looked kind of flat and washed out, so instead i computed the central-difference gradient magnitude per pixel and mixed it with the base concentration (body * 0.52 + edge * 0.68) through a 256-entry color lut, plus a radial vignette. keeps flat interiors dark blue while lighting up the moving wavefronts.
code and benchmarks are here if anyone wants to try running it: https://github.com/Aj4y7/tur.ing
2
u/dstark1993 11h ago
Pretty!