Vanishing thickness on Polyline segment coming back to itself

Avatar
  • updated

Hello!

I want to create a segment that comes back to itself. Ignoring z, the coordinates of the three points of this polyline are:

  • (0, 1)
  • (2, 1)
  • (0, 1)

The result is the segment in the screenshot:

Image 328

I don't understand why the segment draws as a single triangle rather than a quad. I imagine this has to do with the join type.

Using rounded joins makes it slightly better, but not exactly what I'm after.

Image 329

The best I've come to is to use Bevel joins with "almost" equal segments:

Image 330

But adding an extra 9 (0.999999) makes it revert to the previous result.

Is this the expected behaviour?

Is there a way to treat these two segments such that they don't vanish at the join point?

Thanks!

Ale

Reporting a bug? please specify Unity version:
2019.4.17f1
Reporting a bug? please specify Shapes version:
3.1.1
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
Ale Cámara

You're totally right - it's relatively easy to change my code to create these dummy points when doing sharp angles. Leaving this screenshot here in case anyone else is interested in what worked for me:

Thanks for your help!

Avatar
Ale Cámara
Quote from Freya Holmér

it's a combination of the polyline mesh generator/topology and how the polyline core.cginc tries to position the vertices based on neighboring positions. 

the easy fix might be to add some extra points right before and right after the 180 degree turn, and use simple joins instead of any other

Ah! I see what you mean. I'll give this a go. Thanks for the help!

Avatar
Freya Holmér creator
Quote from Ale Cámara

I was afraid you'd say so :<

Do you know which bit of code is the one causing this problem? - I may have a go at trying to fix it for my case. Thanks a bunch!

it's a combination of the polyline mesh generator/topology and how the polyline core.cginc tries to position the vertices based on neighboring positions. 

the easy fix might be to add some extra points right before and right after the 180 degree turn, and use simple joins instead of any other

Avatar
Ale Cámara
Quote from Freya Holmér

this is unfortunately expected, and generally a hard problem to solve! same issue as this, but more extreme
https://shapes.userecho.com/en/communities/1/topics/90-polyline-sharp-angle-issue

I was afraid you'd say so :<

Do you know which bit of code is the one causing this problem? - I may have a go at trying to fix it for my case. Thanks a bunch!

Avatar
Freya Holmér creator

this is unfortunately expected, and generally a hard problem to solve! same issue as this, but more extreme
https://shapes.userecho.com/en/communities/1/topics/90-polyline-sharp-angle-issue