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

Transparent Canvas with URP

Discussion in 'Web' started by rogueyoshi, Sep 16, 2020.

  1. rogueyoshi

    rogueyoshi

    Joined:
    Sep 8, 2018
    Posts:
    13
    I'm trying to get a transparent background/canvas using WebGL + URP. I've tried the recommendation to set the clear color (and Color Space to Gamma), changing Camera Background Color, and changing <html>/<body>/<canvas> Background Color.

    I've heard that post-processing may be the reason why. Can we get an official answer?

    EDIT: Disabled post-processing via the Post-process Volume and MainCamera...

    DisablePostProcessing.cs
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Rendering.Universal;
    3.  
    4. [RequireComponent(typeof(Camera))]
    5. [RequireComponent(typeof(UniversalAdditionalCameraData))]
    6. public class DisablePostProcessing : MonoBehaviour
    7. {
    8.     void Awake()
    9.     {
    10.         var universalAdditionalCameraData = GetComponent<UniversalAdditionalCameraData>() as UniversalAdditionalCameraData;
    11.         universalAdditionalCameraData.renderPostProcessing = false;
    12.     }
    13. }
    14.  
    ...and still doesn't work.
     
    Last edited: Sep 16, 2020
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Hi @rogueyoshi . Are you still having the issue? Does the code work on when building for other platforms? Which Unity version are you using?

    If you are still having the problem, and it is something that works in Editor and other native platforms, a minimal test case bug report would be much appreciated!
     
  3. safetim

    safetim

    Joined:
    Mar 23, 2020
    Posts:
    1
    I've had a similar problem, the code snippet by @rogueyoshi solved it for me. The only issue is, that partly transparent objects are not rendered unless they are in front of a solid object. Is there any solution for this?
     
  4. zhifeng

    zhifeng

    Joined:
    Nov 30, 2012
    Posts:
    3
    After the urp rendering pipeline releases the webgl, the transparency of the canvas conflicts with the post processing, that is, the canvas background cannot have later post processing the transparency, and if the canvas background is not transparent.
    How can I solve the problem