atmospheric scattering question

Started by
7 comments, last by c0mas 17 years, 10 months ago
Hello everyone, I'm currently trying to implement the accurate atmospheric scattering technique of Sean O'Neil (GPU Gems 2). I now have something that resembles a sky, but with some issues. First of all, O'Neil mentions that the radius of the atmosphere for a planet is 2.5% of the radius of a planet. When using the SkyFromAtmosphere shader I have a black sky when I keep to that ratio, but when the innerradius is very small and the outerradius is very large it works fine. Second, If I have the sun in the east, the sky looks good there, but in the west it's completely black. I never have my complete skydome colored, there's always some black region somewhere... So the question is if anyone has an idea what causes these issues? Is it a setting, could it be some obvious mistake in the shader? To illustrate two screenshots: This is where I see the sky quite nicely, but if I turn the camera 180 degrees I see utterly black. On the right you can see the different settings. (scale depth is divided by 100, Sun color and spec lvl are not used) This is a screenshot with the sun at the horizon, also not quite correct I think.
Alex Vanden AbeeleGraphics ProgrammerLarian Studioshttp://www.larian.com
Advertisement
Did you ever solve this problem? I seem to be having the same problem.
I don't know anything about Sean O'Neil's technique, so I don't know what the parameters do.

Just my 2c, sorry if there are too obvious.

The atmospehere radius problems sounds like there is something wrong with the density function or density settings.

If the sky opposite to the sun is black there is something wrong with the scattering functions or their parameters.

Both of those might be caused by some problem with the scattering calculations/parameters which causes to little light to be in/back-scattered and added to the final result.
I've played a bit with the shaders from Sean O'Neil's demo and it seemed without errors.
Also the athmoshpere radius should 102.5% tha radius of the planet, not 2.5%. Also that 2.5% increase should be big enough to give your camera enough movement space, or you'll be in space before to see anything.

And one more time in the shader are some calculations that require that 102.5 percent increase (that scale function), so that might be the problem with your colors.
Thanks for the reactions! They quite helped.

The solution to my problem was: keep to the values used by O'Neil. The (of course) 102.5% outer radius and the 1/4 of the atmosphere thickness as value for the scale depth did the trick. Indeed, these ratios are neccessary for the scale function.

Lex
Alex Vanden AbeeleGraphics ProgrammerLarian Studioshttp://www.larian.com
Sorry to bring this thread back after no one has posted in 4 days, but I'm still having trouble with this.

I'm bounding the height of the camera to be between the inner radius and the outer radius, setting the outer radius to the size of the skydome, and setting the inner radius to be equal to the outer radius divided by 102.5%.

For some more exact values, my skydome (skysphere actually) and the outer radius are set to 350.0, the inner radius is 350.0 / 1.025, the camera is positioned at (0.0, 342.0, 0.0) and my sky looks like this:
Image Hosted by ImageShack.us

I think it actually looks close to correct, other than the fact that it's stuck to the top of my skysphere. Can anyone explain to me why this is happening? I really want to get this working but I just can't wrap my head around what is going wrong.

Thanks
hm ... hard to tell

Where is your light source ? is it far enough ? I mean really far.

Did you tryed to modify the demo from O'Neil to use your radius ? I think that works just fine. Also what approach do you use, GPU or CPU ?
I ended up making the sphere much larger than moved it down, so that the atmospheric is still "stuck to the top of the skydome." However, I found the bug that was causing it to not look like a proper atmosphere. My lightAngle and cameraAngle were both being calculated as my cameraAngle.

Thanks for your time though.
Good to hear you've solved your problem :) and I was pretty close (I thought it was something with the light :D )

This topic is closed to new replies.

Advertisement