Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Post-Process Fog and Transparent Object


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   -  Reputation: 886

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



Sponsor:

#2 unbird   Crossbones+   -  Reputation: 5529

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   -  Reputation: 886

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   -  Reputation: 1472

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   -  Reputation: 30958

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   -  Reputation: 11569

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   -  Reputation: 886

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.



PARTNERS