How can I apply a blur effect to planes or textures in Unity Free?

Hi, I’m developing a small game using planes in parallax and would like to fake a DOF effect to simulate depth. I’ve seen free effects but I’m not really happy with them. I really wanted to be able to apply some sort of gaussian blur on the planes or textures according to their distance from the camera. I don’t need true DOF in this case.

Short answer: You probably shouldn’t.

Long answer: Assuming you’re only going to do this once per image at Start() time - as opposed to once per frame which will melt your computer - the method is this:

  • Copy the texture into a new texture object
  • Read the pixel data into an array of pixels
  • Perform a box or gaussian blur operation on that array
  • Write the array back into the texture object you created
  • Apply the change using myTexture.Apply();

Box and gaussian blur algorithms are around here and there. Note that it’d be best to do this in your graphics editing program unless you absolutely have no choice. This is a very expensive operation.

I’ve used this and it works for what you need: http://forum.unity3d.com/threads/indieeffects-bringing-almost-aaa-quality-post-process-fx-to-unity-indie.198568/