GPUFoliageSystem


Quality and Memory Control ... Multiple GPUFoliageSystem components can run simultaneously. Independent World Rect, Filter Maps, capture data, instance capacity, and memory settings per ...


by SmallBurger


Price History +

GPU-driven billboard foliage system for rendering massive vegetation populations with up to 100 foliage types, featuring fast initialization, low memory usage, minimal CPU overhead, and easy painting.

Architecture

  • Fully GPU-driven foliage generation, culling, instance processing, and indirect rendering.
  • Procedural foliage candidate generation based on density, randomization, scale variation, seeds, and clustering.
  • No need to pre-place large numbers of foliage GameObjects.
  • No need to serialize a complete transform matrix for every foliage instance.

Multi Filter Maps

  • Artist-painted inclusion and exclusion maps.
  • Filter Maps control foliage coverage rather than foliage density.
  • Procedural density can be changed at runtime without repainting Filter Maps.
  • Each GPUFoliageSystem uses its own independent Multi Filter Map set.
  • GPU-based Filter Map evaluation and editing.

GPU Painting

  • Compute Shader-powered foliage painting.
  • Paints directly onto arbitrary mesh surfaces.
  • Supports real-time inclusion and exclusion editing.
  • Uses localized GPU processing for affected brush regions.

GPU Culling and Instance Processing

  • View frustum culling.
  • View distance culling.
  • Filter Map and visibility mask evaluation.
  • Dynamic obstacle mask evaluation.
  • Per-instance randomized placement, scale, rotation, and foliage type selection.
  • Wind animation and wind-driven normal variation.
  • Character interaction processing.
  • Surface height and normal adaptation.

RenderTexture-Based GPU Data

  • GPU culling results are stored in RenderTextures.
  • Vertex Shader visible-instance lookup does not require SSBO access.
  • Avoids reliance on vertex-stage SSBO support and driver behavior.
  • Designed for improved compatibility across mobile GPUs and graphics APIs.
  • Configurable visible-instance capacity for RenderTexture memory control.

Dynamic Mask Capture

  • Runtime surface height and normal capture.
  • Building and obstacle occlusion capture.
  • Automatic recapture after the capture origin moves beyond a configurable threshold.
  • Runtime API for forcing an immediate recapture.
  • Supports dynamically created buildings and environmental objects.
  • Capture updates occur only when required.

Unified Multi-Type Billboard Rendering

  • Supports up to 100 visual foliage types per GPUFoliageSystem.
  • Shared billboard quad geometry.
  • Shared material and rendering pipeline.
  • Texture2DArray-based foliage textures.
  • Per-instance foliage type indexing.
  • Visual variation does not require separate meshes or rendering pipelines for each foliage type.

Quality and Memory Control

  • Runtime foliage density scaling.
  • Suitable for Quality Level-based density adjustment.
  • Configurable total instance capacity.
  • Configurable visible instance capacity.
  • Configurable RenderTexture memory usage.
  • Independent capacity and memory settings per GPUFoliageSystem.

Large-World Support

  • Multiple GPUFoliageSystem components can run simultaneously.
  • Independent World Rect, Filter Maps, capture data, instance capacity, and memory settings per system.
  • GPUFoliageSystem components can be stored as regional prefabs.
  • Compatible with view-based or distance-based loading and unloading.
  • Designed to integrate with project-specific world-streaming systems.

GPUFoliageSystem is a performance-focused, GPU-driven foliage solution designed for projects that require both extremely large vegetation populations and substantial visual variety.


A single system supports up to 100 visual foliage types through shared billboard quad geometry, a shared material, Texture2DArray-based textures, and one unified GPU rendering pipeline. This enables highly varied vegetation without requiring a separate rendering setup for every foliage type.


Instead of placing huge numbers of GameObjects or storing one transform matrix for every foliage instance, GPUFoliageSystem generates candidate foliage instances procedurally on the GPU. Density, randomization, scale variation, and clustering are controlled through procedural parameters, greatly reducing CPU-side processing and serialized instance data.


In testing, GPUFoliageSystem initializes 1,000,000 foliage instances in 29 ms on a Galaxy S8.


Artist control is handled through Multi Filter Maps. These maps define where foliage is allowed to appear or must be excluded, but they do not store individual transforms or foliage density.


This keeps artist-painted coverage independent from procedural density, allowing foliage density to be adjusted at runtime for different Quality Levels without repainting foliage coverage.


A Compute Shader-powered brush allows foliage coverage to be painted directly onto arbitrary mesh surfaces, making the system suitable for environments that are not based on Unity Terrain.


The Dynamic Mask Capture system captures surface height and runtime building or obstacle occlusion data only when required. Capture data can refresh automatically as the active region moves, while a runtime API allows developers to force an immediate update after dynamically creating buildings or modifying the environment.


GPUFoliageSystem also supports real-time interaction between characters and foliage, allowing vegetation to bend or be pushed around moving objects.


Multiple GPUFoliageSystem components can operate simultaneously. Each system owns its own Multi Filter Maps, capture data, instance capacity, memory settings, and World Rect.


This makes it possible to store foliage systems as regional prefabs and load or unload them through a project's world-streaming logic.


For improved compatibility across different mobile GPUs and graphics APIs, GPUFoliageSystem stores GPU culling results in RenderTextures instead of requiring SSBO access from the Vertex Shader. This avoids relying on vertex-stage SSBO behavior that may be unsupported or unreliable on some mobile GPU and API combinations, while preserving a fully GPU-driven rendering workflow.


Key Features

  • GPU-driven foliage generation, culling, and rendering.
  • Supports up to 100 visual foliage types per system through one unified billboard rendering pipeline.
  • Shares billboard quad geometry, material, and Texture2DArray-based textures across foliage types.
  • Procedurally generates foliage instances on the GPU without storing one transform matrix per instance.
  • Initializes 1,000,000 foliage instances in 29 ms on a Galaxy S8.
  • Compute Shader-powered foliage painting directly onto arbitrary mesh surfaces.
  • Uses Multi Filter Maps to define where foliage is allowed to appear or must be excluded.
  • Keeps artist-painted coverage independent from procedurally controlled foliage density.
  • Allows foliage density to be adjusted at runtime for different Quality Levels without repainting coverage.
  • Supports randomized placement, scale variation, and clustered distribution.
  • Automatically adapts foliage to captured surface height data.
  • Dynamically removes or masks foliage beneath runtime buildings and obstacles.
  • Automatically refreshes captured height and obstruction data only when required.
  • Provides a runtime API for forcing capture updates after environmental changes.
  • Supports real-time character-to-foliage interaction and pushing effects.
  • Includes low-cost fake grass shadows.
  • Provides adjustable wind direction, strength, frequency, and movement parameters.
  • Produces wind-driven normal variation for more dynamic foliage lighting.
  • Supports gradual blending between foliage and background colors based on ground height and viewing distance.
  • Provides configurable maximum visible instance counts for controlling RenderTexture memory usage.
  • Supports multiple independent GPUFoliageSystem components in the same world.
  • Compatible with region-based loading, unloading, and large-world streaming workflows.
  • Uses RenderTexture-based GPU culling data instead of requiring Vertex Shader SSBO access, improving compatibility across mobile GPU and graphics API combinations.
  • Designed to minimize CPU-side foliage processing through a fully GPU-driven workflow.