Software Occlusion Culling Rasterizer - What about small cracks?

Started by
4 comments, last by SymLinked 11 years, 3 months ago

Hi,

If you'd use a Occlusion Culling Rasterizer much like DICE describes in their papers, determining visibility by checking how many pixels were written to a lower resolution render target; wouldn't this all break down when you encounter small cracks in your geometry which is visible at your higher resolution rendering but not visible at the smaller occlusion culling resolution? This would result in objects being discarded that are really visible.

How would you deal with this? Is it just accepted as one of the drawbacks of the technique?

Advertisement

I don't know the exact technique behind it, but I would guess, that they use the maximum depth of a raster. In this case the maximum would not be the wall with the crack, but the surface visible through the crack. Therefor I would render the scene to the depth buffer using the final render resolution (or a lower resolution while accepting some errors) and scale this depth buffer down by using max(...).

Yeah this is a drawback. Most rasterizers check to see if a triangle covers some sample point within a pixel (usually the centre) and then fills the pixel if that check is true. At low resolutions, this can cause issues.

Alternatively, you can check whether an entire pixel's square area is covered by the triangle, and only fill it if this test is true, which would solve these issues for a conservative depth renderer... unfortunately, this kind of rasterizer is a lot slower, so I'm not aware of anyone that actually does this.

The most common solution is probably to just ensure that your occlusion meshes are far enough 'inside' the actual mesh so that these problems don't occur in practice. If you notice this issue occurring, you can manually edit an occlusion mesh to make it smaller...

Lastly, you can just perform your rendering at full resolution. For a CPU based depth rasterizer, this might be too slow, but you could instead use a CPU-based occlusion rasterizer (1 bit per pixel), which is an order of magnitude or two faster at filling pixels, which makes rendering full-resolution feasible.

Thanks for your responses! If I could pick, I would rather get some false-positives rather than the opposite. But it doesn't seem like there's a straight-foward way to do that. ;)

[quote name='Hodgman' timestamp='1358336719' post='5022136']
Lastly, you can just perform your rendering at full resolution. For a CPU based depth rasterizer, this might be too slow, but you could instead use a CPU-based occlusion rasterizer (1 bit per pixel), which is an order of magnitude or two faster at filling pixels, which makes rendering full-resolution feasible.
[/quote]

That's interesting. I'm definatly taking the approach of CPU depth rasterizer rather than the 1-bit per pixel approach. Not sure how they map that to the objects being rendered. But it got me thinking, thanks Hodgman!

I'm definatly taking the approach of CPU depth rasterizer rather than the 1-bit per pixel approach. Not sure how they map that to the objects being rendered

Bare with me --

In this old thread from 2003, treething mentions that you can speed up depth rasterization by, instead of interpolating depth across a triangle using the values from the 3 vertices, you can just find the furthest of the 3 vertices and use it's depth as a constant across the whole triangle. This increases false-positives (where something is really hidden, but the OC says it's not occluded) in cases where your triangles are at steep angles, but saves you a few instructions.

For occludees (the things you're testing for occlusion), you could also rasterize them as triangles (e.g. if performing something similar to hardware occlusion queries -- counting how many pixels would have been filled), but instead of picking the max depth per-triangle, for these you pick the min-depth per triangle to make sure you don't end up with false-negatives.

In that article that I linked, they're taking this idea to the extreme -- if every triangle has a constant depth value, then you can pre-sort the triangles from front to back, using max-z for occluders and min-z for occludees. You then loop through the sorted list, processing the triangles from front to back.

Occluders write a 1 to every pixel that they cover, whereas occludees test all their pixels to see if any are a 0 (as soon as a 0 is found, they early exit and mark the object as being visible).

In this system, you don't need to render depth at all. Whenever you're testing an occludee triangle, your "render target" contains a boolean mask of which parts of the scene are covered by geometry that is closer to the camera than the occludee is! All you need to know is whether the occludee is fully covered by this mask or not.

At the end of this process, your render-target will likely be completely full of 1's and is of no use -- the occludee testing work is interleaved with the rasterizing of occluders, so that just the right amount of occluders have been drawn so far whenever something is tested.

Makes perfect sense! smile.png I'm going to test that right away and run some numbers, it sounds like it could be very fast with SSE. Thanks a ton for your help!

This topic is closed to new replies.

Advertisement