Procedural Fungi Generation

generated output

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.

My overall algorithm was as follows:

  1. using bezier splines, construct caps, stems, and ‘gills’ – underneath the caps (which aren’t visible in this image)
  2. randomly resize the generated mushroom to a few different presets I chose
  3. place them according via poisson disk sampling, which I’ve largely encountered in pushing light rays around in global illumination algorithms
  4. 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

My next steps would be to:

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

Leave a Comment

Your email address will not be published.