Search Unity

Question Is it possible to include RTX raytracing shaders with Unity 2022 standard shaders?

Discussion in 'General Graphics' started by Airmouse, May 5, 2023.

  1. Airmouse

    Airmouse

    Joined:
    Jan 12, 2019
    Posts:
    107
    I am developing a game that is using the standard GLSL shaders but I also would like to include raytracing for reflections. Can I have both RTX shaders and standard shaders in the same scene? Or does Unity's standard render pipeline include RTX support?

    Thank you!
     
  2. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    173
    Hi @Airmouse !

    Standard render pipeline doesn't implement any ray tracing effects and the shaders don't have any ray tracing shader passes.

    You'll need to implement a .raytrace shader containing a ray generation shader that generates your ray tracing reflections and finally combine this output with the scene.

    The .shaders your scene is using have to contain a shader pass that's executed when rays hit geometries using those shaders. These are usually "closest hit" and "any hit" shaders.

    Check this sample https://github.com/INedelcu/RayTrac...on/tree/autodesk-interactive-with-ray-tracing - it's generating world normals as output which is blitted on the screen.

    https://github.com/INedelcu/RayTrac...-tracing/Assets/Shaders/RayGenerator.raytrace - generated the world normals.

    https://github.com/INedelcu/RayTrac...ing/Assets/Shaders/AutodeskInteractive.shader - AutodeskInteractive shader from built-in RP with an additional SubShader pass at the end which contains a "closest hit" shader.