I am trying to apply a blur effect to a spotlight beam - my goal is to create a somewhat smudged effect, and I am trying to accomplish this by rendering the objects, spotlight beams and sky on different layers, however I am having trouble recombining these layers in compositing. The sky renders on top of the beams, or if I check the right "use alpha" toggles in the Z combine nodes, the sky doesn't render at all. The spotlight also renders behind the object it is emanating from - this is sometimes desirable, but it also happens when the spotlight is facing the camera. What I want is simple, for the spotlight beam to render in the correct order depending on how close each pixel is to the camera and for the sky to render behind everything.
I hope my goal has been made specific enough.