Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Help with Transparency in Render Feature

Discussion in 'Universal Render Pipeline' started by LW, Apr 9, 2020.

  1. LW

    LW

    Joined:
    Jun 23, 2013
    Posts:
    22
    I could use some help getting a RenderFeature to work with transparency.
    I can't seem to figure it out.

    I'm trying to:

    - Render a sphere with a transparent material
    - In a separate RenderFeature
    - Unity 2019.3.7f1
    - URP 7.3.1

    Could really use a push in the right direct. Nothing seems to function for me.

    Thanks,
     
  2. erikabar

    erikabar

    Unity Technologies

    Joined:
    Jan 26, 2017
    Posts:
    36
    hi @LW! Is this something you want to achieve?

    My setup:
    1. The sphere itself has a "sphere" layer, material doesn't matter because we will override it with the Renderer Feature:


    2. In your Forward Renderer, remove the "sphere" layer from Opaque Layer Mask (otherwise the sphere will be rendered twice when we will add the renderer feature). Add a new "Render Objects" Renderer Feature, change the event to "After Rendering Transparents" (or leave "After Rendering Opaques" if you are not rendering Skybox ), set the Layer Mask to "sphere" and set your transparent material override :)


    Let me know if that helps.
     

    Attached Files:

  3. LW

    LW

    Joined:
    Jun 23, 2013
    Posts:
    22
    Hi Erikabar,

    Thank you for that!

    I downloaded the fps demo you guys have:
    https://learn.unity.com/tutorial/custom-render-passes-with-urp#5ddc3f73edbc2a001ff7d6bc
    ... and was able to see the same thing that you're doing.

    The important piece (which you showcase above) is that I needed to use the Opaque queue that the sphere was in previously.

    I very much appreciate the help!

    -Lee
     
    erikabar likes this.
  4. Jess_AA

    Jess_AA

    Joined:
    May 8, 2019
    Posts:
    38
    Hi @erikabar,

    This is exactly the solution I was looking for to solve an issue I was having, so thanks! My only problem is that I want to override the material with a different material depending on the asset I have loaded, and at the moment any asset on the sphere layer gets the material in the override slot, which isn't always correct. I feel like there should be a more efficient way of doing it other than creating a render object and layer for every transparent object and then assigning the material that way. Any advice?
     
    JakobAnarkyLabs likes this.
  5. steve7987

    steve7987

    Joined:
    Aug 28, 2019
    Posts:
    6
    I've been having the same dilemma. I have some objects I want to adjust the transparency of, but the objects use different materials, so it won't look good to assign them all the same one in the render feature.