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.

Bug Viewport is incorrect in a custom pass running in AfterPostProcess when using dynamic resolution

Discussion in 'High Definition Render Pipeline' started by TowerOfBricks, Nov 18, 2020.

  1. TowerOfBricks

    TowerOfBricks

    Joined:
    Oct 20, 2007
    Posts:
    976
    I have a script that needs to render things in world space *after* post-processing effects.
    This works perfectly using a custom HDRP pass with CustomPassInjectionPoint.AfterPostProcess, but not when using dynamic resolution. When dynamic resolution is enabled the render target is scaled up at some point in the post-processing effects stack, which is expected. However, my custom pass still gets a viewport which is only a fraction of the full size.
    I believe this is a bug as at this point the viewport should cover the whole screen (or at least the whole part of the screen the camera should render to after being scaled up).

    1. Use a custom pass with CustomPassInjectionPoint.AfterPostProcess
    2. Use dynamic resolution
    3. Render something in the custom pass.
    4. The things will be rendered in a scaled down way in a corner of the screen.

    upload_2020-11-18_16-24-24.png
     
  2. Yavvn

    Yavvn

    Joined:
    May 8, 2019
    Posts:
    18
    Bumping this thread for a response, this issue is also preventing us from using dynamic resolution in HDRP.
     
  3. DeadNinja

    DeadNinja

    Joined:
    Jun 3, 2013
    Posts:
    39
    Confirm, totally block my project - tested on all 2020.1-2020.2 versions with HDRP 9 - 10
     
  4. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    209
  5. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    481
    This issue has re-appeared, identified in 2021.2.4f1 up until 2021.10f1
     
  6. MS80

    MS80

    Joined:
    Mar 7, 2014
    Posts:
    346
    It seems this bug is still existing in Unity 2022.0.1f1 and HDRP 13.1.8.
    How could I add a "pass that resets the camera size"?
     
  7. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    I've been encountering this as well on 2021.3.5, though I think I'm only getting it when I use FSR (DLSS disabled) and am forcing a specific screen percentage.
     
  8. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    11,843
    hi, is this still an issue, was it resolved in some of the latest versions ?

    Thanks
     
  9. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    545
    Still seems broken in latest LTS. And it still does not appear under "known issues". Not sure what's going wrong here.
     
  10. chemicalcrux

    chemicalcrux

    Joined:
    Mar 16, 2017
    Posts:
    357
    This is a major issue for me, since I don't want to post-process my UI!

    I tried to check if the prior fix for the bug was running, but I was unable to embed HDRP in my project without massive breakage. The code is still there, though.
     
  11. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    545
    I guess we should keep this topic alive and on top of the HDRP board, until there is an official response from Unity.
    This is a heavy bug, which makes it impossible to combine Dynamic Scaling / DLSS / FSR / TAAU with any custom post processor, or with world space UI (which is also affected, if you use the necessary Custom Pass to avoid blur of fonts).

    Funny also that the issue is marked fixed:
    https://issuetracker.unity3d.com/is...sion-when-both-at-active-drs-plus-custom-pass

    and that a PR (which seems to correspond to this issue) is waiting since April in the Graphics repo.
     
    Genebris likes this.
  12. LumaPxxx

    LumaPxxx

    Joined:
    Oct 3, 2010
    Posts:
    316
    They've fixed it in 2022.2.
    try the beta version you will see it.
     
    Genebris likes this.
  13. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    545
    This does not help much, as we use LTS for production. As this is a clear and major bug, it should be listed as known issues on LTS release notes and fixed with high priority. Not sure why this is not the case, as the bug is known since release of LTS (and earlier)
     
  14. pwka

    pwka

    Joined:
    Sep 19, 2012
    Posts:
    43
    This gets "fixed" when you only see the scene or game view at a time. This bug has been around for a very long time. This plus jittering makes custom pass not very usable in production.
     
  15. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    545
    *bump* we need an official response from someone at Unity.
     
  16. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    545
    Another bump. New version (2021.3.11), still no mentioning of this major bug, and no resolution. Instead new bugs in the release, leading to instant crash :(
     
  17. TriceHelix

    TriceHelix

    Joined:
    Mar 6, 2019
    Posts:
    12
    Bump. I have encountered additional issues even without using dynamic resolution. It completely messes up the homogenous coordinate system (SV_Position) in shaders that are applied in custom passes, for example while rendering a mesh or image effects. I will open an in-depth thread about this later in case it's a different bug and because the steps to reproduce are a bit different.

    Edit: It seems the problems I have been encountering were unrelated and simply added to the weird behaviour the bug produces. Dynamic resolution is still messing things up though.
     
    Last edited: Oct 3, 2022
  18. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    545
    *bump* I don't know what to tell our users anymore about why we don't fix the bugs with DLSS & co. We are at 2021.3 LTS, DLSS was introduced as a key feature a year ago or more, still not working correctly.
     
  19. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    545
    time for a *bump*. Someone @Unity, please respond.
     
  20. chemicalcrux

    chemicalcrux

    Joined:
    Mar 16, 2017
    Posts:
    357
    I've been doing some testing on this.

    The original problem -- where the custom pass would appear scaled-down -- is not happening for me in 2021.3.9f1. If I get rid of the fixes introduced here, then the scaled-down rendering returns.

    What is happening is that the custom pass is getting clipped based on the render scale. So, if the render scale is at 50%, only the bottom quarter of the custom pass gets drawn at all. The part that is drawn does get drawn at the correct scale.

    Custom post-processing volumes that run in the After Post Process step are not affected. I am only seeing problems with custom passes set to run in the After Post Process step.

    I'm tinkering around with the pipeline, but I haven't had any luck making this work correctly yet. If I find a gross hack that makes it work, I'll post it :)
     
    Qleenie likes this.
  21. chemicalcrux

    chemicalcrux

    Joined:
    Mar 16, 2017
    Posts:
    357
    This remains broken in 2022.2.2 with HDRP 14.0.4. I have not been able to figure out a workaround.

    I guess a new bug report needs to be filed for this? I'll make a project for it.

    Edit: whilst working on a bug report, I've gotten some confusing results!

    I started by using the Outline shader from this HDRP documentation: https://docs.unity3d.com/Packages/c...stom-Pass.html#scripting-example-outline-pass

    Notice how this is from HDRP 7.1. I had to tweak the script a bit to make it work right.

    upload_2023-1-18_15-58-20.png

    This resulted in the custom pass getting clipped to a fraction of the screen and getting scaled up. So, at 50% resolution, only the bottom quarter was visible, and the outlines that were getting drawn were doubled in size.

    I then switched to one from HDRP 12.0: https://docs.unity3d.com/Packages/c...nition@12.0/manual/Custom-Pass-Scripting.html

    upload_2023-1-18_15-54-4.png

    This one resulted in scaling of the effect, but not clipping.

    Notice how the outlines are visible all the way to the edge of the screen.

    The problem I have been having is not like either of these! Instead, I'm seeing the custom pass getting clipped to the bottom corner of the screen, but it is showing up at the right scale.

    This makes me wonder if there is no bug, and that this is just a problem with the custom pass shaders. I do not understand the shaders well enough to say much there, unfortunately.
     
    Last edited: Jan 18, 2023