Compositing a Screen with Cinema4D and After Effects



Cinema 4D and After Effects do a pretty good job of working together. In this tutorial, we'll look at using tags, render settings and multipass to composite a screen onto a TV with a bunch of stuff in front of it.

Grab the project file and let's get started.
Download the project here:

85MB file containing
Rendered .MOV, After Effects compositing file export,
Start and Finish C4D files.

Preparation

Okay, open up 3DAmbience.c4d and click the play button. We have a 100-frame animation of a camera move and some text flying around.
In After Effects, we need to add some footage or animation to the TV, but you can see the text is in front of it and the lamp by the sofa passes between the camera and TV.

So first, we need to figure out exactly what we need here to have as easy a time as possible when we get to AE. I can't insist enough how important it is to plan things out before touching anything.

So we'll need:
  • The corners of the TV so we can position the footage.
  • The camera is moving, the screen is sometimes hidden behind itself or by the lamp passing by. We'll need to mask them out.
  • The camera is moving, it would be useful to have it inside After Effects as well.
We know what we need to deal with, so we can get started tackling them:

Corners of the TV for footage

Scroll through the objects and find "Screen" under "TV". This is the black cube that represents the screen.
Right-click and go Cinema 4D Tags > External Compositing Tag.

In the tag's attributes, switch on Solid and set Size X and Size Y to 1920 and 1080 respectively.
The tag is useful in that it will create a solid where the "Cube" object is in relative space.



And we're done with that!

Screen Sometimes Hidden

The position information is nice, but the screen is hidden behind floating letters, and at one point the camera is behind the TV.

For this, we'll need an Object Buffer within multi-pass.

This is basically a black and white representation of whether the object is visible or not. With the Screen object still selected, right-click it in the Object panel and click Cinema 4D Tags > Compositing Tag.

The Compositing tag is useful for things like hiding objects from camera or setting Compositing Backgrounds. But in this case we're going to switch over to the "Object Buffer" tab. Here, check the first Enable box and leave Buffer at 1.




This will now calculate this object's occlusion to the "Object Buffer 1" pass, which is a black and white matte. White where it's visible, black where it isn't. When the camera passes behind the rear wall, the TV object is hidden behind other geometry. It will also turn black when the lamp passes between two objects.

You can have multiple objects and tags feed into the same object buffer, such as having the furniture have Object Buffer 2 and the environs to have Object Buffer 3. But, we don't need that data. We're only working with the display.

Need the Camera in AE

Well, this one's easy, but it requires us to go into Render Settings, and we're going to have to setup the rest of the settings in the process.
Our first foray into Render > Render Settings... , we'll go to the "Save" section and twirl open "Compositing Project File".
Check the Include 3D Data box. That's what we need fr. We shouldn't hit the "Save Project File" button yet as we need to setup the multipass first.



Okay, let's take care of the rest.

Render Settings

So, Render > Render Settings...
Let's set up the passes first.



Check the Multi-Pass setting right below Save, then click the Multi-Pass... button and click Object Buffer. The default is a Group ID of 1, which is the one we set in the Compositing tag. (Sadly, we can't name Object Buffers yet. Please, MAXON!)


Under Save, set your File location. You can type in \ followed by a name to save a file in the same location as the Project File. So, \Render

Next is the multipass. I'll type "\Render OB", since I know that's the only pass I need from this. We've already covered setting up the basic "specular, diffuse, shadow" passes and separating lights, there's no need for that here. We only need the Object Buffer.

As for the file formats, I like to use QuickTime Movies for short renders like this one. Feel free to use image sequences or any format you like.

So, under Format choose QuickTime Movie near the bottom.
Click Options and set the Compression type to PNG. Click OK.

Make the same changes to the Multipass Format setting.

Go to Output and set a 1920 x 1080 as Width and Height. Then, set Frame Range to All Frames.


Finally, when we're sure everything is ready, we come back to Save and under Compositing Project File, click the Save Project File button to export an .aec file. This is what we'll import into After Effects later. We're doing this last because the export will reference our Output settings and where the files are rendering to. So we had to fill those in first.
Right when the render is done, Cinema will save a .aec file with the same name, I tend to do this so I can name the file myself.

We're good to go. Hit Render > Render in Picture Viewer and grab a cup of tea.

Render Time

It's a good idea to check what's going on in the Renderer. Luckily, we can do some looking around while C4D continues rendering the frames.
Go to the Layer tab. You'll see we have a few layers here. Select Single Pass and select Object Buffer 1.



This will show us what's going on in it. Around frame 21 you'll see it goes completely black. This is because the screen is now hidden behind the cube. If not, check where you placed your Compositing Tag. If it is, we wait for it to finish so we can get to the After Effects part!

AFTER EFFECTS!

Before launching, ensure that you have the .aec Importer installed. If not, follow this quick guide.

Okay, launch AE and go File > Import. Navigate to where you saved the .aec and hit Import.

Something interesting will appear:


The .aec has imported and sorted everything, as well as creating a "Render" comp. Named after my file with all the settings of duration, comp size and framerate set.

Let's open the comp by double-clicking it.

First off, your comp is probably completely red. We'll fix that in a second, but look at the Timeline!


Cool! We have an animated camera, doing exactly what the one in Cinema4D was doing, as well as the Screen solid we added with the External Compositing Tag. The name of this solid will always match the name of the object the tag was on.
We have the "Render.mov" file, the final render, underneath everything.
We also have all the lights from the scene. We won't need these at this point, so we can switch them off.

The Screen



Now, Screen is the layer taking up the whole screen because we set the screen to 1920 x 1080, and this comp is the same size. Hit "S" to show the Scale and scale it down to fit the screen in the render, that's about 32%.

Now, watch the composition. Notice that the Screen layer fits the screen perfectly, but the letters are passing behind it. That's not good.



This is where the Object Buffer comes in.

Find it in the Project panel and place it above the Red Screen, then set the Screen's Track Matte to Luma Matte. (Hit F4 or Toggle Switches and Modes if you can't see the setting)


Now watch how the lamp and letters all pass in front of the screen.

Add Footage

Adding the footage is going to be pretty easy. Select "Screen" and go Layer > Precompose...


Ensure that you're in "Leave all attributes". This will leave the 3D positioning and any animations in the current comp, and make the pre-comp the flat red layer. Check "Open New Comp".
Click OK and the TV Screen precomp will open, where you'll find the red Screen layer. If its in perspective, double-check your pre-compositing.

Go to File > Import and import anything you'd like to go on the screen. You could also go HAM and create your own animation within this pre-comp.
To keep things simple, I'm going to bring in some stock footage I shot some time back.


Now all I have to do is drop the footage in the "Screen" precomp then I can switch back to the "Render" comp and check things out.


Awesome! Let's check the back of the screen by moving the time:


Cool. It all works out!

What more can we do?

Well, feel free to add further effects and styles using Adjustment Layers and so on.
You also have position information and a moving camera, which will allow you to add more motion graphics elements to spice up the scene.
For example, add a new text layer, make it 3D and parent it to the Screen layer. Set its position to [0,0,0].
It will now center on the screen. You can use the move tool to move it to the top or right side of the screen and it will stick to that position (as long as you don't move it in Z).
Other adjustments will probably require other object buffers of the chairs and lights to cover them up, but now you know how to get that info.



Don't forget to always check exactly what you need before rendering a multipass with one of these special passes. There's no need for extra files and information that you don't see yourself using.

Thanks!
Drop your questions in the comments below for anything you need help with.

Comments

Popular Posts