Spherical sloped material based on height of terrain

Hii, i would like to make a Cartographical like material for a Cesium terrain that is basically te earth, but im having such a hard time I would love if anyone could help me and lend me a hand. The main odea is having a slope like material in wich depending of the height of the terrain has a color assigned, Its easily doable on a plain terrain, but as soon as I move to a spherical Landscape its madness for me…
descarga (4)
Thats my main Idea but for a Spherical landscape.

Thankyou so much

You can’t really color the material based on the height in Unreal coordinates, because it will be completely negative for one side of the globe. But if you only viewed the Earth from ground level, then you could get away with it using origin shifting (moving the Unreal origin as the camera moves). The Cesium for Unreal Samples actually provides a terrain-height based material that is only configured for viewing at the ground level. (See 09_CesiumMaterialEditing).

One idea you could try – wherever the center of the globe is in Unreal coordinates, subtract that from the “Absolute World Position” in the Unreal material. You can use the magnitude (length) of that resulting vector to determine a color for the terrain. You may need to reduce it to a reasonable range by subtracting the radii of the ellipsoid model Cesium uses (the WGS84 ellipsoid).

I haven’t tried the above myself, so I can’t verify how effective it is, but hopefully it helps.

1 Like

Wow, I thought that was easier :sweat_smile:. Well in that case I had another option in mind, baking a height map and color ramping it so I get a similar effect. Is there any way on baking a Height map on Cesium?