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

Add water mask material #12149

Merged
merged 2 commits into from
Aug 30, 2024
Merged

Add water mask material #12149

merged 2 commits into from
Aug 30, 2024

Conversation

ggetz
Copy link
Contributor

@ggetz ggetz commented Aug 23, 2024

Description

Adds a new water mask globe material.

image

The motivation is so that custom globe materials can be written that shade only the land or only the sea, as demonstrated in the new Sandcastle example.

image

In order to do this, I separated the concerns of having a water mask from displaying the water effect in packages/engine/Source/Scene/GlobeSurfaceShaderSet.js, and added the new material shader.

Issue number and link

N/A

Testing plan

  1. Ensure the new Sandcastle example works.
  2. Alter the properties of the customElevationMaterial (such as by using the waterMaskMaterial.diffuse value) to see how the mask interacts with the diffuse channel.
  3. Test the uniforms by setting
material.materials.waterMaskMaterial.uniforms.landColor = Cesium.Color.YELLOW.clone();
material.materials.waterMaskMaterial.uniforms.waterColor = Cesium.Color.BLUE.clone();

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code
Copy link

Thank you for the pull request, @ggetz!

✅ We can confirm we have a CLA on file for you.

@ggetz
Copy link
Contributor Author

ggetz commented Aug 28, 2024

@jjspace A reminder to review this PR.

Copy link
Contributor

@jjspace jjspace left a comment

Choose a reason for hiding this comment

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

Sorry for the delay getting back to this. As far as I can tell (with my more limited knowledge of shaders/materials) all the code looks good. I was also able to test and the sandcastles work as expected.

I think the only thing I might add is that it could be nice to demonstrate the testing plan you outlined in the new sandcastle example. Just a simple material picker like this for people (like me) that are less experienced with our Material api to know how to do that.

@ggetz
Copy link
Contributor Author

ggetz commented Aug 30, 2024

Thanks @jjspace!

I think the only thing I might add is that it could be nice to demonstrate the testing plan you outlined in the new sandcastle example. Just a simple material picker like this for people (like me) that are less experienced with our Material api to know how to do that.

I would generally agree with this feedback. However, for this particular example, I think that distracts from the intended use case and make things a bit more complicated in the code example, which I'd like to avoid if possible.

@jjspace jjspace merged commit 349364c into main Aug 30, 2024
9 checks passed
@jjspace jjspace deleted the water-mask-globe-material branch August 30, 2024 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants