Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

RenderTexture black background instead of transparency in Player

Discussion in 'Universal Render Pipeline' started by BonneCW, Mar 7, 2020.

  1. BonneCW

    BonneCW

    Joined:
    Jan 22, 2017
    Posts:
    81
    Hey there,

    I have a problem with a RenderTexture in my game. For the vehicle selection I render the currently selected vehicle to a RenderTexture. The camera is set to solid color with black color + alpha set to 0 (so completely transparent).
    This works in editor as you can see here:
    RenderTextureUI_Editor.PNG

    When I export the Windows Player, the background becomes black though:
    RenderTextureUI_Player.png

    The settings of my RenderTexture are:
    RenderTextureSettings.PNG

    I use LWRP 6.9.2 in Unity 2019.2.21.

    I tried to set Opaque Texture of this camera to Off, but it didn't change anything.

    Is it a bug or am I missing some setting?

    Hope someone can help with this issue.
     
  2. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    226
    There was some bugs for this fixed in URP 7.1.1

    Out of interest are you rendering HDR on the pipeline asset? Also try disabling MSAA. If either of these things fix it then it will be wise to upgrade to URP and into 7.1.1 or later, since LWRP will not be getting anymore backports of bug fixes but URP will be supported for the next few years on 19LTS.
     
  3. BonneCW

    BonneCW

    Joined:
    Jan 22, 2017
    Posts:
    81
    Yes, HDR is enabled. I tried with both disabled in the pipeline settings and it kinda works... rendered object now is half transparent, but at least the background is completely transparent.
    Didn't upgrade to 2019.3 yet because of the state of 2019.3. Tried it two weeks for a few hours out of interest, but my hybrid renderer stuff wasn't displayed anymore and I had some new physics bugs, so I stopped and focussed on the game for now. But maybe I can spend an hour tomorrow and check whether this issue is fixed there.

    EDIT: Tried in 2019.3.5 with URP, but can't export a Player due to some il2cpp error (seems to be same error as here: https://forum.unity.com/threads/build-error-failed-running-il2cpp-exe.842587/). Will test when export works again.
     
    Last edited: Mar 15, 2020
  4. BonneCW

    BonneCW

    Joined:
    Jan 22, 2017
    Posts:
    81
    Tested with 2019.3.7 now and I can confirm that it works there!
     
  5. JimmyCushnie

    JimmyCushnie

    Joined:
    Jun 7, 2017
    Posts:
    134
    I can't get this to work in 2019.3.8f1 with URP 7.3.1. The rendertexture has a transparent background if the camera has SMAA/post processing off, but if I turn it on the background is opaque.
     
    MrXo likes this.
unityunity