CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.9k stars 3.48k forks source link

Web Mercator Weirdness #3153

Open emackey opened 9 years ago

emackey commented 9 years ago

I tried enabling WebMercator mode like this:

var viewer = new Cesium.Viewer('cesiumContainer', {
    mapProjection: new Cesium.WebMercatorProjection(Cesium.Ellipsoid.WGS84)
});
//viewer.extend(Cesium.viewerCesiumInspectorMixin);
viewer.scene.morphTo2D(0);

But the world went awash in wacky weirdness:

badmercator_v2

Is this a bug or am I just doing it wrong? If it's not a bug then we might need clearer docs on how to do this.

/cc @kring @abwood

pjcozzi commented 9 years ago

Can you reproduce this in 1.14?

emackey commented 9 years ago

This is master 595bb4e9f426 from Oct 26.

emackey commented 9 years ago

I'll check 1.14

emackey commented 9 years ago

Yeah, this behavior goes way back, I can reproduce in 1.1 and 1.14

kring commented 9 years ago

@emackey I remember seeing these kinds of artifacts ages ago, and I thought at the time that it was a result of projecting Bing tiles from Web Mercator to Geographic and then back to Web Mercator; we're losing information. There's a roadmap item to fix this (https://github.com/AnalyticalGraphicsInc/cesium/issues/526 search for mercator), but doing so probably requires us to keep the original Web Mercator images around "just in case." Although, this looks a bit worse than I remember, so maybe there is something more nefarious going on.

mramato commented 8 years ago

Could #3104 have cause this to be more noticeable?

emackey commented 8 years ago

It's possible that WebMercator just isn't used much. I had to go back to b28 to find a Sandcastle example of it, and it appeared to exhibit this bug there too. My main concern isn't blurriness, it's the noticable "pop" where the top half of Greenland moves several degrees North or South as you cross a tile/zoom boundary. I don't think the re-projection back from Geographic to Mercator is working, at least not for texels between the vertices (try wireframe mode in Cesium Inspector to see this).

emackey commented 8 years ago

You can just barely see in the wireframe version, but the Northern coast of Greenland shifts a noticable amount here. The same is happening in the other direction near the South Pole. I'm suspicious that the polar "caps" are playing a role here too.

badmercator_wireframe

cfickler commented 8 years ago

Could this be related to the issue I am seeing with stretching of the map when the height of the canvas exceeds the width of the canvas, you are viewing the full world and you zoom out using the mouse scroll ? This is not a polar problem either as you can rotate the map 90 degress and watch is stretch east and west. Also, slightly changing the size of the canvas (via the window) sets it back to what you would expect. This seems to happen in both Web Mercator and WGS84

Stretched Map image

After slightly changing the window size image

mramato commented 8 years ago

@cfickler , I think what you are seeing is an unrelated issue, so I submitted #3346 for it.