cesium-unreal icon indicating copy to clipboard operation
cesium-unreal copied to clipboard

Water mask always uses texture coordinate 0, which is often (incorrectly) Web Mercator

Open kring opened this issue 3 years ago • 3 comments

MF_CesiumWaterMaskSample uses a parameter named geographicTextureCoordinateIndex. It's never set, so it will always have its default value (0). If the tileset has a Web Mercator overlay (e.g. Bing), then texture coordinate 0 will use a Web Mercator projection instead of the expected Geographic projection.

This doesn't cause an immediate problem because we fade out the water effect as we zoom out. Because the texture coordinates are effectively correct at the tile edges anyway, and because the difference between Web Mercator and Geographic within a tile is not noticeable except within large tiles, it's nearly impossible to notice any actual effect from this bug. But that might not be true with a custom material that doesn't fade out.

kring avatar Sep 06 '21 03:09 kring

A simple but hacky solution to this is to add the geographic projection for the water mask before adding any other projections for overlays (currently we do the opposite, for not real reason). That way, when a water mask is present, the geographic coordinates will always be found at index 0.

A better solution is to use the coordinates designated for the geographic projection, no matter what index they're found at. That will require passing a bit of extra watermask-related data from cesium-native to cesium-unreal in extras or whatever.

kring avatar Sep 06 '21 04:09 kring

Could this be helped by working the water mask into the raster overlay system? Or did we decide not to do that for other reasons?

nithinp7 avatar Sep 09 '21 00:09 nithinp7

Yeah, the water mask should become a raster overlay for sure. There's no good reason it's not already done other than we didn't get to it yet.

kring avatar Sep 09 '21 02:09 kring