unitycoder / UnityPointCloudViewer

Point Cloud Viewer and Tools for Unity
https://assetstore.unity.com/packages/tools/utilities/point-cloud-viewer-and-tools-16019?aid=1101lGti
128 stars 15 forks source link

UI World Canvas #125

Open slacker-jake opened 2 years ago

slacker-jake commented 2 years ago

Hi,

Thank you for your plugin however I have a problem I hope I can have solved. The PointCloud is rendering fine but as soon as a WorldSpace Canvas with an Image/Text inside the bounds of the MainCamera the position of the point cloud is reset to that Canvas element location.

Have you seen or encountered this?

Thanks, Jake

p.s Running in URP

unitycoder commented 2 years ago

if you can try this, it fixes the issue for me: https://github.com/unitycoder/UnityPointCloudViewer/issues/126

(if you have newer unity version, or urp, let me know which one, if that code doesn't work there)

unitycoder commented 2 years ago

unity confirmed this as a bug also, https://issuetracker.unity3d.com/issues/graphics-dot-drawproceduralnow-from-onrenderobject-breaks-when-worldspace-canvas-is-in-cameras-view

and gave one workaround: "I have noticed that creating a new Universal RP project and reimporting your Assets folder makes the drawing render as intended."

unitycoder commented 2 years ago

unity added more info, that its by design:

After a further resolution with developers, we have decided that this issue is By Design due to the following reasons: The procedural geometry is being rendered after the UI panel so it is using the UI panel's transform, which is by design. The docs for https://docs.unity3d.com/2019.1/Documentation/ScriptReference/Graphics.DrawProceduralNow.html explain "Note that this call executes immediately, similar to Graphics.DrawMeshNow. It uses the currently set render target, transformation matrices and shader pass".

https://docs.unity3d.com/ScriptReference/Graphics.DrawProcedural.html or https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.DrawProcedural.html may be more suitable for this use case.