Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug [HDRP 12.1.3] Screen is cropped when DLSS is on in player

Discussion in 'High Definition Render Pipeline' started by alloystorm, Jan 17, 2022.

  1. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    olavrv likes this.
  2. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    From my understanding the custom pass issue is HDRP related, so I will try to pull some fixes on git and check them out...
     
  3. alloystorm

    alloystorm

    Joined:
    Jul 25, 2019
    Posts:
    88
    My workaround for this is to use _PostProcessScreenSize when sampling color texture, and _ScreenSize when sampling depth texture. My custom toon effect works fine in the latest 2021.2.12
    Also the behaviour might be different depends on your injection point, mine is at BeforePostProcess.
     
    olavrv likes this.
  4. alloystorm

    alloystorm

    Joined:
    Jul 25, 2019
    Posts:
    88
    I do notice FPS drops when turning on DLSS in editor. But it seems normal in the build. Will keep an eye on it in further testing.

    I set dynamic resolution off in the project and turn it on at runtime. Maybe that helped.
     
  5. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    @alloystorm This sounds interesting! How do you switch dynamic resolution from script on project level? In my current configuration I've enabled dynamic resolution on the HDRP assets, and only switch on camera level.
     
  6. alloystorm

    alloystorm

    Joined:
    Jul 25, 2019
    Posts:
    88
    That's exactly what I'm doing too. My previous description is a bit misleading. I untick "dynamic resolution" from the camera settings in the project, then during runtime set them to the configured values.

    Code (CSharp):
    1. // mode: 0 off, 1-4 dlss, 5-9 fsr
    2.             HDAdditionalCameraData camData = Camera.main.GetComponent<HDAdditionalCameraData>();
    3.             camData.allowDynamicResolution = mode > 0;
    4.             if (mode > 0 && mode <= 4) {
    5.                 DynamicResolutionHandler.SetDynamicResScaler(() => 100, DynamicResScalePolicyType.ReturnsPercentage);
    6.                 camData.allowDeepLearningSuperSampling = true;
    7.                 camData.deepLearningSuperSamplingQuality = (uint)(mode - 1);
    8.             } else if (mode >= 5 && mode <= 9) {
    9.                 camData.allowDeepLearningSuperSampling = false;
    10.                 DynamicResolutionHandler.SetDynamicResScaler(() => fsrPercentages[mode - 5], DynamicResScalePolicyType.ReturnsPercentage);
    11.             }
     
  7. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    Hm, just tried the same, but no change for me. In Builds there is a high chance that DLSS leads to a huge FPS drop. Does not happen with FSR.