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.


Precomputed Atmo Scattering sphere intersection formula


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
No replies to this topic

#1 Vereor   Members   -  Reputation: 103

Like
0Likes
Like

Posted 27 January 2012 - 03:14 AM

Recently I've implemented Eric Bruneton's Precomputed Atmospheric Scattering as I'm sure many other people have in the past as well. I'm only really having one issue adapting it to my usage and that is that I'm using spherical terrain and I want to modify the scattering to take the terrain into consideration.

In particular, I'm unsure what this formula is actually calculating:

float t = -r * mu - sqrt(r * r * (mu * mu - 1.0) + Rg * Rg);

where:
c = camera position relative to the planet's center
r = length(c)
mu = dot(x,v)/r
Rg = radius of the planet, in KM

And what I'm attempting to do, is modify T based on the depth of terrain as sampled from the depth buffer. What I currently have, is the point of the terrain which is directly facing the sun ends up overbright, almost white, which washes out the diffuse colours. If I revert to the basic T formula as shown above, the terrain facing the sun is a typical blue colour which is not overbright but of course it doesn't reflect the changes in terrain.

Short version: Can anyone help me work out what T is actually calculating so I can adjust it to incorporate altitude changes of my terrain?

I've attached an example of my current (clearly broken) method, bottom left area shows terrain without atmosphere effect applied.

Attached Thumbnails

  • 2012.1.27-20.11.0.2.0.game0.Png


Sponsor:



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