PDA

View Full Version : 3D Sparse Voxelization with ARB_sparse_texture



MaxDaten
02-21-2015, 09:03 AM
Hi,

I currently trying to implement a sparse voxelization technique without an explicit octree on the gpu. I want to use the sparse voxelization for global illumination later on (idea based on SVOGI, of course). To avoid the GPU octree (to skip building it and the traversal for cone tracing) I want to utilize the ARB_sparse_texture extension: I think the concept is not really new (I've read about it), It should be theoretical doable, but I have a practical problem with some undocumented :( API restriction.

First of all my current idea (please hint me any misunderstandings on my side):

create a sparse 3D texture for full resolution voxelization of the scene
create a virtual-page mask (also 3D) with num-pages-x, num-pages-y, num-pages-z dimension
1-pass voxelize scene into the virtual page mask to mark pages as in
map virtual page mask in cpu space, iterate over it and commit pages for the full resolution voxelization
1-pass voxelization again with full resolution into the sparse texture



I hope the concept is clear. Now my practical problem. I have success with the normal 1-pass voxelization but when i start to make use of the ARB_sparse_texture extension and set the full resolution texture to sparse I bumped into this API error:



major api error 1282: GL_INVALID_OPERATION error generated. Image lookups are not supported for tiles with depth > 1. Please use tile dimension where tile depth is 1.
glGetError(glBindImageTexture) = GL_INVALID_OPERATION


Sadly this restriction isn't anywhere documented (or?) not even in the spec. The problem is, for the 1-pass voxelization, I have to use gimage3D for example to store my voxels directly into the texture. But it seems this starts to be impossible with sparse textures.

But maybe I missed something? Or is it a restriction of my system? Or has anyone a workaround for it? I've run out of options at the moment.

Additionally, it's really interesting that there are some blog posts out there describing a similar technique and the use of sparse textures for octree-less voxelization. [1]

My system:
"vendor: NVIDIA Corporation"
"renderer: GeForce GTX 570/PCIe/SSE2"
"version: 4.4.0"
"glsl: 4.40"

[1]: https://chengtsolin.wordpress.com/category/voxel-based-gi/

MaxDaten
02-23-2015, 07:56 PM
okay i managed to use 3d sparse textures. I misread the part about the different page size formats. You can get the numer of formats with getInternalformativ & NUM_VIRTUAL_PAGE_SIZES_ARB and the query the different page formats. At least in my implementation there was a 128x128x1 format. So I can use sparse 3d textures now, theoretically. But I've got a weird behavior now. When i perform imageStore In a completely uncommitted sparse texture it stil writes something. And everything seems to be clamped on z=0 or z=max. Yes, reads in uncommited regions are undefined, so I should avoid to read it. So i build i page mask to mask committed and uncommitted regions, to determine what should be committed and uncommitted and to avoid reading from uncommitted pages. Even if I read only from committed areas there is garbage read from the garbage writes it seems. Even if i clear every new commited page with TexSub*, there is still garbage to read.

An example of spheres hovering over a plane encircled with 2 walls:
1641