-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added STK atmosphere improvements #5741
Conversation
@klingerj thanks for the pull request! I noticed that I am a bot who helps you make Cesium awesome! Thanks again. |
At quick glance the code is OK with me. @emackey do you want to review and merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this @klingerj! One question on the code.
Source/Shaders/SkyAtmosphereVS.glsl
Outdated
@@ -126,5 +127,6 @@ void main(void) | |||
v_mieColor = frontColor * KmESun; | |||
v_rayleighColor = frontColor * (InvWavelength * KrESun); | |||
v_toCamera = czm_viewerPositionWC - positionV3; | |||
v_radii = u_cameraAndRadiiAndDynamicAtmosphereColor.zy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why pass this in as a varying, when the FS also has access to the same uniform?
/cc @abwood
@emackey 'fraid I don't have a good answer as to why I did that...fixed it though. Thanks for pointing that out. |
Source/Shaders/SkyAtmosphereFS.glsl
Outdated
@@ -73,5 +75,12 @@ void main (void) | |||
l = min(l, czm_luminance(rgb)); | |||
#endif | |||
|
|||
gl_FragColor = vec4(rgb, min(smoothstep(0.0, 0.1, l), 1.0) * smoothstep(0.0, 1.0, czm_morphTime)); | |||
// Alter alpha based on how close the viewer is to the ground (1.0 = on ground, 0.0 = at edge of atmosphere) | |||
float atmosphereAlpha = clamp((u_cameraAndRadiiAndDynamicAtmosphereColor.y - length(czm_viewerPositionWC)) / (u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.z), 0.0, 1.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
length(czm_viewerPositionWC)
can be replaced by u_cameraAndRadiiAndDynamicAtmosphereColor.x
(camera height)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Waiting on one last check from @abwood.
PR looks good to me too. Awesome work @klingerj! |
Thanks again @klingerj! |
Applies alpha to the atmosphere that causes the atmosphere (as viewed from the ground) to disappear as the sun goes down if the lighting flag is enabled. Also alters alpha based on viewer position relative to the ground.