Role of the vertex shader in a Post-Effect ?

Hi everybody,

I’m quite confused about the role of the vertex shader for a Post-Effect…
I understand and know the steps of the Graphics pipeline (vertex shader => rasterization => fragment shader), especially when it’s a scene composed of one or many meshes (so vertices in object space to transform in clip space for the vertex shader, etc etc).

But for a post-process, which vertices are going to be transformed in clip space ?
If I read the OnRenderImage callback, it’s “only” about RenderTexture, so a 2D texture…

Thanks in advance to clarify my misunderstanding !

I think the part you’re missing is a post process / image effect takes a render texture as an input which has the contents of the screen already rendered, and outputs a new image written into another render texture that replaces it. However since it’s still a normal fragment shader, and a fragment shader needs the rastorization step to know which pixels the fragment shader needs to run on, and the way to do that is using a vertex shader.

So to further explain, the Blit function is an optimized “render this full screen quad” call. It’s still rendering a mesh with four vertices to the screen, and it’s still being transformed into clip space before rendering.

2 Likes

Thanks a lot bgolus !