I'm trying to implement collision detection on the GPU like this article:
https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch29.html
In step 2- Grid Generation, we use depth testing to make sure we only write particle IDs greater than the previous one.
I have this working right now by dividing the ID number by the total number of particles:
gl_FragDepth = v_ID/u_totalParticleCount;
But I fear if I get to a point with a lot of particles, I won't have enough accuracy for this.
I tried attaching a RGBA32F texture to my framebuffer depth attachment, but that's not allowed I guess.
Is there a way to do this? Or is putting my IDs into 0-1 space the only way?
Thanks a lot!