CustomPassUtils - some pixels drawn twice, fixed size render targets not working

Hello!
Discovered some problems trying to do blurs with CusomPassUtils:

a) Code calls something like ctx.cmd.DrawProcedural(xxx, xxx, xxx, MeshTopology.Quads, 4, 1, propertyBlock);
However, shader uses GetFullScreenTriangleVertexPosition function. This function produces single full screen triangle. As a result, 2 triangles are drawn, one covering whole screen, and another covering half of the screen. Here are vertex positions from RenderDoc:
7056736--837898--cusomutils-geometry.png

b) Blurs only seem to work with render targets created with scaleFactor. When using fixed size targets, nothing is drawn because viewport set to zero size. It is not possible to set scaleFactor on a fixed size target.

Thanks!

6 Likes

Hello,

Thanks for reporting this issue, it has been fixed in this PR: https://github.com/Unity-Technologies/Graphics/pull/4623
Backport is planned for both Unity 2021.1 and 2020.3