Skip to content

Added a property for setting the amount of the vertex shadow attenuat… #10914

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

Merged

Conversation

calogeromauceri
Copy link
Contributor

Fixes #10913

Added an option to Globe (Globe.vertexShadowDarkness) for changing the amount of the terrain vertex shadow darkness when lighting is enabled (Globe.enableLighting). Similarly to ShadowMap.darkness parameter, a value near 0 makes the shadows darker, increasing it makes the shadows brighter. The default value is 0.3 (that was hard coded in Cesium).
Having the ability to change the terrain vertex shadow darkness allows to create more realistic shadows for cases, like the Moon, where there is no atmosphere and the light contribution from other sources (sun or earth) can be very small.

Here is a sandcastle example with default terrain vertex shadow darkness (current behaviour, advance the time in timeline till the terrain is fully shadowed)

sandcastle

terrain_vertex_shadow_cesium

here is a sandcastle example with the new parameter for changing the terrain vertex shadow darkness

sandcastle

terrain_vertex_shadow

The parameter can be dynamically changed, as visible in this example

sandcastle

terrain_vertex_shadow2

…ion when terrain lighting is enabled (by dafult it is set to a fixed value, 0.3)
@cesium-concierge
Copy link

Thanks for the pull request @calogeromauceri!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.

@calogeromauceri calogeromauceri changed the title added a property for setting the amount of the vertex shadow attenuat… Added a property for setting the amount of the vertex shadow attenuat… Nov 18, 2022
Copy link
Contributor

@ggetz ggetz left a comment

Choose a reason for hiding this comment

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

Thanks @calogeromauceri for the PR!

This is working well! I have a couple comments, then @sanjeetsuhag would you be able to take a pass on the globe shader changes?

@calogeromauceri
Copy link
Contributor Author

@ggetz, @sanjeetsuhag thanks for your feedback. I just pushed the changes you suggested. Please let me know if anything else is needed

Copy link
Contributor

@sanjeetsuhag sanjeetsuhag left a comment

Choose a reason for hiding this comment

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

@calogeromauceri Using a uniform is working great. However, there's still some cleanup needed since the changes to GlobeSurfaceShaderSet are no longer needed.

@calogeromauceri
Copy link
Contributor Author

@sanjeetsuhag I just pushed the changes you suggested. Please let me know if anything else is needed

Copy link
Contributor

@sanjeetsuhag sanjeetsuhag 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 your patience with the review, @calogeromauceri. The changes look good! Thanks again!

@sanjeetsuhag sanjeetsuhag merged commit 439a022 into CesiumGS:main Dec 6, 2022
@calogeromauceri
Copy link
Contributor Author

@sanjeetsuhag thanks to you for the great support, guidelines and responsiveness!

@calogeromauceri calogeromauceri deleted the vertex_shadow_darkness_opt branch December 6, 2022 16:49
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.

Unable to change terrain vertex shadow darkness amount
5 participants