Sign in to follow this  
belfegor

Image space occlusion culling and occluder clipping

Recommended Posts

belfegor    2834

I am trying to use this library ISOCE to help my scene culling. So i generated my occluder (just one quad for test) and everything culls correct if whole occlusion quad is in view:

full.png

but getting incorrect results if it crosses screen boundaries:

partial.png

There is mention about that in librarys documentation:

The occluder Data contains the Quads that represent the virtual occluders.
The quads expected must:

        Be in Screen Space:

The x and y coordinates should be between 0 and BufferSizeX - 1. If the Occlusion Buffer is downsampled, then you should scale the points too.

        Have a Correct Depth Value:
        The depth should be a value between 0 and 1 (inclusive). If Occluder Boxes lay behind the near plane, clip the quads manually.



Since i am not math wizard i have tried and found some article with source about polygon clipping which might suit my need.

http://www.codeguru.com/cpp/misc/misc/graphics/article.php/c8965/Polygon-Clipping.htm

polygonclipdemo.jpg

Now i can obtain clipped vertices but don't know how to obtain depth data for those since i need that also? Please, any help?

Thank you for your time.

Share this post


Link to post
Share on other sites
belfegor    2834

Solved.

Found some C# demo (with code) in their download package which does the job. I needed to clip polygons in "world space" against frustum planes and then transform to "screen space".

 

good.png

Edited by belfegor

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this