5
$\begingroup$

I'm trying to overlay some animated 3D models over live action footage. Some of the models (I'll call them collection A) will appear behind objects that are in the footage. I also have matching models for the live action objects that will be in front (collection B) and they are already animated to move exactly like the live action versions. I hope I'm explaining that clearly.

My issue is that I want to only be able to see the live action footage of collection B. I want the collection B 3D models to be transparent, but still occlude collection A so that collection A appears behind the footage of collection B.

I'm not sure that there's actually a way to do this, even with custom material nodes. I've seen posts describing a way to do it with compositing, but I wasn't able to replicate it. I would very much appreciate any help.

I'm on version 2.9, with the eevee engine.

Unfortunately, I can't upload my actual .blend file or screenshots, since this is for work. But as an example, in the screenshot below, I'd like the cube to be completely transparent, and the desert to show through. But I want the piece of the sphere that is covered by the cube to also be transparent, and the desert to show through that as well.

Screenshot 1

Here is my current compositing setup:

Compositing

$\endgroup$
3
  • $\begingroup$ ok, please show us some screenshots, how you want it to be...or even better, upload your blend file. $\endgroup$
    – Chris
    May 19, 2021 at 15:48
  • $\begingroup$ If you use EEVEE, you have to enable the refraction in the render tab and on the material. youtube.com/watch?v=tj6MgfhqOr4 $\endgroup$
    – FFeller
    May 19, 2021 at 16:05
  • $\begingroup$ Chris, see the new edits $\endgroup$ May 19, 2021 at 16:17

2 Answers 2

8
$\begingroup$

I think what you want is a holdout shader. A holdout shader is like a transparent emission shader: wherever it is, it writes transparency (alpha 0). It still gets occluded itself. enter image description here

With the use of a holdout shader, you can then alpha layer your footage that describes both background and foreground objects.

Holdout shaders work both in Eevee and Cycles.

$\endgroup$
4
  • $\begingroup$ Do you know how to do this in Eevee? I have the video rendering in Cycles right now, but it's taking a very long time for each frame and I'd like to try the newer engine. $\endgroup$ May 19, 2021 at 16:40
  • 2
    $\begingroup$ That pic is in Eevee. The only thing it potentially doesn't show is that you need transparency enabled in properties/render/film. $\endgroup$
    – Nathan
    May 19, 2021 at 16:46
  • $\begingroup$ Yes, sorry, I noticed the screenshot after I commented. Thank you so much! $\endgroup$ May 19, 2021 at 16:46
  • $\begingroup$ I didn't know of such a node in the shader editor. Great to know! $\endgroup$ May 19, 2021 at 17:13
2
$\begingroup$

[EDIT: I didn't realize these options are only available when using cycles, not eevee. I won't delete the answer in case someone using cycles is wondering how to do this]

What you need is usually called a 'matte'. In blender it's called a 'shadow catcher' or 'holdout'. Select the object you want to be a matte, and in object properties, under "visibility" check the "Shadow Catcher" or the 'Holdout' box. Use shadow catche if you want to have shadows projected onto the matte object be visible, use holdout if you just want the 'hole' in the alpha with no shadows.

$\endgroup$
5
  • $\begingroup$ I don't see either of those options in the visibility menu. Just "Selectable" and "Show in Viewports/Renders" $\endgroup$ May 19, 2021 at 16:19
  • $\begingroup$ Sorry, you're right! Those options are only available when using cycles, I didn't realize that. $\endgroup$ May 19, 2021 at 16:21
  • $\begingroup$ I just tried what you suggested in Cycles and its exactly what I wanted. I'll see if I can just switch the rendering engine for my project and not break anything. $\endgroup$ May 19, 2021 at 16:24
  • $\begingroup$ Ok, my project seems to work in Cycles. The render just seems like it'll take forever. $\endgroup$ May 19, 2021 at 16:41
  • $\begingroup$ Yes, cycles will usually take a lot longer than eevee to render. Make sure you set GPU compute instead of CPU compute in the "device" in render settings (that is, if you have a GPU), it'll render faster than CPU (still slower than eevee - but usually more realistic result) $\endgroup$ May 19, 2021 at 17:12

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.