Unity URP custom post-processing vertex shader pitfalls

Usually in post-processing, Clip coordinates are vertex coordinates, so in the build-in pipeline, there should be no need to do additional operations in the vertex shader. However, in URP and other SRP, Blit operations are all done through Blitter.BlitTexture. , the final triangle drawn in it is also drawn by the cmd.DrawProcedual method. At this time, the vertices and uvs need to be remapped.

#if SHADER_API_GLES
float4 pos = input.positionOS;
float2 uv  = input.uv;
#else
float4 pos = GetFullScreenTriangleVertexPosition(input.vertexID);
float2 uv = GetFullScreenTriangleTexCoord(input.vertexID);
#endif

Guess you like

Origin blog.csdn.net/qq_37421018/article/details/128521332