I would like to make a gpu version of this very nice plugin from Joreg:
I have not started yet, but just wanted to ask some of the shader gurus here about a good approach using the dx11 pipeline.
I was thinking initially to use some kind of 3D binning, like where you break a texture in to a grid, but sorting the space in to cubes. Any ideas or suggestions?
have a dx9 version, maybe xmas might bring time to clean it up and port it to dx11.
approach feels a little hacky though. encode points as 1d texture, cross them in a 2d one to calculate the distances. lookup and draw the ones necessary.
So just an update with a more specific question…
I’ve made a compute shader that is basically a 3D version of Gridpick(2D). So you give it your 3d points as a buffer and get back a buffer of bin indices
xyz, xyz, xyz, xyz
4, 0, 1, 1
I want to make a second compute shader that gathers these indices in to bin counts and sorts them in to their bins.
1, 2, 0, 1
Bin Indices (in this case using a max of 4, would probably be more)
I’m a bit stuck on how to increment the counters for this (and by extension the offsets for writing them in to the buffer). What mechanism can I use to ensure threads are not writing to the same slot?
I think this should help with counting bins and writing to the buffer…
Thanks Cat. I had actually started trying to use interlocked add but could not get it to work. Will try to understand what’s going on with this histo business and adapt it.
So to be honest, I kind of gave up on this, as it was difficult and had other things to work on. I did get part of the way there though, maybe someone can manage to finish it. There might be some useful and or interesting stuff there for other things as there are a couple of very generic compute shaders in this zip, basically GPU versions of:
SpatialBinningExample.zip (44.6 kB)