Procedural Fungi Generation

May 28, 2019·
Ben Ahlbrand
Ben Ahlbrand
· 2 min read
Image credit: Unsplash

From time to time, I meander outside my typical work, and pursue a side project, often dealing with some random use of procedural generation techniques.

For this one, over the past winter break, I relaxed by seeing if I could generate mushrooms with a few functions, and arrange them in interesting “pseudo” natural looking ways, perhaps similar to the image below.

https://steemit.com/nature/@mandela/mushroom-clusters

My overall algorithm was as follows:

  • using bezier splines: construct caps, stems, and ‘gills’ - underneath the caps (which aren’t visible in this image)
  • randomly resize the generated mushroom to a few different presets I chose
  • place them according via poisson disk sampling
  • feed these into a naive gravity based attractor (basic n-body simulation), where each mushroom considers every nearby mushroom, and pushes them towards each other (and making sure there’s no great overlap) to go from a more uniform poisson distribution (see below image for an example distribution) to create clusters closer to what’s shown in the image above

2D poisson distribution, image credit to Cem Yuksel at University of Utah
2D poisson distribution, image credit to Cem Yuksel at University of Utah

2D poisson distribution, image credit to Cem Yuksel at University of Utah

My next steps would be to:

  • create a parameter sweeper to generate many variations of similar mushrooms (i.e. random versions of a species)
  • have them grow towards a light source in the scene
  • while adding noise and wear / tear to the caps to give the geometry a more natural appearance
  • maybe auto texture / bump map them to boost performance of rendering many of these in scenes