Forum

DX11 GPU version of ConnectAll

Hey,

I would like to make a gpu version of this very nice plugin from Joreg:
connectall

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?

+1… no text …

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

for example:
xyz, xyz, xyz, xyz
V
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.

Count
1, 2, 0, 1

Bin Indices (in this case using a max of 4, would probably be more)
1,x,x,x
2,3,x,x
x,x,x,x
0,x,x,x

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?

https://discourse.vvvv.org/t/12107
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:

  • Coutindices
  • Gridpick3D
  • Integral

SpatialBinningExample.zip (44.6 kB)