Applying a compute shader-based screen effect in URP
So far, we have seen how to use compute shaders to optimize calculations on pure data. We eventually used the information to modify cube visual properties, but it was a sort of “side-effect” to make it easier to see the results: in theory, we could have simply stuck to the compute part and measured the execution time to compare our CPU and GPU process performances.
Still, screen effects and postprocessing are big applications of compute shaders, so we definitely need to have a look at how we can use these shaders to directly render something on our screen.
To test things out, we are going to create a very simple compute shader that fills the screen with red pixels. The goal is thus to effectively end up with a fully red screen. I know, it is not a very exciting idea, but it will be a good way to understand the basics of using compute shaders in a URP project without too much distraction!
In the following sections...