2D View / 3D View - distortion in x

Hi,

following question - changing mode from 3d in 2d (orthogonal) I see a distortion in x onthe screen. It is bigger than in y - can anyone explain that.

the screenshot shows 2 viewer, with the same camera position and orientation in 2D and 3D mode !

See also sandcastle - sync views

Rüdiger

Hi @Ruediger_Brand,

My guess is that this is the nature of the 2D mode. While 2D mode displays world imagery on a flat surface, the 3D mode displays the same imagery on a curved surface, i.e. the globe. As a result, there will be differences between their appearances.

Let me know if I can help with anything else!

Best,
Janine

Hi Janine,

i think a little bit distortion is ok, but from my point of view it seems, that I have only distortion in x and that it is a lot !

Other question - I thought changing from 3d in 2d changes to orthographic frustum - but i see in debug, that I have a orthographicofffrustum - what is the difference. I have the impression, that the aspect ratio changes a lot.

Rüdiger

Hi @Ruediger_Brand,

Are you talking about OrthographicOffCenterFrustum? Both the OrthographicOffCenterFrustum and OrthographicFrustum classes achieve the same thing. OrthographicOffCenterFrustum is lower level and defines the frustum by its six planes, whereas OrthographicFrustum takes a width / aspect-ratio and converts that to the six planes. The OrthographicFrustum uses an OrthographicOffCenterFrustum internally.

Best,
Janine

@Ruediger_Brand,

A member of the Cesium team suggested switching to Web Mercator projection in 2D. There is some inherent skew when Bing Maps’ imagery, which is natively Web Mercator, is projected into Geographic (the default). Here is a sandcastle that demonstrates the difference.

Hope this helps!

Best,
Janine

Hi Janine,

good tip with mapProjection - I will try it.

Rüdiger

Hi Janine,

another question concerning the sync - the zoom in the 2D and 3D is different - what is the cause of this.

Is itcaused by, that 2D handles height as height above ground and 3D handles height as ellipsoidal height ?

Rüdiger

Hi @Ruediger_Brand,

I’m not sure what do you mean by the zoom in 2D vs. 3D being different. But in the Sandcastle, the zoom of the 2D map is controlled by this block of code:

// Given the pixel in the center, get the world position
  var newWorldPosition = view3D.scene.camera.pickEllipsoid(viewCenter);
  if (Cesium.defined(newWorldPosition)) {
    worldPosition = newWorldPosition;
  }
  distance = Cesium.Cartesian3.distance(
    worldPosition,
    view3D.scene.camera.positionWC
  );
  // Tell the 2D camera to look at the point of focus. The distance controls how zoomed in the 2D view is
  // (try replacing `distance` in the line below with `1e7`. The view will still sync, but will have a constant zoom)
  view2D.scene.camera.lookAt(
    worldPosition,
    new Cesium.Cartesian3(0.0, 0.0, distance)
  );

Cartesian3.distance calculates the same whether the map is in 2D or 3D mode, so the height of the camera above both modes is the same. It may look different simply because in 3D we zoom in on an actual globe, and in 2D we’re zooming in on a plane.

Best,
Janine


Hi Janine,

you can see the difference in zoom in the attached screenshot. If you zoom in the difference would be bigger - see the lakes !

Rüdiger

Hi @Ruediger_Brand ,

I think you forgot to add mapProjection : new Cesium.WebMercatorProjection() to options2D, which I suggested in an earlier reply. This will eliminate more of the distortion that you get from the default projection.

Best,
Janine

this is worse the other solution !

Nothing to do with distortion !

Hi @Ruediger_Brand,

I mentioned distortion because in your first image (without Mercator projection), the zoom is basically the same, but the lakes are distorted horizontally. This was the issue that you brought up when you first created this post. In order to account for that distortion, you would have to switch projections.

This does mean that the distance from the map results in different zoom for both views. You could artificially scale the distance that the 2D map zooms so that it’s more aligned with the image of the 3D globe. For example, I modified the lookAt function to result in this line of code:

 view2D.scene.camera.lookAt(
    worldPosition,
    new Cesium.Cartesian3(0.0, 0.0, 1.5 * distance)
  );

and now I have a much closer view.

Here’s the modified sandcastle.

Best,
Janine

this looks very experimentally - does this work in all “scales” or zoom levels ?

Can I calculate the factor 1.5 ?


In the screen you can see that this faktor doesn’t help very much !

It seems that it depends on the position on the earth, maybe it depends on the position of the latitude

Hi @Ruediger_Brand,

Unfortunately I have no answer off of the top of my head. If I find a solution I’ll respond with an update. In the mean time, if any community members or Cesium developers have suggestions, they’re welcome to share!

Best,
Janine