ARB_sparse_texture extension allows creation of sparse textures, which only occupy GPU memory for ‘portions’ (or pages) of their declared sizes. This partial occupation reduces memory consumption for textures that don’t require full storage. One such application is representing a scene using voxels. Normally a large part of a 3D space enclosing a scene is empty space, so most of the texels are wasted if a normal 3D texture is employed to represent a scene. Sparse Voxel Octrees (SVOs) exploit the sparsity and store the voxels representing a scene in a compact form. And since a SVO is essentially an octree, a hierarchical data structure, sampling the scene information with mipmap filtering is achievable.
Sparse textures offer similar data compaction, and mipmap filtering is supported natively by hardware texture sampler. And the usage and implementation are also less engaging than those of SVOs. The drawback is that we need hardware supporting
ARB_sparse_texture extension, and for advanced functionalities, such as querying texture page residency information inside a shader, to be available, support of
EXT_sparse_texture2 extension is required, currently only nVidia’s 2nd generation Maxwell architecture supports this extension.
ARB_sparse_texture extension in my nVidia GTX670 enables me to implement voxel-based global illumination using sparse textures. The technique
The following is a snapshot of a voxelized scene stored in sparse texture.
EXT_sparse_texture2 support, the texel value returned from texel fetching is undefined if the requested texel is not in memory. I think it’s safe to assume the value is 0 in nVidia’s implementation; the black outlines is the result of blending between non-empty and empty voxels.
Ambient Occlusion is a natural extension from the GI implementation. For each pixel several cones are shot to test the occlusion along the cone directions.
And the following is a debug view from my program, showing cone directions in each vertex:
The occlusion test is done by checking if there is non-empty voxel along the cone directions. As an AO cone progresses outward it get wider and the corresponding occlusion test should check larger voxels (voxels covering larger space). This could be done by testing different mipmap levels of the sparse texture.
Here is a snapshot from my current work: