How to draw polygon and polyline on the ground when Translucency enabled?

I get this error when Translucency enabled : Draw polygon and polyline under ground but not showing above ground, is there any way to fix that? below is my example error code in sandcastle

upppppp, help me please

Hi @MrSimple

Could you describe the exact behavior you’re looking for here? Are you trying to drop points under the ground and have them display on the surface?

I want to create an underground model and I want to be able to draw polygons on the ground, but currently I am getting an error to draw polygons displayed on the ground.

when i turn on
Translucency, the polygon goes through the ground, but when I turn it off and draw, the polygon floats on the ground

upppppp

Hi there,

There are too many unknowns in your request here, really. But the short version is that once you set the ground to transparent, it’s no longer “the ground” in terms of picking / and or clamping, etc. So, maybe explain how you’re drawing the polylines? Are you using pickPosition? You may have to rewrite to use your own picker using rays, and some clever turn on and off.

The cheaper version is to turn transparency off while drawing, and turn it on again when you’re done. Also, we don’t know what error you’re getting from drawing on a transparent globe, but my guess is that the picker / pickPosition() is out of bounds (because it’s really hitting outer space).

Anyway, more details would be nice, including what error you’re getting. I tried your Sandcastle, and I could draw lines with it, however, because of the near transparency the lines are actually drawn on the other side of the globe. I think you’re trying to do the following;

  1. Globe is transparent
  2. Draw on the transparent surface

If yes, then the normal picker won’t help you (as it picks on the back of the globe on the other side), but look at viewer.camera.pickEllipsoid(incoming_position); if that might override the transparency. Otherwise, let’s look at ray pickers Let us know.

Cheers,

Alex

1 Like

thank you for your support, you said what i mean, i try to draw on the transparent surface but it penetrates and shows up on the other side of the globe, it just work when i turn off transparency

i had used viewer.camera.pickEllipsoid(incoming_position) and it worked