-
-
Notifications
You must be signed in to change notification settings - Fork 5
Memory Consumption
Raytiles render only what we see, but always holds in memory all the surrounding tiles to support extreme camera maneuvers.
The default configuration is tuned for relatively low memory usage, with at most ~600 tiles resident at any given time in 800x600 resolution screen. Any change in configuration may affect memory usage, so it's worth understanding how the numbers break down.
- Tile size:
$256 \times 256=65,536$ pixels - RGBA texture:
$65,536 \text{ pixels} \times 4 \text{ channels} = 262,144$ bytes (256 KB) per tile (uncompressed)
VRAM:
- Albedo texture + mipmap:
$256 \text{ KB} \times 1.33 = \textbf{341 KB}$ - Heightmap texture
$\textbf{256 KB}$ - Normal map texture
$\textbf{256 KB}$ - VRAM per tile (uncompressed with mipmap):
$341 + 256 + 256 = \textbf{853 KB}$
We also hold a copy of the heightmap in RAM for fast altitude queries, which adds 256 KB per tile. For 600 tiles, the total memory usage would be approximately:
- VRAM
$853 \text{ KB} \times 600 = 511,800 \text{ KB} \approx \textbf{500 MB}$ - RAM
$256 \text{ KB} \times 600 = 153,600 \text{ KB} = \textbf{150 MB}$
The simplest way to reduce memory consumption is to reduce the accuracy. For example, reduce the maximum zoom level from 15 to 14, and adjusting the thresholds will reduce the tiles count. Any reduction in accuracy reduce the required tiles to build the scene.
Another factor related to tiles count is limiting the horizon distance (how far we draw tiles).
Find more in the configuration section.
Raytiles