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

Clamp Path to Ground #7133

Open
OmarShehata opened this issue Oct 10, 2018 · 11 comments
Open

Clamp Path to Ground #7133

OmarShehata opened this issue Oct 10, 2018 · 11 comments

Comments

@OmarShehata
Copy link
Contributor

OmarShehata commented Oct 10, 2018

This was requested on the forum, to be able to clamp a Path to the ground, so clamping the path here for example:

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=CZML%20Path.html&label=CZML

Initially I thought this might be trivial, as you'd only need to pass the "clampToGround: true" since the PathGraphics just uses a polyline anyway, but digging a bit into it, it seems like it might not be so straightforward, since a Polyline and a clamped Polyline are two different primitive types?

@mramato
Copy link
Contributor

mramato commented Oct 10, 2018

There are actually 3 different line types in Cesium: Polyline, GroundPolyline, and PolylineCollection. Only PolylineCollection has suitable performance for dynamic polylines and that's what path uses under the hood. In theory we could re-create a GroundPolyline every frame for the path, but it would be unacceptably slow.

@YuHuang89
Copy link

Hi mramato!From my reading of the code, the path uses PolylineCollection underhood, but it interpolates positions, and then still renders a new "polyline" through shader program for every frame.
Why this is fast and ok, while rendering GroundPolyline for every frame will be really slow?

@mramato
Copy link
Contributor

mramato commented Oct 15, 2018

PolylineCollection is a fundamentally different beast than GroundPolyline. While it's true that interpolation happens every frame and new positions get generated, the methods that takes those positions and renders them are vastly different. This is also why PolylineCollection doesn't support features like per-vertex colors.

We definitely want to improve the area of Cesium, but there's no ETA as to when that's going to happen. We've even discussed writing a custom PathPrimitive specifically for this use case.

@YuHuang89
Copy link

PolylineCollection is a fundamentally different beast than GroundPolyline. While it's true that interpolation happens every frame and new positions get generated, the methods that takes those positions and renders them are vastly different. This is also why PolylineCollection doesn't support features like per-vertex colors.

We definitely want to improve the area of Cesium, but there's no ETA as to when that's going to happen. We've even discussed writing a custom PathPrimitive specifically for this use case.

Thank you very much, Mramato!

@jimmyangel
Copy link
Contributor

Hi @mramato, do you have an estimated time frame for when this (clamped path) will be implemented?

Thank you

@hpinkos
Copy link
Contributor

hpinkos commented Nov 26, 2018

@jimmyangel no sorry, this isn't a priority for us right now so I don't think we'll be able to add this feature very soon. Pull requests are always welcome though!

@jimmyangel
Copy link
Contributor

Hi @hpinkos, could you please suggest a viable workaround? I would like to animate a path clamped to the ground -- I tried using polyline segments (in CZML) , but the performance is really bad if I have hundreds/thousands of segments. Any suggestions?

@hpinkos
Copy link
Contributor

hpinkos commented Nov 28, 2018

@jimmyangel sorry, I don't have a good solution other than trying to subsample the line on the server and generate CZML. But like you said, performance might not be great for this. We unfortunately can't change path to use a different polyline type at the moment because the way we draw ground polylines won't be fast enough when the line is constantly changing.

@jpthompson212
Copy link

Any updates on this? It would be extremely useful.

I had a customer trying to draw long ground vehicle paths and thus when exporting czml from STK with sparse point definitions the path disappears through the terrain quite often.

@iLoveBug
Copy link

any update on this? I need to solve the same problem

@OmarShehata
Copy link
Contributor Author

@iLoveBug is your path static? If so, you can sample the height along the points before creating the path to clamp it to the ground (or set it relative to the ground etc). If you have trouble doing this feel free to open a new thread in the community forum: https://community.cesium.com/.

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