Skip to content

Using TextMeshPro causes point cloud to duplicate #137

Open

Description

@Tymiec

For unknown reasons when using TextMeshPro in the scene it causes the point cloud to render two times, presumably once from the main camera as intended and second time from the camera assigned to TextMeshPro even though it is set to be rendered only by MainCamera

also render only main camera in PointCloudViewerTilesDX11 gives an error
NullReferenceException: Object reference not set to an instance of an object unitycodercom_PointCloudBinaryViewer.PointCloudViewerTilesDX11.OnRenderObject () (at Assets/PointCloudTools/PointCloudViewerDX11/Scripts/PointCloudViewerTilesDX11.cs:1022) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Even if you try to workaround the error by coding to use only one camera it still renders using all cameras.

Any suggestions on how to fix that?

Unity 2021.3.1f1

issue

Activity

  1. unitycoder commented on Oct 17, 2022

    @unitycoder
    Owner

    are you using BiRP/URP/HDRP?

  2. Tymiec commented on Oct 17, 2022

    @Tymiec
    Author

    are you using BiRP/URP/HDRP?

    We are using URP

  3. unitycoder commented on Oct 17, 2022

    @unitycoder
    Owner

    ok ill test / check

  4. unitycoder commented on Oct 17, 2022

    @unitycoder
    Owner

    in the meanwhile,

    possibly one workaround:

    • Use this custompass feature URP Support #126
    • add this line there if (renderingData.cameraData.camera.CompareTag("MainCamera") == false) return;
    • image

    info about Camera.current being null in URP
    https://forum.unity.com/threads/camera-current-returns-null-when-calling-it-in-onwillrenderobject-with-universalrp.929880/
    so apparently would have to create helper script to detect, what is current camera,
    and then could feed that into viewer, and exit OnRenderObject early, if not main camera..
    https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@7.4/manual/using-begincamerarendering.html

  5. Tymiec commented on Oct 17, 2022

    @Tymiec
    Author

    Workaround worked but the second camera that is being used for the interface still renders unless you place it outside of render distance.

  6. unitycoder commented on Oct 18, 2022

    @unitycoder
    Owner

    does that happen, even if added that on extra line of code? (i didnt see in camera preview at least)

  7. Tymiec commented on Oct 18, 2022

    @Tymiec
    Author

    does that happen, even if added that on extra line of code? (i didnt see in camera preview at least)

    We focused on URP support and forgot to add the line of code you suggested, now workaround works as intended

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions