UDN
Search public documentation:

UsingTerrain
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Terrain System > Using Terrain

Using Terrain


Overview


Terrain was changed to a system where detail is now removed from the mesh as distance from the mesh increases. This allows for the designer to have control of the detail when the vertices are present.

Terrain Properties


Terrain_Properties.jpg

Terrain

NumPatchesX and NumPatchesY

The number of patches contained in a single row of the terrain is determined by NumPatchesX. The number of patches in a single column is NumPatchesY.

Note that if you make these dimensions smaller, it will destroy the height-map/alpha-map and other data which is no longer used by the patches. If you make the dimensions larger, it simply fills in the new height-map/alpha-map and other data with zero.

The total size of the terrain can be determined with the following formulas:

SizeX = NumPatchesX * DrawScale * DrawScale3D.X

SizeY = NumPatchesY * DrawScale * DrawScale3D.Y

MaxTesselationLevel

This is the maximum number of patches (row and column) that will be collapsed into a single quad when tessellating out detail. Must be a power of two, 1 <= MaxTesselationLevel <= 16.

Note that this means the values used for NumPatchesX and NumPatchesY must be multiples of MaxTesselationLevel.

As an example, the following shot shows a terrain with NumPatchesX of 4, NumPatchesY of 4 and a MaxTesselationLevel of 4 at each of the possible 3 tessellation levels. The leftmost is at full detail, with a 4x4 grid of patches present. The middle is at half, displaying a 2x2 grid of collapsed patches. The rightmost is at the lowest level, showing a single quad that covers the original area.

Terrain_Tessellation.jpg

MinTessellationLevel

This is the minimum number of ‘sub-quads’ (row and column) to collapse to when tessellating out detail. Note that if the value is equal to MaxTesselationLevel, the terrain will not tessellate out any detail.

MaxComponentSize

For the engine, the terrain is split up into rectangular groups of patches called terrain components for rendering. MaxComponentSize is the maximum number of fully detessellated quads in a single row/column of a terrain component. (The maximum number of physical patches at full tessellation detail in a single row/column of a terrain component is simply this number times the MaxTesselationLevel.)

Generally, all components will be MaxComponentSize quads square, but on terrains with a patch resolution which isn't a multiple of MaxComponentSize quads, there will be some components along the edges which are smaller.

This is limited by the MaxTesselationLevel to prevent the vertex buffer for a fully tessellated component from being > 65536 vertices.

For a MaxTesselationLevel of 16, MaxComponentSize is limited to <= 14.
For a MaxTesselationLevel of 8, MaxComponentSize is limited to <= 30.

Each terrain component is a distinct DrawMesh call. Depending on the complexity of the material applied, which is a result of the layers applied to the patch of terrain as well as the tessellation level rendered, components will have varying performance costs.

If a particular layer is applied to a single terrain component, other components do not pay for it. Note that it may be somewhat difficult to see when a layer is actually 'spilling' into a neighboring component. The highlight-overlay exposed via the terrain browser or property window can be helpful in spotting these cases.

Viewing MaxComponentSize: To see the component sizes on the terrain, check the flag on the viewport Show Flags menu - "Terrain Patches". When enabled, terrain will render yellow boxes around each component in the terrain.

MaxComponentSize indicates the number of quads that will be contained in a single UTerrainComponent instance for the terrain - the higher the number, the fewer 'sub-pieces' of terrain.

The number of components is determined by the following:

NumSectionsX = ((NumPatchesX / MaxTesselationLevel) + MaxComponentSize - 1) / MaxComponentSize

NumSectionsY = ((NumPatchesY / MaxTesselationLevel) + MaxComponentSize - 1) / MaxComponentSize

EditorTessellationLevel

This is a visualization helper that is used in the editor only. It allows the designer to select the tessellation level to view the terrain at in all viewports of the editor. When a 1 is entered, the terrain would be displayed at it lowest detail level. The value must be power of two, and 1 <= EditorTessellationLevel <= MaxTesselationLevel. When set to 0, the terrain will tessellate according to the standard algorithm that is used during game-time.

(NOTE: Currently, in PIE, this value will still impact the terrain being displayed.)

NormalMapLayer

This is a hack index for selecting a single layers normal map as the normal map to be applied to the whole terrain.

TesselationDistanceScale

This is used to scale the distance value used for determining the desired tessellation level to render a quad at. The higher the value, the closer tessellating out details will occur.

bMorphingEnabled

This is used to indicate that the terrain should morph vertices between tessellation levels. While visually this removes the potential ‘popping’ that can occur on transitions, users should that that it is more expensive both in terms of vertex bandwidth and shader instruction count.

bMorphingGradientsEnabled

This is used to indicate that not only should the height values be morphed, but the gradients should as well. (It means nothing if bMorphingEnabled is FALSE.) The effects of this option were not greatly noticeable on the test maps used, so it was made a secondary option. This mode is more expensive than standard morphing due to addition vertex size and shader instruction counts.

Lighting

StaticLightingResolution and bIsOverridingLightResolution

This is the number of texels/patch size to use for the static shadow-maps. A separate shadow-map is used for each terrain component, which is up to (MaxComponentSize * StaticLightingResolution + 1) pixels on a side.

If bIsOverridingLightResolution is not checked, it must be a power of two, 1 <= StaticLightingResolution <= MaxTesselationLevel.

If it is checked, it must be a power of two, 1 <= StaticLightingResolution <= ###.

bEnableSpecular

When checked, specular lighting will be enabled for the terrain actor. When unchecked (the default), specular lighting will be disabled for both dynamic and static lighting.

Collision

CollisionTesselationLevel

This is the tessellation level to use when performing collision calculations. The value must be power of two, 1 <= CollisionTesselationLevel <= MaxTesselationLevel. So, a value of 1 would utilize the lowest tessellation level (the least detail). A value of MaxTesselationLevel would use the fully detailed mesh as the collision data.