[Blender 2.5] 3D Object used as a mask


Each object is rendered to a different RenderLayer, with the power of node compositing you can have layers interact with each other and result to a proper masking, making the integration between the background and the 3D objects almost great.

Procedure of creation:

  1. Setup a background, in this case I have set it as a texture to a 3D plane mesh.

  2. I added a Monkey mesh in the the scene for testing.

  3. In this case I create a Bezier Curve and trace the outline of the tree which is in foreground. Actually, any rendered object can work but Bezier Curve is very easy to use for outlining. The Bezier curve could be set to 2D (for better handling) and make it Cyclic U (to form an enclosed surface).

  4. Move objects in different layers
    Layer 1: Mask (Bezier Curve)
    Layer 2: Monkey (along with some lights for proper rendering)
    Layer 3: Background

  5. Create new RenderLayers
    While creating a new RenderLayer we will have to set which exactly scene Layers to match.

Here’s the setup:
Mask: Layer 1
Monkey: Layer 2
Background: Layer 3

[ATTACH=CONFIG]120391[/ATTACH]

  1. Compositing
    Follow the instructions of this image or study the blend file, I found out about it based on experimentation and luck. It works nicely for now, I hope that it will be reusable for many other occasions on your projects.

Download zip file containing blend source here:
http://www.mediafire.com/?n01d01rk95xg4hg

Thank’s!
This one helped me doing some masking!

it looks pretty good, but if u use a blur node for the first and the second layers it would look more realistic, something like 5 by 5 should work for both layers C:

great post!! thanks very much!

http://www.infoocean.info/avatar3.jpgThis one helped me doing some masking!

For animations you use this same technique but also the rotobezier plugin so you can animate the curves.

我真的是一個天才嗎?

I’m new to blender, and I’m sure I’m missing something, but does this technique provide an advantage that simply using a holdout material does not?

I have a character whose eyes I render separately from the rest of the body (I do some post-processing in other software on the eyes to add some effects). In one shot, the camera moves behind the character’s head, which occludes the eyes. To achieve the masking for my eyes-only composite layer (I also composite using other software), I do the following:

  • Move the eyes to layer 2.
  • Make s duplicate of the head and move it to layer 2.
  • On layer 2, remove all materials from the head duplicate.
  • Add a new material to it and make it “holdout”.

In this way, the head creates a mask so that when I composite like this:

TOP

  1. Eyes
  2. Head
  3. Backplate
    BOTTOM

The eyes are masked as expected.

Yes. The main advantage would be that with this technique you do not need any additional software. :wink:

Thanks for posting.
One place where I got stuck is that I had a sky in the background, so no transparency to work with.
And I couldn’t simply get rid of the sky because the sky color was lighting my object.
So I did a little searching and found a tutorial describing a very simple and elegant method for turning any object into a mask.
People who stumble upon your thread may find it quite useful: