Precomputed Atmo Scattering sphere intersection formula

This topic is 2823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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.

• Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 21
• 21
• 11
• 25