Post-Process Fog and Transparent Object

Started by
5 comments, last by Alundra 9 years, 9 months ago

Hi all,

Post-Process Fog is a simple fullscreen quad with a shader who uses scene color and scene depth.

The problem is scene depth doesn't contains transparent object (meshes + particles).

The fog doesn't affect these object who cause rendering problems.

What is the way to avoid this problem correctly ?

Thanks for the help

Advertisement
Calculate the fog not as a post-process but already when drawing your stuff (as a last step in your pixel shaders).

Depending on your setup you could half-way go with your approach. Render opaque objects, do that full screen quad fog, then the transparent objects with fog integrated.

This is the only option I found too, sounds like no other way exist.

For transparent objects I use premultiply alpha and I combine fog like this.


color.rgb =  lerp(color.rgb, fogInScatter.rgb * color.a, extinction);

This is the only option I found too, sounds like no other way exist.

There's always another way, it just might be too complicated to bother using ;-)

I was just reading through my new copy of GPU Pro 5, and one of the articles from Guerrilla talked about how they computed fog scattering at 16 different depths and stored the result in a 3D texture. Then they had transparents sample that texture to approximate the result. It's probably a bit overkill for your simple, old-school fixed-function fog but it's another option to consider.

Interesting, that demand research on the atmospheric scattering rendering.

It's surely a better option than old school fog, more modern, I should look at GPU Pro 5.

This topic is closed to new replies.

Advertisement