Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Render Texture Transparency not working anymore in URP (coming from LWRP)

Discussion in '2019.3 Beta' started by FonzieJoe, Sep 23, 2019.

  1. FonzieJoe

    FonzieJoe

    Joined:
    Dec 4, 2017
    Posts:
    5
    Hello,

    I'm developing a game in which I use 3 cameras to render different elements of the scene into 3 different render textures, that later I "merge" with a shader to get the final image (a simple workaround for getting the same result as in camera stacking with the built-in pipeline).

    I've been working in Unity 2019.2.5 with the LWRP and everything seemed to work fine, but as soon as I upgraded the project to the beta version (2019.3.0b) the render textures stopped having transparency.

    The cameras seem to have transparency when I disable the "Render PostProcessing" toggle in the camera inspector, but as soon as I do that I get a "don't clear" effect in which every frame stacks with the previous one.
    if I enable it the alpha channel seems to disappear (everything is white).

    What am I doing wrong? Is this a bug of the new URP?

    Attached there are screenshots of my setup of one of the cameras (the three of them are the same) and of the render textures.

    Thank you in advance.

    image.png image.png
     
  2. richardzzzarnold

    richardzzzarnold

    Joined:
    Aug 2, 2012
    Posts:
    145
    Hi were you able to solve this? I have the exact same problem. I also seem to have a problem if I upgrade from URP 7.0 to 7.1 all my shaders go pink so that is not a viable solution for me
     
  3. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    559
    Just fyi, SRP repo merged a change the other day called camera stacking so that might be very interesting for you.
     
    kennel_ likes this.
  4. DoctorShinobi

    DoctorShinobi

    Joined:
    Oct 5, 2012
    Posts:
    219
    kennel_ likes this.
  5. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231

    The solution for me was to untick the "Render Post-Processing" checkbox :)
     
    ShakeTheAi, ujz, vrp_adamjuva and 7 others like this.
  6. brownbair

    brownbair

    Joined:
    Jul 14, 2016
    Posts:
    12
    Using a background type of "solid color" with an alpha of 0 on the camera rendering to the texture worked for me.
     
    sonofbryce, NTG-Sera and hunter-baun like this.
  7. Aykutkaraca

    Aykutkaraca

    Joined:
    Jan 4, 2018
    Posts:
    33
    I have exactly the same problem. Weird that this hasnt been resolved or not many people complaining about it so far...
     
  8. Aykutkaraca

    Aykutkaraca

    Joined:
    Jan 4, 2018
    Posts:
    33
    If you put the alpha to zero everything disappears, If I make it 1 then the object is transparent but the background is the solid color I choose. Not sure how you made it to work.
     
    ENDAS_ORIGINAL likes this.
  9. FonzieJoe

    FonzieJoe

    Joined:
    Dec 4, 2017
    Posts:
    5
    Yeah that doesn't solve the Issue. I will need post processing sooner or later!

    Thank you for your answer
     
  10. FonzieJoe

    FonzieJoe

    Joined:
    Dec 4, 2017
    Posts:
    5
    I'll take a look at it! Thank you!
     
  11. FonzieJoe

    FonzieJoe

    Joined:
    Dec 4, 2017
    Posts:
    5
    I Ended up taking a different approach and using layer order in order to achieve the desired result. It's not as clean as It would have been by just stacking cameras, but it does the trick until some solution is provided by Unity.

    It looks like they are looking into it https://docs.unity3d.com/Packages/c...l/universalrp-builtin-feature-comparison.html but I cannot afford to put this feature in halt just in hope they give a solution before my scheduled release window.
     
  12. Aykutkaraca

    Aykutkaraca

    Joined:
    Jan 4, 2018
    Posts:
    33
    I have just found a workaround. I choose URP/Particles/Simple Lit for the material of the object in the render texture, and set it to multiply and its alpha to 255.
     
    Last edited: Sep 8, 2020
    Threeyes and xsocomx like this.
  13. FonzieJoe

    FonzieJoe

    Joined:
    Dec 4, 2017
    Posts:
    5
    Sounds neat! Thank you for sharing your progress, I'll look into it :)
     
    Aykutkaraca likes this.
  14. Aykutkaraca

    Aykutkaraca

    Joined:
    Jan 4, 2018
    Posts:
    33
    no problem. I realized when I saw my mesh with Mobile/Particles/Alpha Blended was visible on the texture. So you can use that shader too if you want to make it visible. Dont know why this happens. Must be related to render order or something like that. I really dont understand those shader/render pipeline stuff.
     
  15. xsocomx

    xsocomx

    Joined:
    Apr 18, 2018
    Posts:
    34
    This fixed the problem for me. Thank you :)
     
  16. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,737
    Nice catch!
    Here year of 2022 and Unity still doesn't support RenderTexture transparency properly... smoothly... user friendly...

    Edit : It's actually working in the Scene view, but it draws red alpha in the Game view :D.
     
    Last edited: Jun 13, 2022
  17. Richnflix

    Richnflix

    Joined:
    Jul 15, 2022
    Posts:
    3
    This worked for me ...but want I want post processing as well :(
     
  18. KristofferB

    KristofferB

    Joined:
    Oct 28, 2019
    Posts:
    8
    This is so frustrating. I need post processing but I can't remove the background when post processing is enabled.

    The only "solution" I found is to use camera stacking BUT that doesn't work because my entire UI is build in UI Toolkit, which is ALWAYS rendered on top of ALL the cameras, meaning if I use camera stacking my sprites and such are rendered behind the UI - and if I use a render texture I get a black background.

    Does anyone have a solution?
    **
    Edit:
    I finally caved and just added this with a canvas instead. I was trying to build a whole game with the new UI system but I simply can't solve this part. So if anyone else has the same problem because you are using UI Toolkit, just make a canvas and have a raw image with the rendertexture instead of using UI Toolkit for it. Then you can add a material with the correct alpha (which was what I couldn't figure out how to do on top of a render texture for UI Toolkit)
     
    Last edited: Feb 6, 2023
  19. ShakeTheAi

    ShakeTheAi

    Joined:
    Dec 12, 2018
    Posts:
    19
    dude... this is Gold, literally, just uncheck the post processing.