Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Feature Request Metal on Subsurface

Discussion in 'High Definition Render Pipeline' started by theartbot2023, Dec 29, 2023.

  1. theartbot2023

    theartbot2023

    Joined:
    Dec 29, 2023
    Posts:
    1
    In HDRP doc "Materials and Shader Graphs that use subsurface scattering do not use the Metallic property". But in real world metal on skin is not uncommon, and Cyberpunk 2077 mix metal and skin extensively.
    In blender and unreal, we can use metallic along with subsurface, hope unity can support this functionality.
     
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    707
    By using shadergraph and the "StackLit" material type, you can use subsurface scattering and metallic (as well as other properties) at the same time. It does have an increased cost of the other other material types though.
     
  3. andresfho

    andresfho

    Joined:
    Aug 28, 2023
    Posts:
    2
    Hi Remy, I have tried what you suggested with the StackLit, I'm trying to achieve something similar to the previous image. I have set the shader as StackLit, activated Subsurface Scattering, connected my map into the metallic input (or even changed the float value) but it seems that while the subsurface is active the metallic don't work, could you give me any hint? there is no too much info about a setup like the one I'm looking for.
    Thanks!
     
  4. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    707
    Hi Andres,
    First, I need to apology, I answered previously based on what I remember of what the stack lit shader is supposed to be and do, but after investigating it seems to be an issue on our side that it is not possible to mix SSS and metallic on a single shader, even with stack-lit.

    A workaround would be to render the skin first with SSS and then overlay the metallic part on top of it using an custom pass draw renderers and a masked metallic material.
     
  5. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    935
    Hi,

    just to give extra info in complement of Remy's info

    There is nothing preventing stacklit to support such a case (can't be supported with Lit shader due to GBuffer size restriction), but we haven't done it. We have followed the same rules between Lit and Stacklit.

    I try a quick test to remove the restriction
    https://github.com/Unity-Technologi.../Runtime/Material/StackLit/StackLit.hlsl#L794

    Remove the (MATERIALFEATUREFLAGS_STACK_LIT_SUBSURFACE_SCATTERING | MATERIALFEATUREFLAGS_STACK_LIT_TRANSMISSION) part and this unlock Metal, but there is other artifiact (metal reflection) so it need a deeper investigation.

    Still we don't have the bandwith currently to handle this issue, I am providing this info if it can help. We will add you feature request to our list, but unsure when we will be able to tackle it.

    Thanks for your report.
     
  6. andresfho

    andresfho

    Joined:
    Aug 28, 2023
    Posts:
    2
    Hi Remy and Seb, thank you for your reply and sorry for the late reply, I didn't receive a notification from these messages.
    About the first workaround, as far as I know the HDRP custom pass has some restrictions like you need to have my object to be alone in a single layer to avoid to affect other objects right? Also I guess it will be expensive?
    I was going to try to remove the restriction as you suggest but since there is going to be a problem with metal reflection I guess it doesn't worth to try.
    Thanks for letting me know this, I hope we can have something like this in some point.
    Best
     
  7. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    707
    Yes, you'd need to place the objects in a dedicated layers to filter them, but I don't think it would affect performances that much.