Does Graphics.Blit affect performance much when used in image effects?

Hi.

I’ve coded several image effects which modify a passed texture using Graphics.Blit with specific shader and pass it to a next effect. Forming a chain of effects. You know, like an algorithm: 1. blur, 2. threshold, 3. edge detect.

This chain has many calls to Graphics.Blit, which as I understand is a separate draw call itself.

So, is it a good approach or I’ll get myself into serious performance problems pretty soon?

Having them as separate scripts gives you flexibility to add/remove/disable/enable them as needed. But for performance reasons it would be best to combine the effects into a single OnRenderImage call when possible.

So a better approach is to combine as many of your effects as you can into a single effect. Every Graphics.Blit of a fullscreen quad is of course expensive, therefore the less you do it, the more you save.

You can also render to a RenderTexture instead of to the screen, as this will read back from screen to the Texture pass to OnRenderImage.

Finally, you can also downscale your RenderTexture which will reduce the number of texels from the RenderTexture that have to be processed and improve performance.