To provide some context, I’m trying to recreate a bird’s-eye view of an aviation GPS. To do this, I need the Earth (hence the use of cesium) as well as a material that changes color based on altitude (green at low altitudes, brown >1000m, dark brown > 2000m). This is just an example; I need a simplified view (without details or cities). But I still have a problem: how do I handle the water? Setting blue at 0 meters altitude could be a solution, but that’s not what I’m looking for. For that, I’d like to use Cesium’s water mask to color areas where the mask value is 1 with a blue material. But I really don’t know how to go about it due to my lack of knowledge of Cesium. could you please help me?
By the way, I have a quick update: I managed to find the water mask and make it work, but if I don’t use satellite view, I run into issues with material collisions.
I have absolutely no idea how I could smooth out the connection points between the two, or how to avoid this area where no material is assigned.
Hey @Rxmex,
Welcome to the forum! Nice work getting the water mask up and running! The boundary issue you’re describing is pretty common when mixing a custom material with Cesium’s water mask system.
I think what’s happening is that the altitude material and the water material are operating as two separate systems, which creates those unassigned gaps at coastlines and messy borders between the two. The cleaner fix is to integrate both into a single material using Cesium’s material layering system.
The tileset actor has three material slots: Material, Translucent Material, and Water Material. You should be able to point all three to the same custom material instance for seamless rendering.
@pjiang9 walked through this workflow recently in Change Water color in cesium water material. Related threads: Custom water mask and Rendering the water using ue4.
Let me know if this helped! The aviation GPS use case sounds interesting.
Cheers!
Quick follow-up on this, I’d recommend checking out the Cesium for Unreal Samples project, specifically Level 9. It has pre-built materials for custom water masks, elevation band coloring and height blending, which sounds like basically exactly what you’re building. Might save you a lot of graph wiring!
Thanks for your advice. I opened CesiumforUnrealSamples to see what the 9th level looked like it’s pretty extensive, especially for someone like me who isn’t familiar with either Cesium or Unreal. So I took the Material and had some fun tinkering with it by removing the satellite images. The problem is that I couldn’t figure out how to assign one Material to my Land and another to my Water; the only solution I found was to mess with the “Background” section. But I don’t think that’s the right method. I tried, as shown for “water” in the screenshot, to create a “land” material layer that uses the inverse logic of water, an ML_CesiumWaterMask with a OneMinus in front to get the land, and I tried copying the MLB_CesiumSimpleLand, but same thing—it didn’t work; it messes up the textures. So here’s the result using Background, but the fog effect on the water is clearly bothering me.
For someone who isn’t familiar with Unreal this is tricky, but if you follow Kevin’s solution here: Custom water mask - #4 by Kevin_Ring
or pijan9’s solution here: Change Water color in cesium water material - #2 by pjiang9
Both of these tackle the issue you are and should solve your problem.
If you just wanted a height blend on the land, you could get away without using custom materials here at all. Unreal sample includes a MI_CesiumHeightBlend and you just have to set the materials on the Tileset in your scene directly. However you will lose the watermask. You could adjust the low altitude color on the material to blue and maybe achieve an affect you’re happy with.
For example, on Level 9, select the CesiumWorldTerrain tileset, then if you scroll through the details section you should find some materials under Rendering
You’ll notice that there is a water material here, that only works ( i believe) if the “material” set above it expects a water material.
I have already set mine to CesiumHeightBlend and that looks like this:
If I duplicate the material and set the low altitude colour to blue you get:
Obviously this is not as optimal as getting a water mask working on a custom material, but if aren’t able to get Kevin and Pijangs solution working for you, this may be an okay alternative.
Hope that helps!





