Hello,
I am trying to implement a flood fill alghorithm on a compute shader. I have seeded a texture with water-texels and then I want other texels to hold “distance to water” values so the seeded texels would have value 0, their direct neighbours value 1, and so on…
It would be trivial to implement on CPU but I am thinking if I can do this on a compute shader instead. I am using a very large texture and I am already doing work with the data inside a compute shader.
The problem I see is that the alghorithm I had in mind dosn't seem to fit very well with how compute shaders execute their threads.
On a CPU I would use a FIFO structure, append the seeded river texels and then for all its neighbours increment and append to the queue.
Any idea how I could do something like this on the GPU?
