Light blocker : constrain lighting in specific areas

Is it possible in Cycles to light objects only inside an area?

Like the light blocker you can find in some render engines: https://support.solidangle.com/display/AFMUG/Light+Blocker

For the moment, the only way I found is to separate lights in render layers and make the “blocker” with the compositor, but it is slower and very limited by the number of Blender’s layers.

Is there a light node setup or something else that could be used for that?

Create a mesh (as the area you don’t want the light to escape) and then give it a material of holdout, then disable visibility for camera and shadow (shadow is very important if you have non-ambient lighting outside the mesh).
Basically, the light blocker is the holdout material. simple as that.

Thanks for the trick!
But it seems to work only for environment lighting and doesn’t block lights.

Not sure what you mean. This should block lights from outside coming in, and lights from inside going out. At least it worked that way with me. can you give a screenshot?

You can always create a separate object and then disable its visibility to camera rays (while keeping visibility to other ray types).

This means that you couldn’t see the object, but light can’t go through it.

I don’t want to block all lights at the same time.
I’ll explain it with example from Maya.

This is very simple 2 lights setup, one red and one green light.


Now, I can define what area lights can illuminate with basic shapes (sphere, cube, cylinder) which is called a blocker.
The red light is contained in the sphere shape only and green light in the big Cube.


Is it possible to create such a setup in Cycles? Maybe playing with node geometry information or whatever?
I could have that result if I separate all the lights in different render layers, then create a mask for each light. But this is quite heavy and I’d like to have a fast preview directly in the viewport, that’s why it could be very useful.

1 Like

You would need to use renderlayers for that.

Create your blockers using the lightpath trick, then have the lights divided among multiple layers, then combine the lighting information in the compositor.

To do what you want without doing this would require that someone develops a light group system for Cycles (in which the rays would then be flagged according to their source light and accessible with the nodes).

Yeah, that’s what I suspected… too bad!

1 Like