Transparent Bug when additive blending and FOG enabled
Posted: Thu Dec 15, 2005 8:06 am
I recently found a bug when you enable additive blending and Fog with another color than black.
The additive blending of the fogged texture will result in a "doubled" colorvalue. For better understanding I made some snapshots:
bigger screenshot![Image](http://img236.imageshack.us/img236/9889/bug16jl.th.jpg)
Pic 1: This is my testapp: notice the billboard which is flying above the terrain.. nothing special to discover.. but ..
bigger screenshot![Image](http://img236.imageshack.us/img236/4599/bug22dk.th.jpg)
..if the billboard moves into the fog, there are nasty artefacts appearing..
I made a picture from a distance to show the bug very clear:
bigger screenshot![Image](http://img236.imageshack.us/img236/2430/bug32wn.th.jpg)
Explanation:
When drawing a fogged additive blended material, the color values will be blend into the fogcolor and then added to the screen. If fogcolor is not black,this procedure will result into a doubled fog color value as the fog color will be on screen and on the polygon and then added together.
Solution
Additive blending materials have to set the fogcolor to black and after render themselve they need to reset to current fog color.
This has to be done in CXXXDriver.cpp for each Videodriver. I would fix it, but unfortunately I cannot test implement DirectXrenderers.
So I hope a fix will make it into a next release.
Thanx in advance. And keep up the good work!
Peter
The additive blending of the fogged texture will result in a "doubled" colorvalue. For better understanding I made some snapshots:
bigger screenshot
![Image](http://img236.imageshack.us/img236/9889/bug16jl.th.jpg)
Pic 1: This is my testapp: notice the billboard which is flying above the terrain.. nothing special to discover.. but ..
bigger screenshot
![Image](http://img236.imageshack.us/img236/4599/bug22dk.th.jpg)
..if the billboard moves into the fog, there are nasty artefacts appearing..
I made a picture from a distance to show the bug very clear:
bigger screenshot
![Image](http://img236.imageshack.us/img236/2430/bug32wn.th.jpg)
Explanation:
When drawing a fogged additive blended material, the color values will be blend into the fogcolor and then added to the screen. If fogcolor is not black,this procedure will result into a doubled fog color value as the fog color will be on screen and on the polygon and then added together.
Solution
Additive blending materials have to set the fogcolor to black and after render themselve they need to reset to current fog color.
This has to be done in CXXXDriver.cpp for each Videodriver. I would fix it, but unfortunately I cannot test implement DirectXrenderers.
So I hope a fix will make it into a next release.
Thanx in advance. And keep up the good work!
Peter