I'm modeling a mouth for a cartoon character, and I want teeth & tongue to be involved. I'm currently working on teeth, but a problem has come up and I'm not sure what to do. I'm trying to make it so the teeth will only be shown when that specific part of the teeth is over the mouth part. Here's a picture:


The light orange is the teeth object, and the dark orange is the mouth object. I don't want the light orange ABOVE the dark orange to be shown, so there isn't teeth above the mouth. I'm pretty sure it has something to do with masks or something. Another note, I am using Cycles to render.

teeth on top of mouth teeth under mouth (part above should not be shown when it goes above)

The first pic here shows the teeth object on top of the mouth object. The second picture shows the teeth object UNDER the mouth object. In the second picture, that little white sliver, just above the mouth, is what I do not want to be shown when the teeth object is on top, if that makes any sense. I only want the teeth object to be shown if the part I want to be shown is on top of the mouth.

Thanks in advance.

  • $\begingroup$ If your animation style is cartoon then ... you might consider textures. Perhaps 8 or so mouth textures. I do not understand all the language above. Do you think it would be easier to let Blender take care of what is visible and what is not if you place the meshes in their proper location? Can the tongue be moved to location covered by other meshes such as skin? Suggestion, I think you can provide a better explanatory picture. Objects can be set to do not render as an animation technique .... yet this seems not the garden variety of mouth. $\endgroup$ – atomicbezierslinger Dec 19 '15 at 1:03
  • $\begingroup$ @atomicbezierslinger What I was trying to say is, I want the teeth to only show if it is over the mouth. So if the teeth object was way above the mouth object, the teeth would not be shown. But if it's halfway, like the picture above, only the bottom half that overlaps with the dark orange wireframe would be shown. $\endgroup$ – user8158 Dec 19 '15 at 1:23
  • $\begingroup$ Suggestion. Better pictures, solid not wireframe, if possible, would help the explanation. I find the wireframe not enough explanation. It will be easier when you cooperate with Blender. In many cases ... the placement of mouth composed of upper lip and lower lip, upper teeth, lower teeth, tongue, cheeks allows Blender to determine the final picture. If you have a specific artistic style of mouth, please say so. It will be easier for others to help you. Is there some example face image you can place in the question? $\endgroup$ – atomicbezierslinger Dec 19 '15 at 2:02
  • $\begingroup$ @atomicbezierslinger Okay, I added some pics. $\endgroup$ – user8158 Dec 19 '15 at 2:14

I believe this is impossible to do with materials. But I was able to get this effect with some render layers and compositing.

enter image description here

First put the front object in a separate layer than the rest of your scene. Then set up two render layers, one which renders all the layers, and one which excludes the layer with the front object. (Check out my explanation of excluding layers here).

enter image description here

Next give the back object a different pass index under the Object properties panel > Relations rollout. And make sure that you have the Object Index, and Z passes enabled on your render layers (see above).

enter image description here

Then use the following node setup to composite the two layers together.

enter image description here

The Less Than node compares the z-depths of the two render layers to find where the animated Suzanne is in front of the other one, the Add and Greater Than nodes work as a logical AND operator between this and the ID mask of the back Suzanne. So the mix node will grab the "main" render layer iff the animated Suzanne is closer to the camera and overlaps the other one in the rendered image. Which, I believe, is the effect you desire.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy