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

There is a possibility of throw an error in a frame when continuously modifying the clipping planes and picking #11410

Open
PolanZ opened this issue Jul 10, 2023 · 8 comments

Comments

@PolanZ
Copy link

PolanZ commented Jul 10, 2023

Hi, I found the clippingPlanes changed, There may be a possibility of encountering an error in a frame when the picking.

I created a sample, please see Sandcastle Example

throw error when the mouse pick the 3dtiles.

Recently, I discovered that the texture on the clipping plane was missing during debugging. This occurred because it was executed during the "Cesium3DTileset.prototype.prePassesUpdate" phase, and it may not have been executed when picking.

related #8824

@ggetz
Copy link
Contributor

ggetz commented Jul 14, 2023

Hi @PolanZ,

I'm a bit confused why this is an issue.

I noticed you're using setInterval and re-assigning the clipping planes every millisecond. The issue goes away if you use setTimeout to only set the clipping planes once.

I'm not sure if this is anything different than #8824?

@ggetz ggetz added the needs feedback On hold until additional info is supplied label Jul 14, 2023
@PolanZ
Copy link
Author

PolanZ commented Jul 17, 2023

@ggetz Because, If I need to perform both drawing and picking simultaneously, it requires constant updates of new clipping planes. This can lead to errors in certain frames.

use setInterval , It can quickly highlight the problem.

@ggetz ggetz added category - 3d tiles type - bug and removed needs feedback On hold until additional info is supplied labels Jul 21, 2023
@saadatali48
Copy link

Hi @PolanZ,
Any luck with finding any work around for this bug? I am facing the same issue

@3DGISKing
Copy link

I also found this
you can reproduce with this Sandcastle

@ggetz
Copy link
Contributor

ggetz commented Jan 22, 2024

Also reported in #11779

@lilleyse
Copy link
Contributor

It seems like what's happening is the clipping collection is being created between the render pass and the pick pass, which is a problem because the clipping plane is normally initialized in the render pass (which callsprePassesUpdate). The browser must be resolving setInterval before the move event.

A workaround is to use view.scene.preUpdate instead of setInterval to ensure the correct execution order. Here's a sandcastle example.

// test loop refresh clipping planes
viewer.scene.preUpdate.addEventListener(function () {
  tileset.clippingPlanes = new Cesium.ClippingPlaneCollection({
    planes: [
      new Cesium.ClippingPlane(
        new Cesium.Cartesian3(0.0, 0.0, -1.0),
        0.0
      ),
    ],
  });
});

@PolanZ
Copy link
Author

PolanZ commented May 24, 2024

@lilleyse Hi, you can take a look at this example sandcastle,

let you zoom to refresh the 3DTiles and then switch the clipping planes, there will be throw an error.

@syitut
Copy link

syitut commented Nov 10, 2024

@PolanZ @ggetz Has the problem been solved?

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

7 participants
@lilleyse @ggetz @PolanZ @3DGISKing @saadatali48 @syitut and others