Multi-pass lighting questions

Started by
5 comments, last by TimFang 16 years, 10 months ago
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!
Best regards! --http://www.magicgear3d.com
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?
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.
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.
Best regards! --http://www.magicgear3d.com
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.
Best regards! --http://www.magicgear3d.com
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.
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?
Best regards! --http://www.magicgear3d.com

This topic is closed to new replies.

Advertisement