Wednesday, September 30, 2015

LODs and texture budget.

When rendering assets in real time for a game engine, there are a number of factors that have to be taken into consideration.

- Polygon budget
- Texture budget
- Texture size and usage

Since texture and polygon counts are finite in comparison to real time rendering, it is necessary for there to be budgets to work with. Say for instance you are working on a game and the texture memory budget is between 512-1024mb. This kind of budget can be filled quickly by textures and as a result texture swapping and level of detail (LOD for short) can be implemented to tackle the issue.

Essentially what LOD does is reduce the detail of objects and textures at a distance. Objects that are closer will have full detail, whereas objects at a distance will have reduced polygon counts and texture sizes. A model may have 3-5k polygons up close, but at a longer distance (50-100 meters) this may be reduced down to 500 polygons as there is no need for such detail. Even the texture, say 2048x2048 might be reduced down to 256x256 as there is no need to see full detailed textures at this distance. In a good engine, the game will hide the distance in which models are swapped from the high and lows. Sometimes there can be multiple distances and multiple levels of detail. In some cases 3d models may be swapped for basic image planes or 2d sprites at a long distance (Often used for trees) to allow more objects on screen with a lower memory footprint.

A good example of an engine that handles LODs well is CryEngine. The model at the front has the highest poly count and the model further back has a reduced texture quality and poly count with very little loss of detail.