Overlapping Closed Polyline Behavior at Join Point (Component-Based)

Avatar
  • updated
  • Not a bug

(FYI This isn't a bug that was introduced by Shapes 3.1.0)

Hi there,

I'm getting some unexpected behavior for overlapping closed polylines at the join point (when the last point joins with the first point). It seems as though it will be occluded by other areas of the polyline, even if its z value is lower.

In the following example, the polyline's hue shifts from red (first point), to green (final point). And the z value goes from 0 -> 0.4, back to 0. My expectation is that the red portion of the polyline would be on top of the violet, but it seems as though only a portion of it is (seems that once we reach the initial point again, the violet portion is on top of the red). Also, I would expect the pink area to be on top of the blue (as well as the teal).

It seems as though a point further down in the list of Points will be on top of others.

Here's this list of points:

Image 301

Here is the render when the camera is pointing forward at z=-10:

Image 302

Here is the render when the camera is pointing back at z=10:

Image 303

Thanks for you time, and thanks for the wonderful asset!

Reporting a bug? please specify Unity version:
2019.4.11f1
Reporting a bug? please specify Shapes version:
3.1.0
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Not a bug

so this is a combination of a few things happening, and it's not a bug unfortunately, it's more a side effect of how rendering works in general

1. The z value is unused when drawing polylines with the flat 2D geometry. I should probably make the Z field grayed out when using Flat 2D geometry to make that more clear!

2. *if* you expected Z to make a difference, then that's, complicated, and would be a whole new type of geometry I'd need to make

3. Even if Z *did* make a difference, transparent blend modes don't write or read to the depth buffer, so what goes on top of what is purely dependent on the order in which the triangles in the mesh are defined (as with any other meshes), which, as you can see, starts and ends at the first point

In 3.1.1 I've now made it so that the Z fields are grayed out when using Flat2D to emphasize that they are unused

Avatar
Freya Holmér creator
  • Answer
  • Not a bug

so this is a combination of a few things happening, and it's not a bug unfortunately, it's more a side effect of how rendering works in general

1. The z value is unused when drawing polylines with the flat 2D geometry. I should probably make the Z field grayed out when using Flat 2D geometry to make that more clear!

2. *if* you expected Z to make a difference, then that's, complicated, and would be a whole new type of geometry I'd need to make

3. Even if Z *did* make a difference, transparent blend modes don't write or read to the depth buffer, so what goes on top of what is purely dependent on the order in which the triangles in the mesh are defined (as with any other meshes), which, as you can see, starts and ends at the first point

In 3.1.1 I've now made it so that the Z fields are grayed out when using Flat2D to emphasize that they are unused

Avatar
SharkWithLasers

Ahh, fair enough!

Just to be clear, will this behavior persist if I were to use Opaque Blend Mode and Billboard geometry (because of the 2nd point you made?)

Thanks!

Avatar
Freya Holmér creator
Quote from SharkWithLasers

Ahh, fair enough!

Just to be clear, will this behavior persist if I were to use Opaque Blend Mode and Billboard geometry (because of the 2nd point you made?)

Thanks!

if you use opaque and billboard, then you will be able to move parts of it behind other parts, without this issue, since it'll read and write to the depth buffer :)

Avatar
SharkWithLasers

Ahh! Fantastic! Billboard + Opaque works great!

One last thing I had to do, was up the MSAA from 2x to 8x however. Aliasing was a lot more noticeable at 2xMSAA for opaque, than for transparent.


(2xMSAA opaque):

(2xMSAA transparent):

Just want to make sure I'm not missing anything else here.


I have "Local AA quality" set to "High" in the settings.


Thanks!

Avatar
Freya Holmér creator
Quote from SharkWithLasers

Ahh! Fantastic! Billboard + Opaque works great!

One last thing I had to do, was up the MSAA from 2x to 8x however. Aliasing was a lot more noticeable at 2xMSAA for opaque, than for transparent.


(2xMSAA opaque):

(2xMSAA transparent):

Just want to make sure I'm not missing anything else here.


I have "Local AA quality" set to "High" in the settings.


Thanks!

this is expected, and is just a reality of how rendering works. if you write to the depth buffer then you can't really have partial transparency anymore, so opaque shapes can't take advantage of MSAA as much as transparent shapes


you can read more about AA in the docs!