LOD

From The DarkMod Wiki
Revision as of 14:11, 20 June 2010 by Tels (talk | contribs) (start)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

LOD (Level of Detail)

A LOD system can be used to bring more details to the screen while still speeding up rendering. See Wikipedia for an introduction.

The LOD system in TDM was totally rewritten for v1.03. This pages describes its workings, how to use it in your maps and what results it can achive.

Comparisation

Here we compare the new (v1.03) to the old system (until v1.02):

  • The old system had only two levels: 0 (original model), and 1 (entity is hidden)
  • Due to a typo, all thinking for the LOD entities happened in the first half of the interval. That means if you set the intervall to 1 s, all entities did their distance check between 0 and 0.5 seconds, and none between 0.5 and 1 second and so on. This lead to fluctuating frame rates.

The new system:

  • Supports arbitrary many levels (currently maximum is 7, more would require a recompile)
  • You can use less levels if you want
  • Thinking is distributed over the entire interval
  • makes scenes with thousands of entities possible
  • Can not only switch the model, but also change the skin (f.i. use less expensive glass shaders) and turn shadows off

How to use LOD in your TDM map

Entities

Spawnargs

hide_distance

model_lod_X

model_skin_X

noshadows_lod_X

Increasing the LOD steps

The number of possible LOD steps is fixed in code and defined in game/misc.h as a constant. The current value is 7, meaning that there are 5 different rendering possibilities beside level 0 (the original) and level 6 (the object is hidden).

See also

  • Not done yet