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

Sprite Masking in HDRP

Discussion in 'High Definition Render Pipeline' started by mcontino, Mar 5, 2020.

  1. mcontino

    mcontino

    Joined:
    Sep 12, 2017
    Posts:
    2
    Hello,

    I've noticed a different behavior when using Sprite Renderers and Sprite Masks in 3D projects versus HDRP projects. Below are a series of screenshots to highlight the issue.

    Here is a side view of the scene. I have a Sprite Renderer with a Capsule behind it. For simplicity, I have not overlaid the Sprite Mask with the Sprite Renderer.

    Side_View.PNG

    Front View

    Front_View.PNG


    Now, when I go into the Inspector and change the sprite renderer's settings from "Mask Ineraction: None" to "Mask Interaction: Visible Inside Mask," I've observed different behavior depending on whether the project is a 3D project or a HDRP project.

    Setting that changed

    Inspector.PNG

    3D Project Behavior - Image is hidden as expected because there is no overlay with a mask.

    Inside_Mask_No_HDRP.PNG

    HDRP Project Behavior - Image is hidden except for the part that has the object behind it.
    Note - If I move the capsule or the image, the area of the forest that is between the camera and the capsule is what is visible.

    Inside_Mask_HDRP.PNG

    This behavior occurs in both the the scene view and the game view.
    Is there a reason as to why the projects are behaving so differently?
     
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,899
    the stencil buffer. altho it should be cleared before transparents are rendered.
     
  3. mcontino

    mcontino

    Joined:
    Sep 12, 2017
    Posts:
    2
    Thanks larsbertram1. I'm not too familiar with the stencil buffer so, just to be clear, are you saying that Unity should be clearing it but isn't or that I am responsible for clearing it?