Jump to content

View more

Image of the Day

WIP title screen for #DeathOfAPartisan #screenshotsaturday #gamedev https://t.co/qJNhfZCvd4
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Post-Process Fog and Transparent Object

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
6 replies to this topic

#1 Alundra   Members   

2281
Like
0Likes
Like

Posted 12 July 2014 - 04:36 PM

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



#2 unbird   Members   

8307
Like
3Likes
Like

Posted 12 July 2014 - 04:52 PM

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.

#3 Alundra   Members   

2281
Like
0Likes
Like

Posted 13 July 2014 - 08:17 AM

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



#4 kalle_h   Members   

2463
Like
0Likes
Like

Posted 13 July 2014 - 03:13 PM

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

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

Edited by kalle_h, 13 July 2014 - 03:14 PM.


#5 Hodgman   Moderators   

50652
Like
0Likes
Like

Posted 13 July 2014 - 08:26 PM

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 ;-)

#6 MJP   Moderators   

19481
Like
0Likes
Like

Posted 13 July 2014 - 11:47 PM

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.



#7 Alundra   Members   

2281
Like
0Likes
Like

Posted 14 July 2014 - 11:27 AM

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.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.