Cinema 4D / BodyPaint 3D Program Documentation Tutorials Cinema 4D - After Effects Integration Tutorial
Function available in CINEMA 4D Prime, Visualize, Broadcast, Studio & BodyPaint 3D

Setting up the 3D Scene in Cinema 4D

Open the following scene that we have set up to begin:


The scene contains a relatively complex cityscape in the future, inspired by well-known science-fiction movies. Even though the scene will look good when simply rendered in Cinema 4D there are numerous effects and elements that will be added after the scene has been rendered - a video wall or a billboard advertisement, for example. Of course we could add these elements directly in Cinema 4D but this tutorial is about integrating After Effects into the workflow and achieving the greatest degree of flexibility possible. An example of how such flexibility can be of advantage in an everyday workflow would be that your client must first acquire approval or rights of use for certain material to be included in the scene. A close integration of Cinema 4D and After Effects makes it possible to exchange specific elements in a scene at very short notice without having to re-render part or all of the scene in Cinema 4D.

There are, however, some rules that need to be followed. For example, you must decide which elements will be affected and the Edit Render Settings... must be defined accordingly.

All Cameras and Lights must be output as objects and the Include 3D Data parameter must be enabled in the Render Settings … menu when a Cinema 4D file is saved as a Compositing Project File. For example, in After Effects you will have the same camera path and location of the lights will be analog. However, you should be aware of the fact that the cameras in After Effects are "baked", which means that each frame of the camera animation has a keyframe and the animation can therefore not be modified in After Effects.

If you want to add depth-of-field, this should be defined in the Camera object’s settings. To do so, select the camera in the Object Manager and switch to its Depth tab in the Attribute Manager.... Here you can define the size of the front and/or rear blur. For our tutorial, enable DOF Map Rear Blur and set its Start value to 0 and its End value to 4000. This range can best be seen in the top view, as shown in the second image below.

Important tags that work well together in compositing

In order to edit specific objects or elements in compositing, tags are required. In principle, the two tags needed for this are the Compositing tag and the External Compositing tag. In order to later add "content" to the "Print_Billboard" and "Video_Billboard" surfaces the coordinates of each object must also be exported. This is done by dragging an External Compositing tag onto the "Billboard_Surface" object, which will exist as a 3D plane in subsequent compositing.

In the tag settings you can now define which Anchor Point the plane should have and whether or not it should be a Solid with a specific Size or Color.

When defining the size it is helpful to orient yourself according to the dimensions of the object. However, this is something that can be modified later in compositing, if necessary. This object will then be a 3D plane in After Effects that lies exactly at the defined coordinates. Since the same camera animation is present in compositing the impression is made that this plane actually lies on the object in 3D space. Furthermore, three Spot lights illuminate the billboard. Because light sources are also real lights in compositing they will illuminate the 3D plane accordingly. Add an External Compositing tag to the video billboard object "Video_Content" because this surface will also be replaced later.

Because our spaceship will fly in front of and over this plane, thereby covering it partly, we must make sure that this is also accounted for in compositing. This is why we will now add a Compositing tag to the "Video_Content" object.

Primarily used to define various render settings, this tag also lets you assign an Buffer ID to the object in question. This lets you integrate the object into up to 12 different Object Buffers. The Buffer ID’s themselves can be modified, letting you add any number of Object Buffers to a scene, of which a single object can belong to 12. For our example, activate the Object Buffer number 9. When the scene is rendered, this Object Buffer will create its own alpha channel the matches the object exactly and also takes into account the passing spaceship, masking it correctly. In addition, add a Compositing tag to the "Billboard_Surface" object and enable the Object Buffer number 8.

These separate alpha channels also make scaling the plane easier in compositing. Everything that is "larger" than the alpha channel will be masked out and the dimensions, or edges, will always match the outline of the object. The Object Buffer will be rendered for all objects to which this particular Buffer ID is assigned. If, for example, several objects have the same ID they will all be included in that channel.

Next, add an External Compositing tag and a Compositing tag to the spaceship and enable each tag’s Object Buffer with the ID 1.

You can also assign Compositing tags to such objects as warning lights on antennae or orientation lights on the corners of buildings and enable their Buffer Channels with IDs 4 through 7. This gives you the option of changing the color of the lights, add effects or even let them blink or pulsate in the compositing phase.

