Strange issue with Sean O'Neil's atmospheric scattering (ground).

Started by
11 comments, last by c_olin 12 years, 10 months ago
Yeah, I don't see anything wrong with the atmospheric scattering part. I think you should go back and double check that the camera position is really what it is supposed to be. Just because your lighting works doesn't mean everything is definitely correct as far as the scattering code expects it to be. In fact it MUST be wrong, because the scattering code is copy pasted from a working example. You just need to diagnose until you find the incorrect parameters.
Advertisement

Yeah, I don't see anything wrong with the atmospheric scattering part. I think you should go back and double check that the camera position is really what it is supposed to be. Just because your lighting works doesn't mean everything is definitely correct as far as the scattering code expects it to be. In fact it MUST be wrong, because the scattering code is copy pasted from a working example. You just need to diagnose until you find the incorrect parameters.



I appreciate the help.


The odds of my camera position and fragment position being wrong is very slim. I am just setting a uniform every frame with the camera world position. My screen-space water shader (which is very sensitive to camera and fragment position) works fine. I have also have some diagnostic shaders which confirm that these values are what I expect.

I will continue to look to see what might be wrong. It is good to know that the scattering code appears to be correct though.

Thanks

[quote name='bluntman' timestamp='1307469850' post='4820604']
Yeah, I don't see anything wrong with the atmospheric scattering part. I think you should go back and double check that the camera position is really what it is supposed to be. Just because your lighting works doesn't mean everything is definitely correct as far as the scattering code expects it to be. In fact it MUST be wrong, because the scattering code is copy pasted from a working example. You just need to diagnose until you find the incorrect parameters.



I appreciate the help.


The odds of my camera position and fragment position being wrong is very slim. I am just setting a uniform every frame with the camera world position. My screen-space water shader (which is very sensitive to camera and fragment position) works fine. I have also have some diagnostic shaders which confirm that these values are what I expect.

I will continue to look to see what might be wrong. It is good to know that the scattering code appears to be correct though.

Thanks
[/quote]

I found what is causing the issue and "fixed" it. It is the line:


float cameraAngle = dot(-ray, pos);


This should have stuck out to me before because this goes to zero as the ray is parallel. I simply set cameraAngle to the constant 1.0 and it appears fine. However it doesn't really make sense to me why this is only a problem in my code.

This topic is closed to new replies.

Advertisement