Unreal Geomorph Level-Of-Detail Notes
Erik de Neve - Epic Games, Inc.
Last updated May 19 1999
LOD tech introduction
The Unreal engine has always been able to
handle large open spaces quite well, but with large sized scenes, and with
multi-player deathmatch and team games as well, there is an increased risk of
many actors being visible at the same time.
By using distance-dependent
simplification, the speed penalty for rendering actor meshes diminishes greatly
as their smaller size farther away allows them to be drawn using fewer
polygons.
Unreal's new continuous-LOD (Level-Of-Detail) rendering offers
a way to make the rendering of all polygonal actors in the engine scaleable,
fully compatible with all existing static and animating mesh
content.
Polygons gradually disappear in a sequence which is fixed at
content-compilation time (building the .U files) for each mesh. Such a
continuous sequence of shapes, known as a 'geomorph', is constructed by
automatic evaluation of the shape of a mesh, notably edge sizes and surface
curvature.
Unreal's unique smooth LOD morphing ability makes the culling
of polygons less conspicuous, notably close up, and is achieved by preemptive
shrinkage of mesh faces in an overlapping a-synchronous fashion, while the
texture mapping is smoothly adapted also.
Version 224 LOD note for licensees and mod
authors
The mesh LOD as active in Unreal 224 does
not give the optimal achievable speedup, as it uses very conservative default
LOD strength settings. This was necessary to achieve backward compatibility with
the entire Unreal 1 content without the team having to go back and check/tweak
the settings for individual meshes.
There is one arbitrary hard-coded global
LOD factor which licensees can change in UnMeshRnLod.h:
FLOAT MeshVertLOD =
430.f ..........
Useful settings fall between 150 and 450; smaller numbers
result in more aggressive LOD culling.The MLOD console command can be helpful
for testing adjustment of this global strength interactively.
The optimal
tradeoff between speed and detail for individual meshes can be tweaked to
satisfaction further by using the mesh LOD script parameters explained
below.
Console
commands
Mainly for in-game testing purposes; to
see the LOD-culling and morphing in action,set MLMODE 3, then zoom in with the
sniper rifle (or directly using the FOV command) to see how the distant meshes
are simplified, then fly closer in slomo+ghost mode to see it morph into full
detail again.
On the UT bots, you can see the backpack appear, an antenna
suddenly extends upwards, the microphone snakes its way back around the head,
etc.
Click here for some sample screenshots.
MLOD X
A
strength scaling factor centered on 1.0, to scale the strength of the LOD
culling -
higher values strengthen the LOD fall-off with
distance.
MLMODE
X
0 Draw everything at full (or at MLFIX-ed)
detail.
1 Normal level-of-detail
mode
2 Disable smooth
morphing.
3 Ignore the field-of-view effect on LOD
(great for debugging!)
4 Disable smooth morphing,
ignore field-of-view.
MLFIX
X
A float in the range 0.0-1.0 which, when in
MLMODE 0, causes
all meshes to be drawn using this proportion of their
vertices.
Mesh
LOD script parameters
Here's a specific script variable example.
None of these extra parameters are required.
LOD importing can be on or off
by default (depending on how it is hardcoded in UnEdSrv.cpp)
#exec MESH
IMPORT MESH=LodMesh ANIVFILE=MODELS\AnyMesh_a.3D DATAFILE=MODELS\AnyMesh_d.3D
X=0 Y=0 Z=0 MLOD=1 LODSTYLE=0 LODFRAME=19
#exec MESH LODPARAMS MESH=LodMesh
STRENGTH=1.0 MINVERTS=14 MORPH=0.25 ZDISP=90.0
MESH IMPORT parameters:
MLOD | Boolean , meshLOD switch ( if 0, the mesh will
always be rendered at full detail ). Always use MLOD=0 if you want to disable any detail loss, rather than putting extreme STRENGTH or MINVERTS values in the LODPARAMS. |
LODSTYLE | A bit field with switches to change the style
of building the pre-collapse sequence. By default, none of these bits are set. Useful ones right now are 8 and 2 in particular. 1: Value curvature over length. 2: Protect the edges of doublesided polygons - like the CTF flags. 4: Try to respect texture seams more. Use this if there is too much 'stretching' going on. 8: Value length over curvature. Needed for unwelded, multi-element, or otherwise 'open' meshes like the new superhealth. 16: Translucent polygons will be collapsed less early in the LOD sequence. (Broken in the 224 code base.) |
LODFRAME | When there are multiple animation frames, you
can pick a representative one other than the default 0th frame to be sampled for generating the collapse sequence. |
LODNOTEX | If set, causes texture coordinates to be
ignored when importing. Results in modest memory and performance savings for complex environment-mapped meshes. |
LODOLD | Maintain the original order of animation
vertices as they are imported. If active, this means some internal
reorganization will be done at load time, instead of compile time.
Included to make differential patching of older content feasible. |
MESH LODPARAMS
parameters:
STRENGTH | Per-mesh linear LOD scaler. Default = 1.0. Tweak this higher for more aggressive LOD-culling, lower if you see the mesh distort too early . |
MINVERTS | The minimum number of vertices you want your mesh to always retain at the farthest distances. Useful for some really simple objects (boxes, trees, birds...) that need to look good even at a fair distance. |
MORPH | 0.0 for no morphing, any other value up to 1.0
indicates the proportion of vertices that are allowed to contribute to the
smooth morphing. More means less popping, but at the cost of more CPU time. Useful values are 0.25 - 0.4, the default is currently 0.3. |
ZDISP | In world units ( the standard player height is
60 ) this pushes away the distance at which the LOD culling kicks in. More
precisely, the fraction of vertices drawn scales with the distance Z as follows: 1 / ( STRENGTH * (Z - ZDISP) ), where (Z-ZDISP) is clamped at a minimum of 1.0. |