Blurring only the top camera

I am rendering light shafts and want to blur them to mask some edge artifacts. Enclosed is a picture of what it looks like now.

Basically my current set up is that I have one camera rendering the entire scene, except the light shafts, and then I have another camera in front of it that does not clear the depth or color buffers, that is rendering the light shafts.

I thought this would be relatively easy – the camera previews show exactly what I would expect, and the final image is composited as it should be. The only problem is that once I apply the blur image effect to the light shaft camera, the entire scene is blurred, not just the light shafts.

In general terms, I want to be able to render a light effect that is masked by the z-buffer properly (but does not write to it), blur it, and composite it with the rest of the scene using simple additive blending. I’ve been searching for hours, and although I’ve found many questions similar to mine, I haven’t found any answers.

Thanks so much!

10950-lightshaftssmall.png

Since blurring the scene is a post-screen effect, it blurs the entire view buffer.

I suggest the following solution:

  • Rendering the top camera to a MovieTexture (Unity Pro only)
  • Applying the blur to that camera
  • Showing the movieTexture on a plane
  • Having an orthographic camera render that plane. The Ortographic Size must then be set to half the height of that plane.

I didn’t try if this works, but let me know if it worked or if you encountered any issues with it.