Skip to content
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

Merged
merged 7 commits into from
Aug 16, 2017
Merged

Added STK atmosphere improvements #5741

merged 7 commits into from
Aug 16, 2017

Conversation

klingerj
Copy link

@klingerj klingerj commented Aug 11, 2017

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.

@cesium-concierge
Copy link

@klingerj thanks for the pull request!

I noticed that CHANGES.md has not been updated. If this change updates the Cesium API in any way, fixes a bug, or makes any non-trivial update, please add a bullet point to CHANGES.md and bump this pull request so we know it was updated. For more info, see the Pull Request Guidelines.

I am a bot who helps you make Cesium awesome! Thanks again.

@emackey
Copy link
Contributor

emackey commented Aug 11, 2017

Looks awesome!

Here's master, with the high-quality stars:

atmosphere_old

And here's this branch:

atmosphere_new

@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 12, 2017

At quick glance the code is OK with me. @emackey do you want to review and merge?

@pjcozzi pjcozzi requested a review from emackey August 12, 2017 14:59
Copy link
Contributor

@emackey emackey left a 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.

@@ -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;
Copy link
Contributor

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

@klingerj
Copy link
Author

klingerj commented Aug 13, 2017

@emackey 'fraid I don't have a good answer as to why I did that...fixed it though. Thanks for pointing that out.

@@ -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);
Copy link
Contributor

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)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor

@emackey emackey left a 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.

@abwood
Copy link
Contributor

abwood commented Aug 15, 2017

PR looks good to me too. Awesome work @klingerj!

@pjcozzi pjcozzi merged commit 59dc98e into CesiumGS:master Aug 16, 2017
@pjcozzi
Copy link
Contributor

pjcozzi commented Aug 16, 2017

Thanks again @klingerj!

@klingerj klingerj deleted the atmosphere-improvements branch August 21, 2017 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants