- Home /
Multipass and how to do a Box Blur shader?
Hi there,
i have recently dug into understanding and writing shader especially CG. I am trying to implement some sort of Blur shader which was not that of a problem. There are plenty of examples and i also understand the theory. After implementing a Gaussian blur i wanted to see what performance improvements can be done and went across Box Blur. I also found a sample for that but i don't think it really does what i expect : Blur Shader from Asset Store
First he uses a grab pass to get the screen contents behind the object connected with the shader. Then he uses two passes to first blur horizontally and after that vertically in a second pass. Both paths are blended One One. In both passes he takes the Color values for blurring (tex2D accesses) from the grabbed texture.
Should there not be another grab pass in-between the 2 shader passes? Because if the second shader again takes the original color values from the grab pass the blur only takes vertical and horizontal colors into account. And that would not even need 2 passes at all.
I thought the box blur only works right when the second pass takes the result (colors) from the first pass and not from the starting texture. Or can it be that i have not understood the multi pass thing completely (I did not find all too much about that multi pass thing in general)?
Don't you need to do a grab pass to access the output of a earlier pass?
Hope you understand my question(s) and can help me out here.
Thank you!
Your answer
![](https://koobas.hobune.stream/wayback/20220613140143im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Shader - Using Multiple Pass for different shader target 1 Answer
Is it possible to get back data for a specific vertex from a shader ? 0 Answers
Disabling a Pass or Subshader Programmatically 0 Answers
Use Shader Motion Vectors pass in Surface Shader 2 Answers
Shaders: Using Property for Offset 3 Answers