Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Dark reflections

Discussion in 'HDRP Ray Tracing' started by CuprumGD, May 16, 2022.

  1. CuprumGD

    CuprumGD

    Joined:
    Jun 2, 2020
    Posts:
    11
    Raytraced reflections are very dark.Seems like problem with exposure and GI, because if I make scene really bright via fixed exposure, I am more or less able to see reflections(still unsaturated though). Problem doesnt depend on GI used, the same thing with raytraced GI and with baked too.

    Directly lit objects are reflected fine, I wonder why.
     

    Attached Files:

    • dxr.png
      dxr.png
      File size:
      607.8 KB
      Views:
      357
    • dxr2.png
      dxr2.png
      File size:
      659.8 KB
      Views:
      347
  2. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    When I had similar problems, I found that I had incorrectly set light intensity, exposure value on the camera and postprocessing exposure. For example, sunlight should have an intensity of about 100000-130000 lux.
     
    Last edited: May 16, 2022
  3. CuprumGD

    CuprumGD

    Joined:
    Jun 2, 2020
    Posts:
    11
    Unfortunately no :(. I double checked, I have only default Sun (100000 lux) and default physical sky in the scene, exposure is correct.
    To demonstrate more clearly - if object is lit directly I get sharp bright reflections, if not - almost (but not completely I think) black.
    My best guess - considering both sky and sun here are physically correct (and both rayraced GI and reflections are enabled), result is completely non-photorealistic.
    Main reason I guess is standard HDRP/Lit shader, which as I see is far from photorealistic (for metallic near-mirror cases at least it's complete BS and cut many corners). Which also means I posted in a wrong forum, issue has nothing to do with Raytracing probably, just with HDRP.

    Not sure if it's just limitation or a bug.
     

    Attached Files:

    • dxr3.png
      dxr3.png
      File size:
      514.8 KB
      Views:
      270
    • dxr4.png
      dxr4.png
      File size:
      466.1 KB
      Views:
      252
  4. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    O.K.
    There are material samples for download in Package manager- High definition RP. You can try some material from this source...
     
  5. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Hi @CuprumGD ,

    This is not a HDRP/Lit issue. What you are seeing in your dark ray traced reflections, is a rasterized version of the scene, obscured by the directional light shadow, without any indirect lighting.

    Here's how you get the correct lighting inside your ray traced reflections:

    - Bake your rasterized lighting (either using lightmaps/probes or enlighten)
    - Place a reflection probe inside the room, verify that your baked lighting appears in the reflection probe
    - Set your "Last Bounce" of the ray traced reflection fallback layer to "Reflection Probes"



    If these options do not appear for you, try pressing the 3 dots on the top right of your "Screen Space Reflection" volume component and select "Show Additional Properties".



    If you run into any other issues, I recommend checking out the HDRP DXR/Realtime Ray Tracing Lighting Troubleshooting Guide, it should cover everything you need.
     
    chap-unity likes this.
  6. CuprumGD

    CuprumGD

    Joined:
    Jun 2, 2020
    Posts:
    11
    Thanks for reply, very helpful thread indeed. But this method didn't solve the issue... I attached screenshots of scene - first with baked gi and baked reflections and second one with raytraced reflections and probe fallback.
     

    Attached Files:

  7. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Are you using APV (Adaptive Probe Volume) for your baked lighting?
    The spheres look very noisy, something I have only seen with APV.
     
  8. CuprumGD

    CuprumGD

    Joined:
    Jun 2, 2020
    Posts:
    11
    Yes :) But it should work nonetheless, it is irrelevant for raytracing algorithm how was reflection probe created as long as it is baked already, right? Here it is with raytraced GI and same reflection probe (from APV bake)
     

    Attached Files:

    • gi.png
      gi.png
      File size:
      2.7 MB
      Views:
      213
    Last edited: May 16, 2022
  9. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Ray tracing currently does not support APV. It is being worked on (see this post), so I recommend reverting to the default baked lighting (or enlighten) for now.
     
    chap-unity likes this.
  10. CuprumGD

    CuprumGD

    Joined:
    Jun 2, 2020
    Posts:
    11
    Yeah, that was it. It worked when I had baked reflection probe with lightmaPS. Case solved, thanks to you.
    I am disappointed though ngl, baking is still everywhere in 2022 :(
     
    m0nsky likes this.
  11. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Hello, I have the same problem, Screen Space Reflections with Ray Tracing activated only reflect direct lighting, not indirect. Is there any way to solve this without using Reflections Probes?

    ssr.PNG
     
  12. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    My point is that I would like to get a photorealistic image for interior design, so I don't want to use Reflections Probes. I just want to use raytraced reflections and raytraced global illumination along with area lights with raytraced shadows.

    Combining just these elements I can get very smooth and realistic images, the only problem I've found so far is about reflections.

    In my scenes, which are generated procedurally, I only have one or two area lights with Ray Tracing shadows, some spot lights in the ceiling, and a global volume. This volume contains an override for Visual Environment, Exposure, SSR, and SSGI, both with RayTracing enabled. That's it.

    Unity version: v.2020.3.34f1

    ssr.PNG
     
  13. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    Hey, the reason why your metallic smooth sphere shows black on the ceiling is that any raytraced effect won't include the results of another raytraced effect by default.
    So if your source of indirect diffuse is RTGI for example, you won't be able to see it inside Ray Traced Reflections.
    This is also why shadows on raytraced reflections fallback to regular shadow maps.

    Now, if your source of indirect diffuse is baked lightmaps, Ray Traced Reflection will pick that up and you will see your ceiling indirectly lit "correctly" without the need of a reflection probe.

    If what you need is just "images", I suggest to try the pathtracer. The result will include all the indirect technique at the same time giving you something very close to what happens in reality.
     
  14. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Thanks for your answer!

    Our scene is generated procedurally in runtime, so we can't calculate baked lightmaps.
    I've tried the Path Tracer, but the result is always noisy. Is there any way to increase the 'Maximum Samples' value?

    Also, it's slow for our needs. The combination of SSGI + SSR + Area Lights with ray-traced shadows is perfect for us. We just need correct reflections.

    Do you know if this issue with reflections will be solved in future releases?

    kitchen.PNG
     
  15. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    Sadly, no, It won't be fixed because it's not an issue per se, it's just made that way.
    Basically, for indirect diffuse in ray traced reflection there has to be a fallback, wether that is reflection probe, lightmaps or regular ambient probe. (if no probe is setup, fallback is black)
    What you can try if you really can't bake anything, is try to put a white ambient probe and change exposure compensation on it to see if that fits your needs. upload_2022-6-8_14-2-57.png

    On recent versions (2022.2 alphas), the maximum sample count has been increased to 16k.
    You can also do that yourself by modifying in PathTracing.cs file maximumSamples value
    (in com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\PathTracing\PathTracing.cs)
    After changing that, you will need to remove and re-add the override.
    upload_2022-6-8_13-50-50.png

    Also, on latest alpha version, there's a new denoiser to try and get rid of the noise that can't be removed by more samples. (Have a look on the forum threads)
     
  16. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    I've tried with the white ambient probe, but the ceiling is still black and the whole image is brighter than expected:

    ambient probe.PNG

    I've also tried a baked reflection probe, the ceiling is white in the reflection probe, but it seems that ray tracing reflections have priority and the ceiling is still black in the sphere reflections:

    reflection probe.PNG global volume.PNG

    Maybe, I'm missing something?
     
  17. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    According to the documentation:
    "If Screen Space Reflection fails to affect a pixel, then HDRP falls back to using Reflection Probes."

    In my scene, ceiling reflections inside the sphere should be white because the ceiling in the reflection probe is white. What I'm doing wrong then?
     
  18. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Changing the Weight values in the Volume and the Reflection Probes don't fix the problem either.
    It looks like it's something related to Ray Tracing because with Ray Tracing disabled in the SSR then the ceiling is white

    weight 1.PNG weight 2.PNG
     
  19. CuprumGD

    CuprumGD

    Joined:
    Jun 2, 2020
    Posts:
    11
    Reflection probe is set to Realtime in your screenshot, although you write about baked probe in your post. Maybe you just forgot to set it to baked? Also check post #5, maybe there is something related there.
     
  20. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    Technically, the fact that they are baked or real time does not change anything.

    Yes, that's one drawback, and it won't make your ceiling full white without blowing up everything else, just a bit less dark indeed. However, for rougher objects, that could be enough to hide the "less dark" ceiling.

    The trick is that fallbacks are different wether you have regular SSR (ray marching) or Ray Traced Reflections.

    When SSR fails to raymarch (intersect geometry that's not on screen), then the fallback hierarchy takes over, so reflection probes then sky. This is by default and can't be changed for SSR.

    For the fallbacks to kick in for the RayTraced Reflections, a ray has to either:
    • Miss (Not intersect any geometry or arrive at its max ray length)
    • Stop because it reached its max bounce count (so secondary ray or tertiary ray.. etc if your bounce count is 1)
    In those cases, the fallbacks selected in the "Ray Miss" and "Last Bounce" section will take over depending on what you picked.

    So this is why, your ceiling stays black with ray traced reflections because it has no reason to use the reflection probe data over "valid" ray tracing results.

    In your case, the two valid workaround for the ceiling is either:
    • Baking lightmaps (or light probes) that can be picked by raytraced reflection indirect diffuse fallback
    • Have a carefully placed fill light so that the RayTraced reflections can light the ceiling properly if you really can't bake anything.
     
    m0nsky likes this.
  21. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Very good explanation, thanks!

    I can't calculate baked lightmaps because the meshes are generated procedurally during runtime (floor, ceiling, walls and furniture are read from an external XML file created from another 3D application) and lightmaps only can be calculated in the editor, as far as I know.

    The problem with fill lights is that they are fake so global lighting is not as precise as I want. I would like to use the same techniques that I use in V-Ray, I mean, area lights, spotlights and ray tracing for reflections, shadows and indirect lighting. The results I'm getting right now are very impressive and we can get rid of our old radiosity engine for photorealistic screenshots.

    Now that I know the limitations I just have to think of the best solution for our scenario.

    Thank you!

    P.S.: Our last images :)

    render01.png render02.png
     
    chap-unity likes this.
  22. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Hello again,

    I've found another problem related to Ray Tracing Reflections. This time I've got a problem with Directional Lights. As you can see in the screenshots, the scene is a square room 4x3 meters with a large mirror on the wall.

    When the camera is far from the mirror everything is correct, but if I move the camera toward the mirror then I see a problem with the directional light inside the mirror. I'm not sure if the problem is the camera, the light or the ray-traced reflections settings. The error seems something related to a frustum culling. Something similar when the near plane of the camera is too big.

    If I disable the directional light, the problem is gone. If I disable the Ray Tracing from the SSR the problem is gone.
    The problem is the same with Ray Traced Shadows in the directional light, or without it.

    Unity version v.2020.3.34

    reflections OK.PNG reflections ERROR 1.PNG reflections ERROR 2.PNG

    camera parameters.PNG sun parameters.PNG

    Any suggestions?
     
  23. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Doing another test, I've seen that maybe the problem is related to the position of the camera.
    As you can see in the screenshots, if the camera is between the mirror and the object then the shadow is missing.

    shadow ok.PNG shadow error.PNG

    I also tried the Extend Shadow Culling and the Extend Camera Culling in the Ray Tracing Settings in the Volume, but the problem is the same.
     
    Last edited: Jun 13, 2022
  24. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    You could try playing with the "Extend Shadow Culling", "Extend Camera Culling", "Directional Shadow Fallback Intensity" options in the Ray Tracing Settings volume override to see if it can improve anything in your situation.

    Additonally, setting the shadow map resolution on your light to high or ultra will help too.

     
    chap-unity likes this.
  25. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    I've tried these options, but the result is the same. It seems that shadows behind the camera are not rendered into the mirror.
     
  26. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    Yep, by default if an object shadow doesn't cross the frustum (mostly when behind the camera), it's culled, so what the extend shadow culling is doing is increasing the size of the culling frustum to be able to retrieve (raster) shadows from objects behind the camera. The new extended volume looks like that.
    For the camera culling, the idea is the same but for animation of skinned mesh renderer for example
     

    Attached Files:

  27. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    That's surprising, here's how it works in my very simple scene.
     

    Attached Files:

  28. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    I can see a bit of the shadow at a specific camera angle and position when I enable "Extend Shadow Culling", but I can't get the complete shadow. I guess this option may work in some situations but not in all cases.

    Thanks anyway!
     
  29. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    If you want to increase more the extended frustum behind the camera, the simple workaround would be to increase the far plane since it will grow symetrically forward and backward (see gif above)
     
  30. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Do you mean the camera far plane? Increasing this value has no effect...

    upload_2022-6-14_10-56-1.png
     
  31. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    @chap-unity Do you mean the camera far plane? I would like to solve this problem, if possible
     
  32. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    Yes, I do mean the camera far plane, it should increase the extended frustum BUT
    I figured why this doesn't work for you. This "extend shadow culling" setting only work for punctuals (spot, point) and area lights.

    For now there's no way to extend the shadow culling the same way for dir light.
    You can only choose the fallback value (in the same RayTracing Settings override)

    I'll make a case to make that more clean in the tooltip / doc because as we saw it's very confusing.
    Thanks for your patience.
     
    Last edited: Jun 22, 2022
  33. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Thanks for your answer, I understand the problem now, but I thought that you were using a dir light in the pyramid example in post #27, isn't it?
     
  34. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    760
    Yes, the big truth is that this settings affects dir light shadow map as a side effects, so it may helps in some unpredictable scenario (like mine), but it's not as defined and clear as the extended frustum for punctuals and area lights.
     
  35. jsr2k1

    jsr2k1

    Joined:
    Aug 11, 2010
    Posts:
    118
    Now, I fully understand the situation! haha

    Thank you for the answers, despite these issues, HDRP + Ray Tracing is awesome, I'm very excited to work with it!
     
    chap-unity likes this.