Chapter 14: Unity Terrain
This is Part 5 of the Unity HDRP production guide, continuing from Part 4: Advanced Rendering. This installment covers environments: Unity's terrain system, the GAEA procedural workflow, vegetation, and atmosphere/sky systems.
14.1 Unity's Terrain System
Unity has a native terrain system optimized for large outdoor surfaces, automatically handling LOD, tessellation and memory optimization. Create one via GameObject → 3D Object → Terrain. A new terrain includes a Terrain component (rendering and painting), a Terrain Collider (physics), and a Terrain Data asset (stored data).
| Parameter | Description | Typical value |
|---|---|---|
| Terrain Width/Length | Horizontal dimensions | 1000m × 1000m |
| Terrain Height | Maximum height | 600m |
| Heightmap Resolution | Heightmap resolution | 1025, 2049, 4097 |
| Detail Resolution | Resolution for grass/details | 1024 |
14.2 Terrain Toolbox
The Terrain Toolbox is an add-on package that makes managing large-scale terrain easier. Install via Window → Package Manager → Terrain Tools.
| Feature | Description |
|---|---|
| Create | Creating terrain grids |
| Utilities | Heightmap import/export, splitting, merging |
| Visualization | Debug display (heightmap, splatmap) |
| Settings | Global settings |
To import a heightmap: Terrain Toolbox → Utilities → Heightmap, select the file (RAW or 16-bit PNG), configure dimensions and height, then Import. Supported formats: RAW 16-bit (recommended for precision), PNG 16-bit grayscale, EXR 32-bit.
14.3 Terrain Painting With Terrain Layers
A Terrain Layer (Assets → Create → Terrain Layer) defines a material that can be applied to the terrain: Diffuse (Albedo texture), Normal Map, Mask Map (RGBA: Metallic, AO, Detail, Smoothness), and Tiling.
The terrain needs the HDRP/Terrain/TerrainLit shader: select the terrain, go to Inspector → Terrain Settings → Material, assign a material using TerrainLit, and enable GPU Instancing in the advanced settings.
Painting tools: Paint Texture (manually paint layers), Set Height (set an absolute height), Smooth Height (smooth variations), Stamp Terrain (apply predefined shapes).
14.4 Automatic Filters
To speed up texturing, filters apply layers automatically by criteria. Altitude Filter distributes textures by elevation (grass in valleys, rock on slopes, snow on peaks). Slope Filter distributes materials by incline (dirt on gentle slopes, rock on cliffs, grass on flat surfaces). Scatter mode (in the brush settings) gives a randomized spread that avoids repetitive patterns - combine it with varying opacity and spacing values.
Chapter 15: The GAEA Workflow
15.1 Introduction to GAEA
GAEA (QuadSpinner) is procedural terrain-generation software used across the game and film industry, built on a node system for non-destructive creation. Procedural modeling offers real advantages: you can go back and change anything at any time, edits are non-destructive, you can generate infinite variations, and the workflow is visual and clear. The basic recipe is usually Noise → Filter → Masks. Node-based interfaces show up in every professional tool (Houdini, Substance, Nuke) - each node is one operation, and connections define the data flow.
15.2 Building a Terrain
Base (primitive) nodes: Perlin (classic Perlin noise), Voronoi (cellular patterns), Mountain (mountain shapes), Dunes (dune formations), SlopeNoise (slope-driven noise).
Modifier (filter) nodes: Erosion (hydraulic erosion simulation), Thermal (thermal erosion), Terrace (terracing), Smooth, Sharpen (detail enhancement).
Combination nodes: Combine (merges two terrains), Blend (controlled mixing), Mask (mask-driven combination).
Worked example - a cliff-type terrain: SlopeNoise for a sloped base, Cells to add rock formations, Mask to control where they appear, Erosion for a natural finish, Combine to assemble the cliff and its detail.
15.3 Exporting to Unity
Before exporting, flag the output nodes with F3 (marked with a yellow dot).
| Type | Format | Use |
|---|---|---|
| Heightmap | RAW 16-bit | Terrain geometry |
| Normal Map | EXR | Surface detail |
| Masks | PNG/EXR | Splat mapping |
Export settings: Resolution 1025/2049/4097, Heightmap format RAW 16-bit, Texture format EXR or 16-bit PNG, Range Full (0-1). To import into Unity: Terrain Toolbox → Utilities → Import Heightmap, select the RAW file, match GAEA's dimensions, and import the masks as textures for splat mapping.
15.4 Advanced Splat Mapping
Masks exported from GAEA enable automatic texturing: import them as textures, build a custom shader or use the painting tools, and assign Terrain Layers per mask channel - a common convention is R = rock, G = grass, B = dirt, A = snow.
Chapter 16: Vegetation
16.1 Vegetation Sources
SpeedTree is the professional solution for real-time and cinematic vegetation, exportable as native .ST (automatic integration, LOD and wind - direct in Unity) or universal .FBX (needs manual configuration).
| Source | Type |
|---|---|
| Quixel Megascans | Photoreal scans |
| Xfrog | Biome-based libraries |
| Poly Haven | Free, royalty-free |
| Botaniq (Blender) | Blender plugin |
| PlantFactory | Free (e-on) |
16.2 Importing SpeedTree Assets
For the native .ST format: drop the file into the project, and Unity automatically generates HDRP/Nature/SpeedTree materials, a configured LOD Group, and wind animations - it's then usable directly in the terrain painting tool.
For .FBX: import it, Extract Materials in the import settings, then configure the materials (enable Alpha Cutout for leaves, enable Double Sided/Two Sided), Unpack Completely the prefab if needed, and manually add a LOD Group.
16.3 Vegetation Material Configuration
For foliage on the Lit shader: Surface Type Opaque with Alpha Clipping enabled (Threshold ~0.5), Double Sided (Global Settings or Two Sided), and Material Type set to Subsurface Scattering or Translucent.
A diffusion profile tuned for leaves: Scattering Distance around 0.5mm (low), high Transmission (light passing through), green tint. To simulate light passing through backlit leaves, use Unity's built-in Foliage translucence profile.
16.4 Optimization: LOD
Level of Detail reduces geometric complexity by distance: LOD0 (full resolution, close), LOD1/LOD2... (decreasing resolution), Billboard (a 2D sprite, very far), Culled (invisible beyond a set distance). Configure a LOD Group component by assigning meshes to each level and setting transition thresholds (as a percentage of screen size). The last LOD level is often a billboard - a simple camera-facing 2D image, letting thousands of distant trees render cheaply.
16.5 Painting Vegetation on Terrain
Paint Trees: select the terrain, open Paint Trees in the Inspector, Edit Trees → Add Tree, assign the tree prefab, then paint. Parameters: Brush Size, Tree Density, Tree Height (variation), Random Rotation.
Paint Details (grass and small elements): Paint Details → Edit Details → Add Detail Mesh, assign the grass mesh, configure density and settings.
16.6 HDRP Projector Decal for Detail
The HDRP Projector Decal tool adds environmental detail with minimal performance cost: leaf litter on the ground, ivy on walls, moss on rocks, rain streaks. Create via GameObject → Rendering → Decal Projector.
Chapter 17: Atmosphere and Skies
17.1 Volumetric Fog
Volumetric Fog simulates light scattering through the atmosphere at regular intervals through empty space, independent of surface geometry - real physically based atmospheric rendering, not the old exponential fog. It needs enabling in two separate places before anything shows up: HDRP Asset → Lighting → Volumetrics (this is what allocates the 3D voxel grid HDRP uses for the calculation, typically 240×135×64 voxels at 1080p), and HDRP Global Settings → Frame Settings (Default Values) → Camera, where both Fog and Volumetrics need checking. Forgetting the second toggle is the most common cause of "fog does nothing" - the Fog checkbox alone only enables simple exponential fog, not the volumetric system.
Add the effect through a global Sky and Fog Volume (GameObject → Volume → Sky and Fog Volume), with Is Global checked so it affects every camera without HDRP needing to compute volume bounds or blending - the cheapest option for constant outdoor atmosphere.
| Parameter | Description |
|---|---|
| Enabled | Turns fog on/off |
| Color | Base fog color |
| Fog Attenuation Distance | How fast density increases with camera distance - lower means thicker fog sooner |
| Max Fog Distance | Maximum effect distance |
| Base Height | Reference height for constant density below it |
| Maximum Height | Height above which density falls off exponentially |
| Mean Free Path | Density (lower = denser) |
| Global Light Probe Dimmer | Attenuates ambient lighting |
HDRP's global fog is a height fog: constant density below Base Height, exponential falloff above it - the same gravity-driven gradient that makes real atmosphere denser near the ground. It's a pattern worth remembering beyond fog itself; underwater particulates, heat haze and similar effects use the same vertical-density logic.
For god rays, enable Volumetric on the light itself (Volumetric Dimmer 1.0, Shadow Dimmer around 0.75 to soften shadows inside the fog) and angle it - a sun at roughly 35-50° elevation hitting the fog from the side produces visible shafts; directly overhead scatters far less from the camera's perspective. The fog's own Anisotropy parameter shapes that scattering: small positive values (0 to 0.125) favor forward scattering and make shafts read more clearly toward the viewer, negative values scatter light away and darken the fog; realistic atmosphere rarely needs values outside ±0.25. Spot lights work the same way for interior beams (torchlight, a window shaft) - keep volumetrics on 2-4 "hero" lights and off on fill lights, since every volumetric light costs real GPU time and the fog still receives their non-volumetric contribution anyway.
For a contained pocket of fog rather than a uniform atmosphere - a doorway, a valley floor, a corner where mist pools - use a Local Volumetric Fog (GameObject → Rendering → Local Volumetric Fog), sized as a box and set noticeably denser (lower Fog Distance) than the global fog so it reads as a distinct layer, with Blend Distance softening the box's edges. A Density Mask Texture (3D noise samples ship with the HDRP package under Samples) breaks up that uniform density into swirling, organic-looking fog instead of a flat volume - Exponential falloff suits organic effects like mist or dust, Linear suits mechanical sources like a vent or chimney.
17.2 Dynamic Skies
HDRI Sky uses a panoramic HDR image for lighting and background: Volume → Add Override → HDRI Sky, assign an HDRI texture (Cubemap or Lat-Long), then adjust Rotation, Exposure and Multiplier. Good HDRI sources: Poly Haven, HDRI Haven, ambientCG.
Physically Based Sky simulates Earth's atmosphere physically - Type (Earth Simple, Earth Advanced), Ground Color, Air Maximum Altitude - and reacts automatically to the Directional Light's (sun's) position.
Gradient Sky is a simple three-color gradient (Top, Middle, Bottom).
17.3 Cloud Systems
HDRP offers two genuinely different cloud systems, and picking the right one matters more than tuning either one well. Cloud Layer renders a 2D lat-long texture on the skybox - simple alpha blending, no volumetric cost (well under 0.5ms GPU), animatable via a flowmap, with shadows projected through a light cookie. It has no real depth (the camera can't fly into it), doesn't interact with volumetric fog, and shadows don't self-shadow. It's the right call for ground-based games (FPS, TPS, RTS), mobile or VR with a tight GPU budget, and distant background cloud layers - often combined with Volumetric Clouds for the ones close to camera.
Volumetric Clouds (Volume → Add Override → Volumetric Clouds) are a true 3D volume, ray-marched with multi-scale procedural noise and temporal accumulation across frames for real lighting - internal scattering, self-shadowing on terrain, and full interaction with volumetric fog and lights. That realism costs 5-15ms at 1080p depending on quality, needs real tuning per cloud type, and can show temporal artifacts (ghosting, flicker). It's worth that cost for flight-capable games, high-quality cinematics, and anything where clouds need to react to dynamic lighting - PC/console only in practice.
The two key shape parameters are Bottom Altitude (where the cloud layer starts - keep it consistent with your scene's own scale, or clouds end up invisible far overhead) and Altitude Range (layer thickness - thin for stratus, tall for storm towers), alongside Density Multiplier, Shape Factor and Erosion Factor for how solid or wispy the clouds read. A realistic default sits around Density 0.3-0.5, Shape 0.8-0.95, Erosion 0.4-0.7.
| Look | Bottom Altitude | Altitude Range | Density |
|---|---|---|---|
| Light cumulus (clear sky) | 1500m | 1500m | 0.3 |
| Dense stratus (overcast) | 800m | 600m | 0.7 |
| Storm cumulonimbus | 600m | 5000m | 0.9 |
Wind drives animation through the Visual Environment override's global wind settings, and for scenes that combine both systems, keep Cloud Layer for the distant sky and reserve Volumetric Clouds' GPU budget for what's actually near the camera.
17.4 Visual Environment
The Visual Environment Volume override defines which sky and fog system is active: Sky Type (HDRI, Physically Based, Gradient, etc.), Sky Ambient Mode (Static, Dynamic), Wind Orientation (direction for clouds and fog).
Part 5 Summary
| Chapter | Skills covered |
|---|---|
| Ch. 14 - Terrain | Unity's terrain system, Terrain Toolbox, Terrain Layers |
| Ch. 15 - GAEA | Procedural generation, export, heightmap import |
| Ch. 16 - Vegetation | SpeedTree, foliage materials, LOD, painting |
| Ch. 17 - Atmosphere | Volumetric fog, skies, HDRI, clouds |
Key takeaways: the TerrainLit shader with GPU Instancing is mandatory for HDRP terrain; GAEA gives powerful procedural creation with a clean Unity export path; vegetation needs Alpha Cutout, Double Sided and usually SSS/Translucent; LOD is essential for performance with heavy vegetation; volumetric fog adds depth and atmosphere; and HDRIs are the fastest route to realistic environment lighting.
Part 6, next, covers production and export: the animation system, Timeline and Cinemachine, and final export.