Sign in to follow this  
Enalis

accumulating into an fbo?

Recommended Posts

I am using an fbo and glBlend functions to accumulate the lighting for my deferred renderer's lighting passes, however that's clearly not going to work for my multipass forward rendering approach. I know I can accumulate the lighting for a multipass solution into the glAccum buffer, using the appropriate gl calls, however I was wondering if I could accumulate the lighting into an fbo instead? I realized the reason it works with deferred rendering is because on the lighting passes I'm just rendering into a screen sized quad, but with the multipass I'm re-rendering the scene (which for < 5 lights seems to be faster). Thought? Thanks in advance!

Share this post


Link to post
Share on other sites
Quote:
Original post by V-man
Why isn`t it going to work?
Because you can't just render a full scene with additive blending enabled - parts of the scene which should be occluded will actually be accumulated instead.

Enalis - you should be able to fix this by first doing a 'depth pass', where you don't output to the color buffer, only output the scene to the depth buffer.

In the subsequent passes (the light accumulation passes) disable depth-writes, and set the depth-test to GL_EQUAL. This will ensure that any occluded geometry is not accumulated.

Share this post


Link to post
Share on other sites
Nice, i'm already doing a decal pass. I'll just make sure i'm writing to the depth buffer. Right now it's rendering into another fbo. Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by Hodgman
Quote:
Original post by V-man
Why isn`t it going to work?
Because you can't just render a full scene with additive blending enabled - parts of the scene which should be occluded will actually be accumulated instead.

Enalis - you should be able to fix this by first doing a 'depth pass', where you don't output to the color buffer, only output the scene to the depth buffer.

In the subsequent passes (the light accumulation passes) disable depth-writes, and set the depth-test to GL_EQUAL. This will ensure that any occluded geometry is not accumulated.


Well, if the depth test is GL_EQUAL or GL_LEQUAL, it would just work fine.
In fact, always leave depth test at GL_LEQUAL.

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