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?
2 Answers
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:
Set transparency under Render properties:
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.
If you don't want the shadow, just exclude the cube's layer from the scene:
EDIT: If you want to use this with an environment map as the background:
Make the cube Diffuse and perfectly (1.0) white:
Uncheck Transparent:
Use the Diffuse Color render pass:
Invert the Diffuse Color pass and use it as the composite alpha:
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.