Weird artifact when drawing immediate mode lines over instanced geometry

Avatar
  • updated

Image 573

Unity 2021.2.11f

The tourqouise circles is made of line segments that are drawn with the immediate mode API (as a workaround for https://shapes.userecho.com/en/communities/1/topics/325-hdrp-single-pass-instanced-rendering-not-working?page=1#comment-1151 apparently lines work?). The red/yellow/purple background are boxes that are drawn with  Graphics.DrawMeshInstancedIndirect. The geometry is physically behind the line, but either gets rendered in front of the line or this weird pixelated/dithered effect appears.

This screenshot is not from a VR session, though the problem is the same for VR.

I suspect this has something to do with depth sorting and I fear there might not be an easy workaround, but I would be happy for any input.

Reporting a bug? please specify Unity version:
Unity 2021.2.11f
Reporting a bug? please specify Shapes version:
4.1.3
Reporting a bug? please specify Render Pipeline:
HDRP
Avatar
Freya Holmér creator

looks like standard Z-fighting to me! they're simply at the same depth, and making them not be on the same depth (or use some other blend mode than opaque) should solve it

Avatar
l erp
Quote from Freya Holmér

looks like standard Z-fighting to me! they're simply at the same depth, and making them not be on the same depth (or use some other blend mode than opaque) should solve it

Fiddling with the blend settings, seems to indeed have fixed it, thanks!