I’d like to apply a NearFarScalar to the width of a polyline, so that it appears thinner from far away.
I see in sandcastle examples that NearFarScalars are only applied to properties that have ‘ByDistance’ in their name, so I assumed this does not work on ‘regular’ properties such as width, and indeed it doesn’t seem to have any effect. Next, I experimented with using a callback property returning a NearFarScalar, but that doesn’t have any effect on the displayed polyline width either.
Is it at all possible to vary the polyline width by it’s distance to the camera in any way?
Perhaps I can set up a CallbackProperty that takes the camera distance in account, but I don’t know how to get a reference to that distance inside the callback function.
Any help is greatly appreciated.
Hello Mark,
I am having the exact same questioning. Did you have any progress on this subject ?
Regards
Hi Jerome,
Sadly no, I haven’t found any way to vary the line width by distance as yet. Maybe we should enter a feature request.
I can imagine it to be more complex than with points and billboards, as a polyline can be of arbitrary length and the distance to the camera can vary considerably over it’s entire span.
Thank you Mark !
I guess this should be treated at a custom shader level… But that’s far from my competencies !
Best regards
Jerome
Hi again Mark !
I’ve played around with custom appearance and fabrics (https://github.com/CesiumGS/cesium/wiki/Fabric) and found a way to achieve dynamic polyline width.
Here’s the sandcastle
It’s probably not perfect (needs a barycenter) but can be improved.
Hope this helps !
Best regards
Hi @jerome.fayot,
Sorry, I haven’t been working on this issue for quite some time. I’ll have a look asap.
Hi @jerome.fayot
Looks impressive to me, and seems to work well! I was wondering though: I see you currently have the coordinates hard coded in the material uniform for calculating the barycenter of the polyline. I wonder whether it would be doable to somehow read the coordinates of the polyline instance from inside the uniform.
Since I have to display many polylines (hundreds) simultaneously in my application, I also wonder what the performance would be like in such a scenario.
It’s all a little over my head actually, I may try diving into it when I have time, but so far the (regular) display of polylines has not lead to any complaints, which is why this issue has become low priority for me.
@jerome.fayot polyline is not rendering in version 1.127. ? Removing custom shader it worked.
A lot of things have changed since two years. My sandcastle probably needs a rework. Tell me if you’re interested in an up to date version
Thank you very much. @jerome.fayot. I’m targeting to achieve larping behavior. Any wisdom words on it ?
What do you mean exactly by larping? Is it some kind of treasure hunt?
I want the line to be of the same size on the zoom out. Means, it should not increase the width on zoom out. for now we have certain point to stop size change. It should not readjust the size on any zoom change.
I’m not sure to clearly understand. Is it what you’re looking for?
Sandcastle
1 Like
Exactly the behavior of corridors. As zoom out the never change the size.
@jerome.fayot I need the corridors but with custom shader with texture orientation control based on direction. Like this thread Texture mapping goes wrong when corridor height is not set