Search Unity

Question Pixel Perfect Cropping Distorts Stacked UI Camera

Discussion in 'Universal Render Pipeline' started by Jiaquarium, Oct 18, 2021.

  1. Jiaquarium

    Jiaquarium

    Joined:
    Mar 22, 2020
    Posts:
    45
    For my 2.5D game I am trying to crop to my reference resolution (960x540 36PPU) with Pixel Perfect Camera's YCrop, XCrop and Stretch Fill. I am trying to display UI using stacked cameras. The issue is that when I stack my UI Camera (orthographic) to the Base Camera, with Pixel Perfect Camera's cropping, it stretches the UI.

    This is blocking me because I need a way to get the UI to move with the Pixel Perfect Camera's cropping letterbox and I need it to be not distorted because the UI must be also pixel perfect.

    How to Reproduce:
    1. Make a URP scene with a base Camera with Pixel Perfect. Turn on XCrop, YCrop and Stretch Fill.

    2. Make UI Camera in Overlay mode using Orthographic projection. Stack this to the Base Camera just created.

    3. Make canvas with Image UI. Set to Screen Space - Camera and reference the UI Camera.

    4. The UI will be severely distorted.