Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question UniversalRenderPipeline.RenderSingleCamera throws errors when using CameraStack

Discussion in 'Universal Render Pipeline' started by Lekret, May 20, 2023.

  1. Lekret

    Lekret

    Joined:
    Sep 10, 2020
    Posts:
    342
    I have PortalCamera with Camera script which is intentionally disabled and renders through code with RenderSingleCamera. I go through all visible portals in loop, set camera position to portal exit and do rendering.
    Everything worked fine, but then I needed to remove post-processing from all UI elements, create child UiCamera with type Overlay which renders UI layer only and excluded UI from MainCamera.
    After that my PortalCamera stopped working, rendering breakes, and I have errors on console:

    A multisampled texture being bound to a non-multisampled sampler. Disabling in order to avoid undefined behavior. Please use Texture2DMS in the shader.

    A non-multisampled texture being bound to a multisampled sampler. Disabling in order to avoid undefined behavior. Please enable the bindMS flag on the texture.

    Dimensions of color surface does not match dimensions of depth surface


    If I disable UiCamera everything works fine, if I disable MeshRenderers with RenderTexture everything works fine too. I also tried adding bindMS = true in RenderTexture which I create in code, but it doesn't make any difference.

    My camera setup:
    upload_2023-5-20_12-49-38.png

    upload_2023-5-20_12-49-48.png

    upload_2023-5-20_12-50-12.png

    upload_2023-5-20_12-50-24.png
     
  2. Lekret

    Lekret

    Joined:
    Sep 10, 2020
    Posts:
    342
    Ok, I did some refactoring in PortalCamera code and noticed that I use:

    RenderPipeline.beginCameraRendering += UpdateCamera;


    So yeah, I rendered PortalCamera two times, one for MainCamera, one for UiCamera.
    Now I simply check if current rendering camera is MainCamera else return.