Jump to content
  • Advertisement
Sign in to follow this  
TimFang

Multi-pass lighting questions

This topic is 4053 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello I’m trying multi-pass lighting architecture. I know the basic idea: For each light For each object Frame buffer += render(object, light); There are some questions I can’t work out: 1.Sky: I should render the sky box or sky dome first, without depth test and depth write, so accumulate object color to frame buffer will get wrong result. 2.transparent faces: need alpha blending to frame buffer, can’t accumulate. Thanks a lot!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by TimFang
1.Sky: I should render the sky box or sky dome first, without depth test and depth write, so accumulate object color to frame buffer will get wrong result.

What you can probably do is perform the lighting accumulation first, and then render the skybox using the stencil buffer to mask out areas where there are objects.

Quote:
Original post by TimFang
2.transparent faces: need alpha blending to frame buffer, can’t accumulate.

Accumulate on a separate pair of render-targets without using alpha blending, however store the alpha values each lighting pass (don't accumulate, just copy from one light pass to the next). Then alpha blend the entire target onto the frame-buffer, after every object. Areas of the render-target with an alpha of 0 won't get copied, while the lit objects get alpha blended correctly. It's not the most efficient method, but it works.

Have you looked into doing deferred shading?

Share this post


Link to post
Share on other sites
Rendering the sky first (w/o depth-tests and -writes) and simply disabling blending while rendering the first light-pass for each object should also work.

Share this post


Link to post
Share on other sites
Quote:
Original post by Eternal
Rendering the sky first (w/o depth-tests and -writes) and simply disabling blending while rendering the first light-pass for each object should also work.


Yes, this is a good idea.

Share this post


Link to post
Share on other sites
Quote:

Accumulate on a separate pair of render-targets without using alpha blending, however store the alpha values each lighting pass (don't accumulate, just copy from one light pass to the next). Then alpha blend the entire target onto the frame-buffer, after every object. Areas of the render-target with an alpha of 0 won't get copied, while the lit objects get alpha blended correctly. It's not the most efficient method, but it works.

Using a separate render-target for transparent object?It will work for most occasions, but will not work for face overlay, something like this:

________________ (transparent face A)
_______________________(transparent face B)
\eye/

The pixel of face B will over write face A, which should using alpha blend.

Quote:

Have you looked into doing deferred shading?


Deferred shading is a clean method, I like it very much. But we still need forward shading for transparent objects. So I want to try some multipass lighting for learning.

Share this post


Link to post
Share on other sites
Quote:
Original post by TimFang
Using a separate render-target for transparent object?It will work for most occasions, but will not work for face overlay, something like this:

________________ (transparent face A)
_______________________(transparent face B)
\eye/

The pixel of face B will over write face A, which should using alpha blend.

What I meant was that you do all the lighting for a single transparent object in separate render targets without alpha blending, and then finally render it to the scene using alpha blending. Then you do all the lighting for the second transparent object and render it to to scene using alpha blending, etc., in proper depth order. This allows you to perform the lighting separately from the blending.

Share this post


Link to post
Share on other sites
Quote:

What I meant was that you do all the lighting for a single transparent object in separate render targets without alpha blending, and then finally render it to the scene using alpha blending. Then you do all the lighting for the second transparent object and render it to to scene using alpha blending, etc., in proper depth order. This allows you to perform the lighting separately from the blending.


Thank you for explain. Render target blending per transparent object will take a lot of fill rate. Is there more efficient way?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!