3
$\begingroup$

I need a transparent hole in a specific part of my render defined by object. For example, I have a cube. How to make an alpha-channel on the place of a cube?

$\endgroup$
3
$\begingroup$

There may be a simpler way to do this, but since no one's answered yet, here's a way:

Put the cube on a separate render layer from the scene:

enter image description here

Set transparency under Render properties:

enter image description here

The Scene layer image should be used for the output image. The Cube layer's alpha is inverted and used as the output image alpha.

enter image description here

Composite image: enter image description here

If you don't want the shadow, just exclude the cube's layer from the scene: enter image description here

Composite without shadow: enter image description here


EDIT: If you want to use this with an environment map as the background:

Make the cube Diffuse and perfectly (1.0) white: enter image description here

Uncheck Transparent:

enter image description here

Use the Diffuse Color render pass:

enter image description here

Invert the Diffuse Color pass and use it as the composite alpha:

enter image description here

enter image description here

$\endgroup$
5
$\begingroup$

The holdout node can be used to cut an object from the scene.

The Holdout shader node is used to create a “hole” in the image with zero alpha transparency, which is useful for compositing

Note that the holdout only cuts through objects in the scene, you need to render with transparency and composite the scene onto the environment pass if you want the background.

You can also set the object pass index and use the ID Mask Node to mask it out in the compositor. The material index is the same thing applied to the material instead of the whole object.

sample id mask

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.