Lighting just the eyes in Blender 2.8

I’m using Cycles and Blender 2.8. I would like to have a light that lights only a character’s eyes, so that I can control that character’s “eye ding”:


I would like to control how much “eye ding” a character has in post-production, so I would like a separate pass in my EXR file for just the eye ding.

I’ve been experimenting (in a very crude way) to figure out how best to isolate this, but I suspect I’m on the wrong path. Can someone please provide an example or a blend file on how to do this?

Light groups is not yet supported by Cycles.
Probably the best thing you can do is to use view (render) layers and composite.

That was my initial approach…and it kind of works, but there’s perhaps something I’m missing.

This is my view layer v_eyes, which has a yellow light shining onto the eyes. (Please note that this is just a crude example to show a proof of concept – there is no “eye ding” in this model. I’m just trying to figure out a way to have lights on a particular object but not on the others.)

This is my view layer v_face.

Note that the mesh called eyes is a child of the mesh Suzanne and the eyes mesh is linked between the c_face and c_eyes collections.

My animation spins the Suzanne’s head around 180 degrees, so the eyes start by looking at the camera, and then are facing away from the camera by the end of the shot. Basically, the head occludes the eyes by the end of the shot.

Here is my Blender file for this: Eye ding test 04.blend (767.1 KB)

Everything appears to be rendered out properly in the EXR files. However, I’m not sure how to set this up in the compositor so that the eyes are properly occluded. I’m using a setup like this:

The problem is when the head spins around – the eyes can still be seen:

So in the v_eyes viewlayer, I tried putting a holdout on the collection with the face:

But since the eye mesh is a child of the Suzanne mesh – and the Suzanne mesh is within the collection that I put a holdout on, the eyes disappear as well.

Now, I can duplicate the Suzanne head with the eyes and selectively choose what gets rendered – and use a holdout on the original visible Suzanne mesh…

…and the eyes will be occluded correctly, but this seems like a horrible way to work – especially if the animation changes later on. I don’t want to keep track of an animation in two places just to get the occlusion correct.

I’m thinking I need to do something in the compositor with the z buffer to hide the eyes…but I’m not sure what.

It’s also possible that I’m on completely the wrong track. Any suggestions?

Figured it out!

I needed to do a Z Combine in the compositor. Now the eyes will be properly occluded without having to duplicate the animation in two places.