Hi,
i have a line which goes through a mountain - is it possible to draw the whole line, i.e. the part in the mountain with a different color ?
Rüdiger
Hi,
i have a line which goes through a mountain - is it possible to draw the whole line, i.e. the part in the mountain with a different color ?
Rüdiger
Hi @Ruediger_Brand.
One simple workaround would be to use three lines rather than one. The middle line segment would go through the mountain and could be colored differently than the other two segments. I think this would likely be the easiest solution.
Best,
Sam
But in which way do I get the line-segments ?
I would like to achieve something like in the screenshot:
Rüdiger
Hi @Ruediger_Brand,
you could use the depthFailMaterial for that. It just dont work with dynamic polylines.
Look at this code snippet. You can use a simple color or, as I did, some other stuff like a dashed line.
let entity = viewer.entities.add({
polyline: {
positions: [Cesium.Cartesian3.fromDegrees(point1.lon, point1.lat, point1.height), Cesium.Cartesian3.fromDegrees(point2.lon, point2.lat, point2.height)],
width: 2.0,
material: color,
depthFailMaterial: new Cesium.PolylineDashMaterialProperty({
color: color
})
}
});
Best, Lennart
I would do something like this;
material: new Cesium.PolylineOutlineMaterialProperty({
color: color,
outlineColor: Cesium.Color.LIGHTGREY.withAlpha(0.4)
}),
depthFailMaterial: new Cesium.PolylineOutlineMaterialProperty({
color: Cesium.Color.LIGHTGREY.withAlpha(0.4),
outlineColor: Cesium.Color.LIGHTGREY.withAlpha(0.4)
}),
Adjust as you like.
Cheers,
Alex
@sam.rothstein @Alexander_Johannesen @lennart.imberg
This is a great idea, I have to try, first experiences are super
former solution:
new
Great
Rüdiger
@Alexander_Johannesen
Is it possible to get all depthFailMaterial line segments which is under the ground?
I mean is it possible to find all line information which in falling under the ground of the terrain (like failed line positions).
Thanks in Advance
You mean like a query for all lines where a portion or whole is under the terrain? If so, I don’t know how to do that without sampling or knowing the terrain and testing lines against it (old-school and a lot of work), but there might be ways to write some low-level code against the renderer, as those depthFailMaterials already do this, and then flagging items accordingly. However, I’m not that savvy when it comes to this stuff, but Cesium is open-source so I would poke my head in the code and see if there’s anything obvious you can hang on to. Anyone?
Cheers,
Alex
@Alexander_Johannesen
I’m willing the same result.
Please late me know if you find something.
Cheers,
Shashi