
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:
- 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, which I’ve largely encountered in pushing light rays around in global illumination algorithms
- 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

http://www.cemyuksel.com/cyCodeBase/soln/poisson_disk_sampling.html
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 even auto texture / bump map them to boost performance of rendering many of these in scenes