Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How can we detect hardware features at runtime (ray tracing, DLSS, etc.)

Discussion in 'High Definition Render Pipeline' started by mgeorgedeveloper, Sep 4, 2023.

  1. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    247
    Hi!

    I noticed another thread talking about how to detect DLSS support. There seemed to be no simple/official way to do it, but rather it relied on digging into HDRP code to see how it is done internally.

    How do I check if DLSS is supported runtime? - Unity Forum

    So I'm returning to this question, but not just related to DLSS.

    It seems that when enabling ray tracing features (HDRP asset, volume overrides, and so on), your project is now "stuck" on only working with ray tracing. How can a game gracefully detect hardware raytracing support in order to fall back to volume overrides without raytracing effects?

    Also, how can a game detect the absence of DLSS, so that we can switch to FSR instead?

    (Edit: I'm aware there is a built-in fallback option for FRS1 - but I'm using FSR2 from the asset store, so I have a script that can neatly switch between DLSS, FSR2 or nothing, during play mode)

    So to be clear... the "switching" stuff is OK. I can swap out volume profiles for raytracing vs. no raytracing. I can change the upscaling approach via some scripts. This is all fine. But - there needs be a reliable and simple way to ask unity.... "Is DLSS supported?", and "Is raytracing supported?"

    Any ideas or experience in dealing with this?
     
    Last edited: Sep 4, 2023
    nehvaleem likes this.
  2. meicexl

    meicexl

    Joined:
    Apr 9, 2020
    Posts:
    11
    To check for ray-tracing support, use SystemInfo.supportsRayTracing. To check for DLSS support, use the piece of code in the thread you linked. It works well.

    I've also not tested it myself, but it's very doubtful you need to handle this manually. I cannot imagine Unity doesn't automatically fall back and disable ray-tracing if the system doesn't support it. Just make sure you hide/disable RT options in your in-game settings menu.
     
  3. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    247
    Maybe - but how would such a fallback work exactly? For example... ray traced GI works on top of SSGI. The configuration options are quite different for SSGI when you toggle ray tracing on or off... so, if raytracing is not supported, exactly to which values in the SSGI override will it fall back to? Similar for SSR, SSAO, etc. It is not clear what the property values will be on those volume overrides when ray-tracing fails.