Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Globe incorrectly occludes things behind it when using smaller ellipsoid #8683

Closed
OmarShehata opened this issue Mar 16, 2020 · 10 comments · Fixed by #8684
Closed

Globe incorrectly occludes things behind it when using smaller ellipsoid #8683

OmarShehata opened this issue Mar 16, 2020 · 10 comments · Fixed by #8684

Comments

@OmarShehata
Copy link
Contributor

OmarShehata commented Mar 16, 2020

When using a smaller Ellipsoid, the globe incorrectly occludes entities behind it. Sandcastle example.

It almost seems like there's a rectangle around the globe that occludes entities behind it:

occlusion

The effect disappears if you set the radius up to Earth-size (comment out the second line in the Sandcastle).

This came up in this forum thread where the use case was visualizing different planets.

@OmarShehata
Copy link
Contributor Author

It's definitely coming from the globe, since removing the globe entirely (with globe: false) fixes it. But setting viewer.scene.globe.show = false does not fix it.

@lilleyse
Copy link
Contributor

Maybe depth plane related? What happens if this line is commented out:

depthPlane.execute(context, passState);

@OmarShehata
Copy link
Contributor Author

That sounds right, commenting that out makes nothing be occluded here:

image

It looks like DepthPlane.js is getting the ellipsoid from frameState.mapProjection.ellipsoid, but for whatever reason it's producing this incorrect approximation for smaller ellipsoids?

@lilleyse
Copy link
Contributor

The problem is czm_ellipsoidInverseRadii is hardcoded to WGS84. DepthPlaneFS.glsl uses it. Instead czm_ellipsoidInverseRadii should be based on the actual ellipsoid in use.

@lilleyse
Copy link
Contributor

Same with czm_ellipsoidRadii. They should both be added to AutomaticUniforms instead of hardcoded.

@mramato
Copy link
Contributor

mramato commented Mar 16, 2020

Also, if you really want to modify the ellipsoid in Cesium, you are probably better off doing:

Cesium.Ellipsoid.WGS84 = new Cesium.Ellipsoid(radius, radius, radius);

before you do anything Cesium related. That's currently the only way to ensure that all data and calculations actually use the custom ellipsoid (such as loading entities that require ellipsoid-based conversions).

@OmarShehata
Copy link
Contributor Author

Thanks @mramato . That was the first thing I tried here. I added a link to the the forum discussion where this came up in the OP.

@lilleyse
Copy link
Contributor

@OmarShehata I'll submit a PR with the czm_ellipsoidRadii / czm_ellipsoidInverseRadii fix

@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!topic/cesium-dev/pDezVst5b_I

If this issue affects any of these threads, please post a comment like the following:

The issue at #8683 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants