Open Phyronnaz opened 4 years ago
A way for memory used on height map data to be released when a voxel world is destroyed would also be nice :) (super-duper helpful for large-heightmap worlds)
Also noticed that heightmap assets store the data twice (once in Data and once again in CompressedData) so they are really taking up twice the amount of runtime memory than they should.
It is not uncommon for voxel graphs to link to many different heightmaps, but usually not all of the heightmaps are being used at the same time at their full resolution. For example, the player's view angle and distance can affect what part of terrain they see, or how many voxels are generated for that terrain. This is a common occurrence in large open world games.
Scenario 1: A player is flying in the sky high above the ground. At a certain distance, the voxel system lowers its voxel resolution to reduce mesh density, but the heightmap data stays static. Thus, the heightmap data is at a higher resolution than the voxel resolution, leading to a waste of memory resources. Mip maps would provide an easy solution for this, allowing the size of the heightmap texture data to not be excessively larger than the resolution of the voxel world.
Scenario 2: In an open world game, it would not be unreasonable for a voxel graph to have multiple heightmaps. For this example let's say we have two, one for a mountain and one for a valley. The player's position could be such that the mountain completely obstructs the view of the valley. Thus, the one entire heightmap is taking up memory but not being used. Here, it would make sense to stream out the heightmap.
Combining both mip maps and streaming, you should be able to significantly reduce the memory footprint of the voxel world.