Procedural Foliage Placement

Orbis contains a system to dynamically stream foliage in/out during runtime. Foliage spawning can be customized based on a number of factors.

Orbis is capable of adding foliage to terrains. Each foliage instance is represented by an entity, which is spawned or deleted when certain rules are met. Since each foliage instance is an entity, they can be used by other systems. This also means that they can be rendered and configured independant of Orbis. LOD Groups and colliders can be used on foliage, since they are standalone entities.

Foliage is scattered using poisson disk sampling, which ensures that there are no repeating pattern and the spawning positions all appear random.

Setting Up

To add foliage to a terrain, simply add entries to the Vegetation Settings list in the Orbis Baker. It usually makes sense to use the same rules for all 6 sides of a planet.

Spawning Rules

To defined the vegetation instances that can be spawned and control where to place them, the vegetation settings are used. This is a list containing all spawning rules. Each spawning rule has the properties:

  • LOD Level: The Lod level at which this spawning rule applies. Whenever a terrain resultion is being increased, it checks whether new resolution’s LOD level has spawning rules. If one matches, the rule will applied and new foliage will be spawned on that terrain chunk.
  • MinObjectDistance: The minimum amount of distance between two objects that are spawned using this rule. Note that this is before positions are moved to the surface of spherical planets, so rescaling those distances them might be required.
  • Prefab: The entity prefab that will be spawned by this rule. At the start of this script, the prefab will be converted to an entity, so most MonoBehaviour components will not work, only entity components are supported.
  • HeightRange: The minimum(x-component)- and maximum(y- component) heights where foliage can be spawned. This is relative to the zero-height of the terrain, and can be ranging from -maxheight to maxheight of the terrain.
  • NormalAngleRange: The minimum- and maximum normal angle (steepness) of the terrain at which foliage can be spawned. 0 means flat terrain, 90 is a complete cliff
  • BiomeTarget: Can range from 0-1 or any value inbetween. This describes the target biome (which also is represented as a value between 0 and 1) where foliage can be spawned.
  • BiomeRange: This describes how close the terrain’s ‘biome’ value at any position has to be to match the BiomeTarget.
  • HeightOffset: Allows foliage to be moved up and down when being spawned