popcron / gizmos

Used for drawing runtime gizmos in builds and editor (Unity3D)
MIT License
549 stars 43 forks source link

Conflict with Graphic.DrawMeshInstancedProcedural #24

Closed Reguluz closed 3 years ago

Reguluz commented 3 years ago

I have write a plugin to show waveforms of audioclips in scene by using compute buffer and DrawMeshInstancedProcedural function. And I use your gizmos drawing plugin at same time. Then I found that your gizmos may not rendered correctly on Game View while the waveforms are rendering. image When the bounds of waveforms is out of field of vision, then the gizmos can rendered correctly. I can't find the reason. Besides, I have used two compute buffers to calculate waveforms. At the beginning I wonder if it is because the compute buffers are on conflict. But I found that the gizmos can be rendered correctly while I just removed the line of Graphic.DrawMeshInstancedProcedural() but keep buffers delivering their data.

Reguluz commented 3 years ago

And I'm using urp7.3.1

popcron commented 3 years ago

Can you try inserting the following line at line 316 in GizmosInstance.cs?

GL.PushMatrix();
GL.MultMatrix(transform.localToWorldMatrix); // <--- this one
GL.Being(GL.LINES);

I believe this issue is caused by the Graphics API not pushing and popping their projection matrix, if this hotfix works for you will push the fix to master.

Reguluz commented 3 years ago

Yeah! It solved, thanks for your help.