How "LOD" works in Panzer Command... (Full Version)

All Forums >> [Current Games From Matrix.] >> [Discontinued Games] >> Panzer Command: Kharkov >> Maps, Models and Mods



Message


Erik Rutins -> How "LOD" works in Panzer Command... (5/18/2008 5:34:03 PM)

There's been some recent discussion LODs (Levels of Detail) and how they work in Panzer Command. To the best of my knowledge, here's the beef on that:

There are a total of three levels of detail, starting with the full poly model and its texture and normal map, which is the first level of detail. The specs on that are usually about 1500 Polys and a 512x512 Texture and Normal Map. All of that shows up when you look at a model from very close range (usually around 50-75m). If you plan on making a LOD model, then the polys on your base model can be higher. If you don't have a LOD model, then you should stay within the 1500 poly limit.

The second level of detail uses the "LOD" model if it exists (this is just the original model files with "_LOD" added to the end of the file name (so you'd have body.x and body_LOD.x, for example). This should be a lower poly version of the original. When a vehicle is not being viewed from very close range, the Normal Map is ignored (as drawing normal maps is "expensive" performance-wise) and the "LOD" model is used. Most of the time in-game, if you are not playing from a very zoomed in view, you'd be seeing the "LOD" model (if it exists). If there is no "LOD" model, the game keeps using the original full model.

The third level of detail is defined by how you set the "Level of Detail Quality" setting when you started the game. That setting determines when the "LOD" model is swapped out.

VeryHigh = 1000m
High = 200m
Medium = 150m
Low = 100m

For vehicles and infantry, beyond this distance it will draw a bounding box to simulate the unit and use the texture of the unit to cover the bounding box so that it will still appear similar to the eye.

Note that terrain works similarly, except that for smaller terrain objects, when the LOD distance is exceeded they will be "clipped", in other words not displayed on the map mesh.

Now regarding textures, there's no need to make a LOD texture. When a texture is loaded by the game, DirectX creates 4 mip-map levels. Each level is half of the area of the previous level. The LOD is swapped according to a fairly complicated algorithm depending on the angle the triangle is to the camera.

The mip-maps are all in video memory. So an uncompressed 1024x1024x32 texture uses 4096 K-bytes of memory without mip-maps. With mip-maps it is 4096 + 2048 + 1024 + 512 = 7680. That's over 7 megs of memory for one texture. However, we were using compressed .DDS files, so hopefully it's a lot less than that in reality.

DirectX normally likes 256x256 textures best. We went up to 512x512 for the additional detail to allow players to see some detail when they viewed tanks up close. The 1024x1024 textures are a bit of a luxury that are really intended for players with a card that has a large amount of video memory (i.e. >=128MB). Anytime video memory is exceeded, it has to swap from system memory and that hits performance pretty hard so it's best to try to avoid that.

Regards,

- Erik




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.367188E-02