Search Unity

Question HDRP ray tracing : How to reduce specular reflection ?

Discussion in 'High Definition Render Pipeline' started by Tamanoir, Mar 3, 2021.

  1. Tamanoir

    Tamanoir

    Joined:
    Aug 1, 2017
    Posts:
    27
    Hi !

    I've setup HDRP pipeline with raytracing and I have a huge problem with it. Take a look at this picture :

    help.png

    All my materials (except for the character but that's not important) are set to opaque/raytracing/standard I've also enabled SSR for them because if I disable it my materials are black. But why are they this much specular ? I've tried to play a bit with the metallic and smoothness values but that doesn't change the specularity so much.
    So ... yes if anyone knows how I can have a material that is not as specular as a mirror it would be greatly appreciated

    Tama
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    765
    Hey, from what I see, while what you used does produce "ray traced reflection", this is not the proper way to have them.

    Instead of adding a Recursive Rendering Override and put your object in the raytracing pass, you should put back your material in the default pass, and then add a Screen Space Reflection override and enable raytraced reflection there. (Cf documentation on ray traced reflections)
    There, you will be able to select the number of bounce you want, the min smoothness at which you'd want your reflections ray traced.. etc

    Recursive Rendering will override your material smoothness to 1 making the specular reflection you experience.

    Recursive Rendering was created to be used in very specific situation when you need to have multiple refraction within multiple transparent objects (cars headlight for example). It is to be used "carefully" because it's very costly performance wise (compared to Ray Traced Reflections in the Screen Space Reflection override). You can learn more about it in the documentation about Recursive Rendering.
     
  3. Tamanoir

    Tamanoir

    Joined:
    Aug 1, 2017
    Posts:
    27
    Ho nice ! That's way better. Indeed, I didn't give enough attention at these resources when I saw them.
    Thank you very much. Just a pic of the result :

    nice.png

    Tama
     
    chap-unity likes this.
  4. Tamanoir

    Tamanoir

    Joined:
    Aug 1, 2017
    Posts:
    27
    Ho wait ! Is it normal that my custom hit shader doesn't work anymore ?

    edit : I have a ClosestHit Shader that I use for my system purpose
     
    Last edited: Mar 3, 2021
  5. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    765
    AFAIK, changing the setup like I suggested shouldn't prevent you to do custom stuff with raytracing shaders.
     
  6. Tamanoir

    Tamanoir

    Joined:
    Aug 1, 2017
    Posts:
    27
    Hmmm. In this case that's weird. My ClosestHit shader is not triggered when my materials are set to Default and not Raytracing. Do you know if I have something in particular to do when I set and launch my custom RT Shader on my objects or on the RayTracingAccelerationStructure maybe ?
     
  7. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    173
  8. Tamanoir

    Tamanoir

    Joined:
    Aug 1, 2017
    Posts:
    27
    Hi,

    Yes this is how I launch my RayTracingShader and it was working until I enable the default pass instead of the Raytracing pass on my materials for visuals results purpose (as shown in the previous posts). To be more precise, the shader never enter in the closestHit shader. Meaning the raytracing pass is not execute anymore on the objects. I don't really know where to search anymore if you have anything that can help me resolve this problem it would be very nice.
    If it can help I based my implementation on this code : https://github.com/SlightlyMad/SimpleDxrPathTracer

    Edit: Also my custom raytracing pass is not a visual pass, it's a pass I use to compute other stuff as visibility and collision to use in my system

    Tama
     
    Last edited: Mar 8, 2021