Sign in to follow this  
jacko13

deferred shading quad size and dependent on light area.

Recommended Posts

jacko13    100
Hi, I'm interesting how can I properly select a region on my full screen quad to draw only fragments which are dependent on current drawing light. I need them to optimize my deferred shading, because now I write full screen quads for it and I know than it isn't the best method for it because, we will have problem with fill when we add many lights on scene. In my engine I use point and spot lights.

Share this post


Link to post
Share on other sites
KRIGSSVIN    172
Use modelview projection matrix to project your light bounding box corners onto the screen, then determine their min-max screen-space bounds, so you know your light scissor rectangle.

Or if you don't need scissor, use light 3D-volume...

Share this post


Link to post
Share on other sites
AndyFirth    162
assuming your lights can be represented in convex geometry

* Render back face polys and write to stencil on Z Fail
* Render front face polys and perform lighting only where the Z Test passes AND the stencil from previous is set.

stencil write/test will need to cycle the mask used and clear stencil every 8 lights (or clear by re-rendering light geo itself).

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