Replacing Water/Ocean

What is the best way to replace the Ocean in Cesium with an Ocean asset from the Unity store.
The main reason I need to do this is because I’m developing a game with boats and the boats need to look like they’re realistically in the water (ie: water trail, etc.)

If I put a plane above the Cesium ocean it runs into the land mass.

Any help is appreciated.

Thanks!

Hi @FlightMe, welcome to the community!

I’m not familiar with the Ocean asset from the Unity store, but I can guess what the problem is. Too many game engine assets assume that the game world is flat. That assumption of course breaks down badly with a realistic model of Earth. Sadly, the flat Earthers are wrong - or my job would be so much easier!

If that’s the problem, unfortunately a solution is going to be hard to come by. You’ll probably need to talk to the developer of the Ocean asset. If you’re not sure if this is the problem, perhaps share some screenshots and we’ll be able to tell.

Hi!

I am looking for a similar solution. My team has been able to map to the surface of the water using the EGM96 water level projection via this package: GitHub - GeoidHeightsDotNet/GeoidHeightsDotNet: Calculate Geoid Undulation according to EGM96, Earth Gravitational Model

We’re still running into the issue where our ocean is rendered twice: Is there a way to hide the ocean that comes with the Cesium data?

Cheers

you should be able to hide it with shader magic I assume.

Unfortunately, no, there’s not currently a good way to do this in Cesium for Unity. Cesium for Unreal does expose the “water mask” provided with Cesium World Terrain, so if you’re using that dataset in particular it is possible to use a custom material to hide the water areas completely. If you need that capability, please keep an eye on this issue

https://github.com/CesiumGS/cesium-unity/issues/607

If you’re handy with C++ code, you may even consider implementing it yourself by cross-referencing with the Unreal implementation. And in that case, we’d welcome a pull request!

With other tilesets, such as Google Photorealistic 3D Tiles, it’s not possible to do this in either engine because the tileset itself doesn’t have any notion of which parts are land versus water.

You might be able to achieve these in either engine, and with any tileset, by using a raster overlay with a custom water mask of your own creation. For example, if you could find a good source of water polygons for the area you’re interested in, you could publish that to, say, Geoserver, and then load the rasterized polygons into Cesium for Unity using the CesiumWebMapServiceRasterOverlay component. From there, a custom material can be used to set the opacity of the pixel to 0 inside the water polygons. Definitely a bit of work here, but it’s doable.

1 Like

Thanks for the help!