Render settings for Multi-Pass and Compositing Project Files

Save

The correct definition of the parameters in the Edit Render Settings... menu is very important. First off, the correct Output format should be selected and the Frame Rate and Frame Range defined.

In the Save menu you can define the file name or if the scene should be rendered as a movie or as sequential images in the Format menu. This can be of relevance when working on larger productions because these usually require the output of individual sequential images. These can, for example, be output as PSD or TIFF in either 8 bit/Channel, 16 bit/Channel or 32 bit/Channel Depth, thus offering more flexibility when color grading and the greater color depth helps avoid banding (visible overlapping of color). Another positive side-effect of outputting a scene as a sequence of images is the ability to continue rendering at a certain point along the animation, e.g., if the computer or software crashes. This ensures that the previously rendered material is not rendered useless, which would be the case if the scene were output in a movie format. The advantage of rendering in a movie format (e.g., QuickTime) is that you only have to deal with a single file (the complete movie) and a movie offers slightly better performance in compositing. For our example, the QuickTime option will suffice.

The Compositing Project File option ensures that all Multi-Pass renderings can be consolidated easily and combined with the correct layer copy mode in the project file, without having to import all assets and channels individually. Additionally enabling the Include 3D Data option will pass this information on to the target application, ensuring that cameras, lights and layers are included. Of course this option can be left disabled, if desired. In our example, our scene will be subsequently edited in After Effects CS4. Therefore, select After Effects as the Target Application. The AEC project file will then be saved to the target folder when rendered. This file can also be generated manually by selecting the Save Project … command (File menu).

Multi-Pass

Multi-Pass is also an important option. With it you can define when and if a channel should be output as a separate pass. You can also define how and in which Format the files should be saved, which bears the advantages and disadvantages explained above. Select QuickTime Film as the output Format. The remaining parameters can be left as they are.

You can also select Separate Lights as an option, which defines which or how many separate channels should be output. For example, everything can be included in a single channel (1 Channel: Diffuse+Specular+Shadow) or three separate channels for Diffuse, Specular and Shadow (3 Channels: Diffuse+Specular+Shadow), which offers the greatest degree of flexibility in compositing.

But how can this option be applied in everyday use? If enabled, you can, for example, subsequently adjust the strength of individual lights or even disable them altogether, thus affecting the lighting of the scene immensely without having to re-render the scene. In order to generate multiple channels in the first place they must be added and enabled accordingly. To do so, click on the Multi-Pass … button at the bottom of the Render Settings …  window. A list will appear in which all Multi-Pass options are displayed and can be selected. If you’re not sure which one(s) to select you can click on the Add All option, which will add all image and material channels. Adding all channels will only nominally increase your scene’s overall file size and any superfluous channels can be subsequently removed. It’s always better to have a few channels you don’t need than not having enough after you have rendered the scene!

Object channels, however, must always be added manually and their IDs defined. To do so, click on Multi-Pass … and select Object Buffer. You can then define an individual Object Buffer via the Group ID option at the right. In our example we will require a total of 9 individual Object Buffers, therefore the Group IDs should range from 1 to 9.

We would like to point out the Motion Vector and Depth Buffers in particular. The Motion Vector is a pass that contains movement and velocity information and can be used by third-party plugins in After Effects to create high-quality motion blur. The Depth Buffer refers to the depth parameters that we previously modified for the Camera object. This Buffer generates a grayscale image of the scene in which the objects nearest to the camera are displayed black and those farther away from the camera become progressively lighter - with the object(s) farthest from the camera being displayed white. This information can also be output for compositing purposes in order to subsequently create a depth of field effect. Finally, select the Glow effect from the Effect …  menu so the spaceship’s engines can be made to glow, for example (this can also be modified or removed in the compositing phase).

Before we render the scene we need to adjust the Anti-Aliasing parameter. Make sure it is set to Best and that the Filter parameter is set to Animation or Still Image. The Animation option differs from the Still Image option in that it is somewhat softer, which offers better results for movies.

Now you can render the animation via the Render menu’s Render to Picture Viewer command. You should view the rendered result in the Picture Viewer... where you can make sure that each Buffer has been set up and rendered correctly. If you discover an error you can halt the rendering and edit the scene accordingly.

Click on the following link to open the finished scene:


Continue …