Search Unity

Question Rendered texture is shown differently in raw image

Discussion in 'UGUI & TextMesh Pro' started by SzalejacyKabelAntenowy, Sep 27, 2020.

  1. SzalejacyKabelAntenowy

    SzalejacyKabelAntenowy

    Joined:
    Aug 26, 2020
    Posts:
    2
    Greetings!

    I'm working with Unity 2019.4.10f.

    What I'm trying to do: A split-screen setting where two cameras (P1, P2) render to raw images (half of the screen each), which are then rendered by third (main) camera to the display. P1 and P2 should render the players, environment and assigned player's part of UI. Main camera's job is to render common UI, like the pause menu that would stretch on entire screen, the content in raw images, and an image element that visually separates the two raw images on the canvas (for example a thin line on top of the images).

    Simplified setting of the above: P1 renders into a render texture which is assigned to raw image on UI canvas element. This canvas is looked at by Main camera, which renders to the display.

    What I expected to see: The image rendered by the P1 camera is exactly the same in the raw image component which the rendered texture is attached to.

    What actually happens: The rendered image shown with use of raw image component is different than the one rendered by P1 camera. Moreover, the same source image rendered as a sprite has different outcome than rendered as an UI Image component. Looking directly at render texture shows that the rendered image is correct, yet it is shown differently in raw image component.

    What I already tried:
    • Configuring the color of the raw image, adding a material to it and tweaking it however I could - did not help, the latter actually made the image stop displaying the content, no matter the configuration.
    • Playing with overlay camera setting - this resulted in main camera inheriting the same viewrect as the one it was assigned to as overlay. Main should be stretched on entire screen.
    • Overlay canvases - these do not seem to be able to render particles. There is a solution for this, but from what i read it's rather resource consuming solution.
    • Source file import settings, compression method and quality, etc. - no effect.
    • Upgrading to most recent LTS version - was working in 9f previously. Did not help.
    Below are several screenshots that present the issue:


    Setting of the P1 camera. Circles config from left to right: Sprite, UI Image, UI Image. The cloudy thing on the left above the circle is a sprite, too.


    Render texture (P1 camera) setting and content.


    Main camera setting. Circles from left to right: Sprite set on main camera canvas (just like the cloudy thing above it), rendered sprite (raw image), 2x rendered UI images (raw image). White line is the visual separator I mentioned earlier and is an image on the main camera canvas.


    Main camera render. Setting as in image above.


    Both canvases settings. Canvases use scalers that have the same reference resolution: 3840x2160.

    All circles have the same rotation.

    Am I missing something? Or is this a bug? Is there perhaps a different solution that would suit my needs?

    Best regards,
    SzalejacyKabelAntenowy
     
  2. SzalejacyKabelAntenowy

    SzalejacyKabelAntenowy

    Joined:
    Aug 26, 2020
    Posts:
    2
    Today I managed to find out what was wrong. Seems like one needs to enable Post-processing in cameras that render to raw images, here P1 and P2. After that all I need is to tweak the rect of the raw images to fit with the textures.
     
    PatSalvatore and Silviul like this.
  3. OceanViewGames

    OceanViewGames

    Joined:
    Dec 26, 2019
    Posts:
    19
    Thanks. I had this exact issue. And setting post processing fixed it.
     
    PatSalvatore likes this.