cesium
cesium copied to clipboard
scene.sampleHeight cause polygon(clamp to ground) to flicker at top view
What happened?
I want to draw a midpoint between two points, and I expect the point height fit the ground/3dtiles. I first calculate the world position of that point, convert it to cartographic coordinate, then call scene.sampleHeight. When at a top view, the polygon will flicker.It seems that sampleHeight destroy the main render.
https://github.com/CesiumGS/cesium/assets/12868409/56826d83-ff50-4cf2-8878-61f8dd12179e
Reproduction steps
1.Create a polygon and clamp it to ground; 2.Change the camera to a top view; 3.Call scene.sampleHeight; 4.The polygon flicker.
Sandcastle example
https://sandcastle.cesium.com/#c=fVNba9swGP0rIk8OeIou1i1Nw0opW2F0kJW9LHtQHTURUywjKSlp6X+fEse9U7DB0vnOOd/NAABQ+yYmsLXmzgRwChpzB85NtJs1/H24K+aD+nA+903StjFhPhiezJtMBc4k0KLXrHMdUv7SDS2+YI4QriiUvFJKiYryEjBKMJUMSqoEEhhVJaCYoEoiyCjnHDMq6SsD/IkBU0IRDnEW46KqSHUwoIIiKCXChFVS7Q2w4LSCqkKKkwpj9sqAfFoBwVJCxITKUkwd9AllCkoic7aUyU5fSAEZYphyIshLeR32ff3TojKXkl/yd950aNd0aJpkkzUR6sWieOggABq9NmMwH8zMArTe7Za+AfmJm3CrazMflH3gERyDJyoAK2uCDvVqN97bl8/AWicTrHbjp2K98wF+m11cXME7m1Znrl3pIs9i+IJVOx2jvbW1TtY317vWPPPfQfD6YjY7u7zq6Y9Hoce+Kcey771fX/viTRP2QV1YNOmyydlutSuKITidPhe4b2udp+TfD84vg25Xti5w3jrCuZBMMkUQF6wEuSycV0ApRikSAhFSAsIZpJxhzEkOQ6rq0+xsgokbl7LPMc9Ym8bAqNetM9+NXa5SccikZz2WACOEhieDcjCJaefMtJf7atetDwlsgisgHCWTNfI44uhmU/8zCdYx9iqT0UvqZGG3wC5OP/gTu9Fk5Hbj3C97nxdjOhnl+HdU5/XCNsufWxOc3u3DVnj6o7uEEE5G+fgxM3nvbnR4o/wf
Environment
Browser:Chrome CesiumJS Version:1.118 Operating System:Windows 10 x64
Interesting, I'm not able to reproduce on my machine.
Would you mind leaving the Chrome version you're seeing this on? Also, could you please visit webglreport.com and take a screenshot of your results?
Thanks!
@ggetz, I was able to reproduce by using <CTRL><MB1> dragging until view was directly above triangle (Edge Version 125.0.2535.85 (Official build) (64-bit)).
Also in Chrome Version 125.0.6422.142 (Official Build) (64-bit), both on Windows 10.
Thanks @GatorScott! I see the issue know. It looks like it may be an issue with the shadow volumes used for ground primitives.
I experience the same problem, but it instead of flickering it cuts the polygon entirely since I am using it in CallBackProperty / onTick event
Also reported in https://github.com/CesiumGS/cesium/issues/12381 and https://github.com/CesiumGS/cesium/issues/12221
It seems to be an issue where polygon renders first, followed by terrain. Immediately after executing scene.sampleHeight, polygon is not on the surface of terrain. I added a line of code viewer.scene.render(viewer.clock.currentTime); after scene.sampleHeight execution, which temporarily resolved the issue