Search Unity

Bug Transparent materials issue with ray tracing

Discussion in 'High Definition Render Pipeline' started by albertoforgione, Sep 13, 2023.

  1. albertoforgione

    albertoforgione

    Joined:
    Jun 6, 2019
    Posts:
    14
    Hey there,

    I'm having some issues with transparent materials not responding to Ray Traced Global Illumination correctly in interiors/shadowy areas.
    I'll leave a screenshot of an example transparent material here.

    This is with SSGI/RayTracing:



    Above is the HDRP/Lit transparent material and right below it's a copy of the same material set to Opaque/Alpha Clipping to simulate the transparency.

    The transparent material clearly receives incorrect lighting and becomes overexposed - especially if compared against the cutout material below, which behaves correctly instead.
    I would be happy to use alpha clipping as a temporary way round on such materials, however when it comes to character's hair for example (which would typically be transparent), cutout is not fit for purpose.

    However, transparent materials look correct with SSGI/RayMarching as you can see here:



    In general, transparent materials look correctly in the sunlight (i.e. under direct lighting), but they receive incorrect illumination once placed in shadowy areas (i.e. under indirect lighting).
    I've tweaked all SSGI settings (including bounce and sample count) on ray traced illumination but to no avail.

    Any help would be appreciated.
    Thanks in advance.
     
    Last edited: Sep 13, 2023
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    765
    Hey, it's not that they receive incorrect indirect lighting, it's just that transparent objects won't receive any GI comming from the SSGI override. (Wether it's raymarched, ray-traced or mixed).

    Generally speaking, transparents objects are really different beasts and comes with all sorts of limitations.
     
  3. albertoforgione

    albertoforgione

    Joined:
    Jun 6, 2019
    Posts:
    14
    Unfortunately I'm already using a custom hair shader, so I need to stick to it.
    I tried to tweak the Alpha Clipping value on my shader but regardless of the value it just doesn't look as smooth as it does with the Transparent shader. Also I used hair as an example but the same problem will occur with other materials needing a transparent shader where alpha clipping won't cut it.

    In general the transparent materials look good enough under the sunlight or with SSGI/Ray Marching, it seems to be only in shadowy areas and under Ray Tracing specifically for me.
    Any help on other solutions or way rounds would be highly appreciated at this stage.
     
  4. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    765
    Well it makes total sense since secondary rays have way more importance in darker areas.
    As for help and solution, in realtime there's no silver bullet sadly, you'd have to rely on light probes to fetch correct indirect diffuse for transparents.

    In addition, RTGI will use Adaptive Prove volume result as a fallback for ray miss and secondary bounce, so it will help even for opaque and will technically match with transparents.