Level-of-detail models are a kind of “meta” models: They consist of two or more “normal” models, but only one of the referenced models is shown at any time, depending on the distance to the viewer.
The key idea is to render a detailed model only when the player (the camera) is close to it. When the camera gets farther away, a less detailed model is rendered. And when the camera gets even farther away, an even less detailed model is used.
This technique, while not without its downsides, is a common approach for reducing the computational effort required for rendering a model relative to the amount of detail that the player can perceive of distant objects.
Level-of-detail models have a file suffix of .dlod
, and you open them in the Model Editor like .cmdl
models or any other model files.
The Level-of-Detail Models dialog will show the list of “real” models that the LoD model is referring to, and up to which viewer distance each model is used.
In the list and inspector panes, the Model Editor will only show the elements of the first (closest, most detailed) referenced model, even if the camera is moved far enough away so that in the 3D view one of the lower detailed models is rendered.
If you attempt to save a .dlod
model, the saved file will be the first referenced model as well. That is, it will be treated like an individual, independent model, not as the whole set of models in the .dlod
file.
As a result, you should load LoD models only for inspecting them in the 3D view.
In order to edit the component models the .dlod
file is referring to, you should load them directly by their true name, each one separately from the other.
.dlod
files cannot be created in the Model Editor. They are simple text files that you have to create yourself, using a programmers text editor.
Here is an example, taken from Games/DeathMatch/Models/Static/TonneTest.dlod
:
TonneTest_LoD1.ase 10000 TonneTest_LoD2.ase 20000 TonneTest_LoD3.ase 40000 TonneTest_LoD4.ase 80000 TonneTest_LoD5.ase
Each line lists a concrete model and the distance up to which the model is rendered.
.dlod
) file. Valid examples include a/x.cmdl
and ..\y.ase
, whereas c:\z.mdl
is invalid.The image below shows three models, a simple barrel. The three models are independent of each other, and each is stored in a separate model file. They all implement the same logical object though, each at a different level-of-detail:
Combine models like these in .dlod
files as shown above – that's all!
Your LoD model is now immediately available for use in the Map Editor and the Cafu Engine.