CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
13.03k stars 3.51k forks source link

Polylines slice through 3D Tiles rather than draping over them #7453

Open lilleyse opened 5 years ago

lilleyse commented 5 years ago

When clamping a polyline to 3D Tiles it slices through the mesh rather than draping over the topmost surface. This is a limitation of the way ground polylines are rendered.

image

lilleyse commented 5 years ago

This also applies to ground primitives on 3D Tiles but might actually be the desired look:

ground

OmarShehata commented 4 years ago

The use case here is being able to draw lines on vertical surfaces. I just got this request over email. It works fine on top of the building:

image

But if you want to draw a line that goes over the 2nd floor windows it colors the entire vertical surface:

image

hpinkos commented 4 years ago

@OmarShehata are you trying to use a GroundPrimitive? You would need to use a non-clamped polyline to draw on a vertical surface.

OmarShehata commented 4 years ago

Thanks @hpinkos . You're right, I was setting clampToGround: true there. This should be sufficient for this use case, you'd just have to be careful not to draw the line exactly on the surface so it doesn't clip through it, or perhaps use a depthFailMaterial. So what isn't supported is specifically clamping lines to vertical surfaces.

Sandcastle I used for testing for future reference.

schmidtk commented 4 years ago

@hpinkos I came across this issue rendering OSM building footprints along with the OSM Buildings 3D tile layer. Our footprints are rendered as clamped polylines, and it appears clamped lines that parallel the edge of a 3D tile influence how the surface of the 3D tile is rendered.

Sandcastle Demo

In this demo, I have added a clamped polyline that outlines a building from the OSM Buildings 3D tile layer. The end result is a red building, but I would expect a red outline around the base of the building.

Screen Shot 2020-10-12 at 11 32 30 AM

Is this expected behavior?

OmarShehata commented 4 years ago

@schmidtk this does appear to be the same bug. Easiest workaround would be to set clampToGround: false and sample the terrain height at each point along the polyline to place the outline on the ground "manually" that way. Feel free to post on the community forum (https://community.cesium.com/) if you're having trouble with this so we can move the discussion about workarounds to this specific use case there.

jiunuan commented 3 years ago

What should I do if I encounter a rock protruding horizontally when drawing a polyline on 3dtiles, here I set clampToGround to true 1626860576418013552

In fact, I just want to cross the line formed by these green balls and stick to the rock

Lafeu-p commented 8 months ago

Hello, is there any follow-up to this question? Is there any way to fix this

ggetz commented 8 months ago

Hi @Lafeu-p, there hasn't been any activity on this item recently. Likely we would need to change our overall approach to draping polylines.

If you'd like to add more information about your use case, that may help us prioritize. If you are interesting in contributing, please let us know and we'd be happy to discuss implementation or review a PR. Thanks!