Shapes drawn in the AfterPostProcess step are cut off if HDRP dynamic resolution scaling is in use

Avatar
  • updated

If I draw something in immediate mode in the AfterPostProcess step and I'm using HDRP's dynamic resolution scaling, the resulting shapes will be clipped to the bottom corner of the screen. If the scale is at 50%, for example, then only the bottom left quadrant of the screen gets anything rendered to it.

Image 690

There should be a small solid hexagon on the floor. The center of the viewport is near the top right corner of this image; note how the small hexagon's right side has been cut off there.

I originally figured this was a Unity bug, since I'd seen similar behavior from other custom passes run in that step. This Unity forum thread describes some of the issues, although I think the bug described in the OP got fixed a while ago. Note how I got varying forms of the problem in this post: one shader was clipped and scaled, whilst another was only scaled. Neither were only clipped!

This makes me wonder if the bug is in the shader or how the Shapes custom passes work, rather than being a Unity bug. 

Also, since it's a bit of a nuisance to set all of this up (it took me an embarrassing number of tries to get dynamic resolution to work in a new project...), I can submit a project demonstrating the bug if desired!

    Reporting a bug? please specify Unity version:
    2022.2.2f1
    Reporting a bug? please specify Shapes version:
    4.2.1
    Reporting a bug? please specify Render Pipeline:
    HDRP
    Avatar
    fen

    I bumped into this again today. It looks like rendering Shapes in the AfterPostProcess step in general causes this to happen.

    Image 794

    This shows two different flavors of the problem. I am using a custom pass volume to draw the Disc in the AfterPostProcess step. The render scale is set to around 60% here. 

    • The disc is cut off on the top and the right. Only the part that fits in the lower-left 60% of the screen renders.
    • The cube is incorrectly blocking part of the disc. It looks like the depth texture is being shrunken down before being sampled.

    When the disc is not drawn in the AfterPostProcess step, it appears correctly -- same position, same size, but not cut off and not blocked by the cube.

    This is Unity 2023.2.2f1 with Shapes 4.3.1

    Avatar
    fen

    Ah, this is what I get for not testing a little more before posting. This happens with other materials and other renderers whenever I draw during AfterPostProcess.


    The depth texture is shrunken down, causing both of the issues I mentioned above.

    I do not think this is a Shapes bug, nor something that could be fixed on your end. D'oh!