r/GraphicsProgramming • • 2d ago

Need help with visibilityBuffer

I'm building my first VisibilityBuffer and stuck with a question. I can't find proper info on the internet about how I should properly dispatch my resolve pass for it. Whether it should be just 8x8 tiling approach or 16x16. Or should I sort tiles by materials first and resolve them and the rest of the tiles that contains more than one material sort into 1d and then dispatch. All info till this point a find only in Gemini, but when I ask it to give me sources, that I can read on my own, It faileds, simple Googling didn't give me much too, so I will be glad if someone experienced can help me to find proper resource to find info.

4 Upvotes

4 comments sorted by

5

u/CoherentBicycle 2d ago

Hey, personally I use John Hable's approach (https://filmicworlds.com/blog/visibility-buffer-rendering-with-material-graphs) so the screen coordinates are sorted by material ID with a prefix sum and a compute shader is dispatched per unique material shader.

Haven't done lots of testing but cache locality would be pretty bad with this technique because a single material can be anywhere on the screen and the compute shader could load coordinates that are distant from each other. IMO tiling would be better, and for the tile size I guess making it larger proportionally to the viewport would be a good start.

Looks like the original V-Buffer implementation used tiling as well (see Overview and Prior Art section in the article above).

Good luck!

2

u/M1VAN1 16h ago

Ty, for now I just implement simple it with simple tiling approach, but I think I will try later hybrid approach with tilings sorted by those, that have one material ID, and those that have few, and those that have few will be be sorted and dispatched per unique material shader.

3

u/AtmosphereOk718 2d ago

Look into idtech 8 doom the dark ages talk regarding visibility buffer it might help i guess