Tiled Resource? Array of Texture3D? Efficient TSDF Volume with less memory footprint

Started by
3 comments, last by Adam Miles 7 years, 5 months ago
Hey Guys,
I have a project in DirectX12 which reconstruct 3D model from a depth sensor 360 scan. The intermediate model is store in a Texture3D as TSDF (truncated sign distance field, each voxel stores a truncated distance to nearest surface) volume, where this volume is updated and rendered(raycast) every frame. And it runs properly.
The problem:
The TSDF volume takes huge amount of memory (1024^3 * (8bit + bitsForOtherDatas)), and almost 90% of those voxels stores special value indicate this voxel is empty. So I want to not store most of those useless data.
The solution:
One solution I can think of is using spacial data structure with buffer to store TSDF:
The basic idea is to break space into blocks along with a buffer store useful TSD value. For example, for 1024^3 TSDF volume we have 32^3 blocks each contain 32^3 TSDF voxels, and each block store either the offset to the TSD buffer or special value indicate this block is empty. So when new data (voxel TSD value with voxel position) comes in, we first check the block this voxel belongs to, if the block indicate this is empty one, we update this block with offset to the first voxel in this block in the TSD buffer, and then update the corresponding voxel in TSD buffer; if this block has valid offset, we just use this offset to update corresponding voxel in the TSD buffer.
This should work as expected. But it forbid me from using Texture3D for voxels which means I cannot use Sampler to do fast trilinear filter during later raycast process.
I have thought of using arrays of Texture3D instead of buffer to store TSDF data. Thus each block is storing array index instead of offset. But this means I probably will have to create more than 200 Texture3Ds and need to bound it to my pipeline. Also this means in my shader I will have to dynamic branch through Texture3Ds, and I have no idea what's the impact on performance.
Other thing I can think of may help is Tiled Resource, but I never use it before. Is tiled resource a silver bullet for my case?
Also are there any other approaches to my situation which are totally different?
Thanks
Advertisement

Tiled resources does look like a good candidate.

You could map all empty voxels to a single (dummy) tile containing your special 'empty' value.

Do note that the tiled resources API can be tricky to work with because of the page sizes (and the differences between the different tiers).

The tile size is the same across all the tiers (64KB). The shape of the tile is defined too.

I've some experience using huge 2DArray and 3D textures on my ray tracing Minecraft project and can confirm that the Tiled Resources API is useful in substantially reducing the memory footprint of these large textures. That said, you need to be able to find coherent regions of the texture that will all be able to map to the same tile. "Free space" (air, in the case of Minecraft) can be not backed by any physical memory on some GPUs and to a dummy 'zero' tile on others.

You weren't quite clear on what the bit depth of your texture is, but you're looking at regions of around 32x32x32 for a 16 bit texture.If you can find lots of 32x32x32 regions that are all the same, then by all means use Volume Tiled Resources. Be aware though that you will not find support for this on any AMD GPU that currently exists and only on NVIDIA Maxwell GM2xx and above. I think Intel's support started at Skylake.

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

Thanks Guys,

So it seems Tiled Resource would definite help to reduce memory requirement. But does it allow efficient update (I mean some of my previous frame empty tile will become non-empty and some non-empty tile may become empty...) ? I may need to familiarize myself with Tiled Resource, but just want to get some feeling before I dig in.

Thanks

Yup, you can update the contents of individual tiles as well as change the mappings between virtual and physical memory to change a subset of the whole texture's mappings on the fly.

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

This topic is closed to new replies.

Advertisement