Thanks for the replies.
#IYP - you're correct, yes the point is to make the process faster than going literally 'through all cells'
I believe I've got it correct to some extent. Let me share a screenshot here:
[sharedmedia=gallery:images:8634]
As you can see, the data are not really filtered - I've followed the paper - https://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-SparseVoxelization.pdf
Before I go to my questions and notes - let me outline the algorithm here, so that you might have some ideas where I did something wrong or right. So, my octree building algorithm goes as following:
Graphics queue:
VoxelOctree::Generate()
{
// Simply render the scene, storing fragments (position + color) in UAV
// Use counter buffer to count number of voxels
RenderScene();
}
Compute queue:
VoxelOctree::BuildSVO()
{
levels = log2(dimensions)
for (i = 0; i < levels; i++)
{
// Flag nodes that are going to be subdivided
OctreeNodeFlag();
// For each node on current level, that has been flagged, allocate 8 children
OctreeNodeAlloc();
// Initialize children that were generated
OctreeNodeInit();
}
// At this point I'm absolutely sure that octree structure is working properly!
// But how to fill the data???
// Next to octree I have a data buffer which currently has N*rgba8 field (where N is
// the total number of nodes in octree). Octree node index basically matches the color
// in this array.
//
// Following function just clear octree color and fill single color per node (using
// atomics and approximate average allows us to fill EACH node to which voxel maps)
OctreeNodeClear();
OctreeNodeFill();
}
My understanding of bricks (e.g. how the data should be stored originally) is to allocate large structured buffer which would have 3x3x3 voxel space per each node in the octree (that means 27 times the size of single color per node), which would allow me to the filtering.
So what I had? I simply ran another kernel for each leaf node, that would search what is in 26 voxel surrounding (searching the whole tree from top) the center and filling those values. Which tends to be quite slow. Plus I'm not entirely sure how should I filter it (I stored it in the structured buffer and attempted to do trilinear filtering, without too much success though).
So my real question is, what should I store in those 'bricks' and how to store & obtain data for them (without taking too long time)? Once stored, I still need to perform filtering (which can be done by using 3D texture and pointing to voxels in center of each 3x3x3 voxels in that ~ I can figure out indexing, but I still have problem with obtaining data for them and potentially also storing them in interior nodes of the tree). The paper doesn't really mention how to fill data into the 'bricks', and we don't really have any information about ALL neighbors (just 7 others, that are in the same parent of the current nodes, but what about the rest?).