Skip to content

adremeaux/Procedural-Plant-and-Foliage-Generator

Repository files navigation

Procedural Plant and Foliage Generator

The Procedural Plant and Foliage Generator is a tool written in C# and Unity URP to dynamically generate a stunning array of foliage and full plants from a set of over 100 parameters.

Examples

The tool also allows hybridization between plants at various levels.

Hybrids

Plants are created sequentially with params assigned to major groups, starting from the leaf shape:

Leaf Shape

Examples

Vein Layout

Examples

Vein Width

Examples

Albedo Texture Gen

Examples

Normal Map Texture Gen

Examples

Leaf Distortions

Examples

Leaf Arrangement

Examples

Usage

Load up the Lab scene and begin! Select PlantPrefab, scroll down to the Preset menu, and try loading some different presets.

UI Overview

Examples

  • Core
    • Clear Cache: Used when code or parameter updates are breaking things
    • Refresh: Refresh the AssetDatabase
    • Randomize Seed: Randomize the seed used for randomness generation. This can also be set manually in Deps -> Base Params -> Random Seed
    • Create Texture: Run the enabled Texture Commands (see below) to generate a texture for your current preset
    • Beziers/Veins/Prerender etc: Various view modes that can be used while editing
    • Min Poly/Low Poly etc: Quality levels for mesh generation and subdivision
    • Fix Mats: Sometimes the materials come off, this should fix everything up
  • Texture Commands
    • Render Layers: Which set of textures to create when pressing Create Texture
    • Albedo/Normal/Height/VeinMask: Enable or disable render passes for the various textures
  • Preset
    • Load Preset: Select a preset from the dropdown and press Load Preset to load it
    • Save Preset As: Add a new preset with the given name (this creates a permanent new xml file)
    • Next Preset: Quickly cycle through the presets
    • Change Pot: Change the pot!
  • Generator
    • Render: This shouldn't have to be used, but this will force a full render pass if a setting that has been changed isn't showing up properly (notable usecase: the "enable distortions" checkbox)
    • Randomize: This should randomize the parameters and give a random leaf, but don't expect good results, it needs work

Contributing

Pull requests are welcome. If you would like to contribute new plant designs/presets, you can submit pull requests, but please keep them constrained to setups of real world plants. Although a couple novel plants are included in the presets ("Pumpkin Smash", "Blackstrap"), future requests should be for real plants only.

Where to Start

Here are links to some of the critical files in the project:

License

GNU General Public License v3.0


What's New

v2.0.0

  • Major changes to the distortion flow, moving all distortion code into compute shaders and instancing meshes
  • Introduction of a pure pixel shader materials rendering pipeline. Currently needs to be manually activated in the code. Covers the whole albedo target but is buggy.
  • Physics computations to prevent leaf intersections. Dynamic stems to support sporadically placed leaves.
  • Stem and leaf skinning and rigging. Full physics is implemented however relies on a proprietary library, so has been removed in this version.
  • Rendered plants can be serialized to disc as meshes
  • Major randomization overhaul
  • Lots of new parameters

About

The Procedural Plant and Foliage Generator is an real-time, parameter-based 3D plant creator for all sorts of tropical plants including aroids, orchids, hoyas and begonias

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published