I want to create an effect on a character where their skin and clothing are effected by two different light sources. The clothing should only reflect a bright bounce light, but have the skin should not be affected by this light source.

example image

In the example image I have two objects a cube, a sphere and three emission lights . I want the two white lights to hit both objects, and I need the purple light to hit and reflect off of the sphere, but ignore the cube entirely (no reflections).

Someone suggested to composite the layers together, it works... but this is very impractical and cumbersome because it forces the background to be transparent and it will be a pain to try and layer together a more complex scene, especially if its animated which is what I want this effect for.

I know you can have objects ignore shadows and all kinds of other things so im hoping someone knows how to get an object to ignore light with a few settings.

  • $\begingroup$ Obviously I haven't all the facts here but on the face of it and I usually render in OpenGL, but I do this frequently and I've not had to use the compositor, nor have I ended up with transparent backgrounds. If two layers are used and the sphere is placed in the 2nd, along with a purple lamp set to "This layer only" the cube in the 1st layer won't be affected by the extra lamp. The lamp(s) in this layer would have "This layer only" unticked. $\endgroup$
    – Edgel3D
    Aug 13, 2018 at 6:40
  • 1
    $\begingroup$ It looks like this option doesn't exist for Cycles Render. But I think it will be possible in Blender 2.8. $\endgroup$
    – moonboots
    Aug 13, 2018 at 7:10
  • $\begingroup$ @Edgel3D Ah thanks, that works but only for blender render. Is there a cycles equivalent? $\endgroup$ Aug 13, 2018 at 9:43
  • $\begingroup$ @moonboots Oh they are? Can you elaborate? $\endgroup$ Aug 13, 2018 at 9:44

1 Answer 1


This way is more about having a light ignore the object, than having the object ignore the light. If you're prepared to use OSL and CPU rendering, (which may slow things down too much for you), you can use this little OSL script in a lamp's shader, which returns the index of the object it's lighting directly, for each ray sample.

#include "stdosl.h"

shader LitObjectIDX(  
         output float ObjectIdx = 0.0        

    if (trace(P,I)){
        getmessage("trace", "object:index", ObjectIdx);

In the Render panel, enable CPU rendering, and OSL.

In the Properties > Object > Relations panel, assign a Pass Index to the objects you're interested in discriminating. In this example, there are two cubes - the one on the left has an index of 10, the one on the right, 20. They both have plain white BSDF materials.

enter image description here

One spotlight, shaded with the node tree shown on the left, is lighting the scene. With this set-up, it lights the left cube pink and the right cube green.(You could use the objects' indices in any way you choose, including ignoring all objects within a range of ID's)

EDIT in response to comments:

Yes you can have more than two colors, because you can do anything you like with the Object IDs. In this example, the objects have IDs of 2,4,6,8 and 10 respectively, and the plane they're sitting on has an ID of 12.

enter image description here

Here, I've got rid of the bounced diffuse light the clunky way, by simply going to the Properties > Cycles Settings of all the objects except the plane, and unchecking the 'Diffuse' ray visibility in each of them. That means they make no bounced diffuse contribution to the lighting in the scene at all.

If you wanted more control than that, you could use a combination of the Light Path node with the OSL node given here, in the shading of the objects, to specify which other objects received a diffuse contribution from them, and how. (That would be treating the objects in much the same way as we have treated the lamps in this answer. From the point of view of their diffuse, light-scattering rays, objects are lamps ... sort of.)

For the use of the Light Path node, and getting your head around reverse ray-tracing, I think this is a nice tutorial.

  • $\begingroup$ Ah NICE! Thank you, I got it to work but I just have two questions. Will I be able to do this with more than two colors? Like how would I be able to do this with 3-5 objects? And I don't want to sound greedy but is there anyway to get rid of the light bouncing off of each other? Its able to ignore the direct light source but not the light reflecting off of the actual object i.imgur.com/Q99cQiC.png $\endgroup$ Aug 13, 2018 at 23:24
  • 1
    $\begingroup$ This is absolutely amazing, thank you so much $\endgroup$ Aug 15, 2018 at 7:51
  • $\begingroup$ Hi @vklidu! I'll have to dig this one out and have a look to see what you mean, when I get a moment. $\endgroup$
    – Robin Betts
    Jun 20, 2021 at 17:32
  • 1
    $\begingroup$ @vklidu I did have a look, and came to the same conclusion. You have to 1: Not light the object, and 2: shine a light through it. This is just not the way a single ray can be wrangled into behaving, I think? It would have me reaching for the compositor. $\endgroup$
    – Robin Betts
    Jun 20, 2021 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .