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

Polylines (and other geometry?) created in 2D no longer cull correctly in 3D #8653

Open
mramato opened this issue Mar 2, 2020 · 2 comments

Comments

@mramato
Copy link
Contributor

mramato commented Mar 2, 2020

  1. Run the materials demo: http://localhost:8080/Apps/Sandcastle/index.html?src=Materials.html&label=All
  2. Switch to 2D.
  3. Select Polyline Arrow from the bottom combo box.
  4. Switch to 3D
  5. The polyline will be drawn even when it is behind the ellipsoid (it does disappear at some point when it's completely on the other side of the center of the earth)

image

@TJKoury
Copy link
Contributor

TJKoury commented Mar 11, 2020

This is not just an issue with ground polygons, I'm seeing this in 3D with points (and polylines).

@IanLilleyT
Copy link
Contributor

IanLilleyT commented May 17, 2020

The problem is depth test is being permanently turned off for the primitive after creating it in 2D. Depth test should be turned back on when going back to 3D, but it's not.

Left is when creating the polyline in 2D, Right is when creating it in 3D first:
Screen Shot 2020-05-17 at 1 22 24 AM

Looking deeper, the OIT derived translucent command creates its render state from the derived log depth command, and so if the polyline was created in 2D mode, it forever inherits the depth test off property.

cesium/Source/Scene/OIT.js

Lines 563 to 566 in d07271e

result.translucentCommand = DrawCommand.shallowClone(
command,
result.translucentCommand
);
and
result.translucentCommand.renderState = translucentRenderState;
are the culprits.

In subsequent renders, it copies the log depth command render state in the first code block but reverts it back to its original state in the second.

Not sure where to go from here though as I'm not very familiar with these systems.

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

No branches or pull requests

3 participants