Drawing complicated shape in scene

Avatar
  • updated
  • Answered

I want to do the mesh outline effect from the gifs. OnPostRender is not giving me what I want because it draws on everything else.

I want the depth test to work correctly.  

Then I thought maybe I can create one gameobject and then just add a bundle of Line components to it. 

But that doesn't work because one object can only have one Shape Renderer. 

So is my only option to create a bunch of gameobjects each with a Line component???

That doesn't sound right. 

The same problem arises when I want to draw a curve since that's just a bunch of lines too. 

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Answered

this has now been fixed in 3.0.0 :)

Avatar
Freya Holmér creator
  • Answer
  • Answered

this has now been fixed in 3.0.0 :)

Avatar
Freya Holmér creator

the issue is that in URP, onPostRender doesn't have the depth buffer intact, and in HDRP onPostRender happens before anything renders, which kinda makes everything really complicated

basically what I'm doing is working on converting immediate mode to have support for command buffers, though, ideally, without having to manage the buffers yourself and still have a very easy drawing system like we have now :)

Avatar
JuDelCo
Quote from Freya Holmér

There are a few things required for depth testing to work out.

1. There's currently an issue in HDRP/URP that prevents depth from being read correctly, so it mostly works correctly in the built-in render pipeline, or in OnDrawGizmos for editor shapes
2. while all blend modes read depth, only Opaque will write to the depth buffer

I'm currently working on fixing the HDRP/URP issues! making good progress, should be fixed in the next update. Until then, components would be the way to go if you're in HDRP/URP

I'm curious xD, what is the approach you are using to fix the problem in URP ?

Avatar
Freya Holmér creator

There are a few things required for depth testing to work out.

1. There's currently an issue in HDRP/URP that prevents depth from being read correctly, so it mostly works correctly in the built-in render pipeline, or in OnDrawGizmos for editor shapes
2. while all blend modes read depth, only Opaque will write to the depth buffer

I'm currently working on fixing the HDRP/URP issues! making good progress, should be fixed in the next update. Until then, components would be the way to go if you're in HDRP/URP