Composing front-back issue

Good day everyone,

I use Blender 2.65a now.

Is there any way to solve following animation problem?
I have quite a big scene - over 10 000 light sources (different colours). Now I need some of them to be blurred, some of them with streaks and some of them unmodified. The camera rotates the system, so each of the lights sometimes are in front, sometimes at back, sometimes eclipsed by another, sometimes eclipsing something else.
I have placed all lights that need to be blurred at one layer, those with streaks at second and unprocessed on the third one - each of them works fine.
I have a problem, when it comes to mixing - I have no idea how to force blender to include information about spacial relations of lights - which is covered/eclipsed by another in a given frame.

To simplify situation - let’s imagine rotation of camera around two spherical light sources - one of them should be blurred, another should be clean - we make one full rotation around them, so there are some frames when both are visible, some when only one (the other is hidden behind it), and some frames only the other (the first one is hidden behind it). How to make blender render animation to show part of the time two light sources - one blurred, one clear, part of the time only blurred, and part of the time only clear (of course depending on the blur size, it can protrude form behind the clear light source)? - please see attached blend file, if it will be of help.

Sorry for repeating, but I just want to be sure I describe problem in a clear way, and I do not trust my English to rely on just one description of a complex problem. Thank you for an understanding.

Maybe I shall place it all in at one layer and there is some way to apply post-processing to given set of objects instead of layers?

Any help will be appreciated.

best regards,
Marian Siwiak


light_problem.blend (597 KB)

You were correct in thinking about processing a given set of objects. Each object in Blender can have a Pass Index value assigned to it (located under the object context). You must enable Object Index under Render Layers to expose this channel in the compositor. By default Pass Index is zero for every object. Assign each sphere it’s a unique Pass Index then use that index in the compositor to construct a mask/matte layer to filter only those objects.

Below is a possible setup. The blur is only applied to the objects with a Pass Index of 2.

The problem with this setup is that the final Mix Node fails to work correctly. On my machine I can see the Composite thumbnail is correct, but what gets delivered as the final render in the Image Viewer is wrong and both spheres are blurred. Perhaps another node Guru can figure that out?


light_problem.blend (600 KB)

An alternate solution might be to ditch the Render Layers all together. To blur the second light, instead of using a Sphere and applying a blur why not use a Plane with a spherical Blend texture to emulate that blur effect at the material level? Apply a TrackTo constraint to the Plane to make it always face the camera.


light_problem_alternate.blend (132 KB)


Thank you for your answers - I’ll check first solution, maybe I’ll find a way to force blender to not only display, but also save proper animation.
Re: planes - In an original scene (not simplified example), I have imported 1000 spheres from vrml file, I linked them randomly to 50 different materials emitting different colour light - also setting randomly emission changes in time. I’m not sure there is a simple way to do THAT using textured planes :slight_smile:

best regards and thanks again ,