Archived

This topic is now archived and is closed to further replies.

tridemax

Pixel fog and multipass rendering

Recommended Posts

tridemax    124
I have a problem with multipass rendering and pixel fog. If I render 2 passes with FOG:On - rendered objects have double fog saturation. If I render only first pass with fog - second pass texture shows through fog. If only second pass rendered with fog - fog saturation is too low. With multitexturing - all OK. Suggestions?

Share this post


Link to post
Share on other sites
Richard Smith    136
It sounds like the problem you''re having is that you''re modulating with the fog colour after combining the two passes in the frame buffer rather than before. The order of operations on a pixel should be:

Calc colour of pass 1 from texture / vertex colour
Blend with fog colour based on distance
Write pass 1 to frame buffer

Calc colour of pass 2 from texture / vertex colour
Blend with fog colour based on distance
Blend with frame buffer

Once the order is corrected, if you''re using src/invsrc blending then you are blending between two fogged pixels, which should produce the correct results. However, if you use additive blending on your second pass, you''ll need to set the fog colour to black to get the correct effect.

Hope this helps,

Rich

Share this post


Link to post
Share on other sites
tridemax    124
Have srcBlend = DestColor and destBlend = SrcColor.
I apply detail map on blended textures transition.

Seems that only solution is to remove second pass on great distances.

Anyway, thanks!

Share this post


Link to post
Share on other sites