Decreasing GPU memory usage
There are some occurrences in which the amount of memory in the GPU is insufficient to hold all the data that is requested of it. This situation may result in a crash of the system.
The biggest consumer of GPU memory is the terrain engine. More specifically, the loading of textures in the terrain engine. To combat this issue a mechanism for controlling the amount of memory used by the terrain engine was introduced to the graphic engine.
Contents
Memory limit mechanism
The terrain uses DDS files. DDS files are texture (image) files specifically tailored for 3d graphic usage. One of the feature of a DDS file format is use of mipmaps. Mipmaps are downgraded images of an original image. For instance, a DDS containing an image with the resolution of 512x512 will usually also contain the same image as mipmaps in the resolutions 256x256, 128x128, 64x64, and so on. The memory limit mechanism works by only loading mipmaps of lower levels, thereby reducing the memory consumption.
Memory limit settings
The graphic engine settings can be used to limit the amount of memory used by the graphic engine. The graphic engine settings controlling the mechanism are:
Terrain \ Texture memory \ Distance LOD Coef
The terrain texture limit mechanism continually checks which textures need to have their details improved and which to degenerate. It does so based on the distance of the drawn texture from the camera, their size and resolution. The "Distance LOD Coefficient" is used to control this mechanism. In general the larger this number is, the more distantly drawn textures would drop in detail in favor of closer drawn textures.
Terrain \ Texture memory \ Priority range
This field, when the texture memory limit mechanism is active, specifies an area around the camera were texture detail will only be prioritized according only to distance from camera. Enlarging the value in this field will cause the texture memory limit mechanism to concentrate the best detailed textures around the camera.
Terrain \ Texture memory \ Memory limit
The value of the "memory limit" field states the amount of memory that is allocated for textures per device. Under DirectX each of the monitors needs to be created with its own separate device. This means that even if 2 monitors are connected to the same graphics card, each of the monitors will need to be assigned a separate device with separate textures. In this case a graphics card will be uploaded with the same texture twice. In addition, the terrain textures are not the only resource that takes up memory space in the graphics card. At this point the system cannot estimate the total amount of memory. You can calculate a rough estimate of the memory limit.
Memory Limit = ([amount of memory on graphic card] - [estimated required memory non-graphic engine mechanism]) / [monitors per graphic card].
For example, given a graphics card with 1000mb of memory with 2 monitors attached, the memory limit value should be around 400.
Debug \ Terrain cover \ Show mipmap skip
This option can be used for debug. Turning this option on will color areas in the terrain according to the detail level they display.
- green for no mipmap skip (best detail level)
- blue for 1 mipmap skip
- yellow for 2 mipmap skip (worst detail level)