Reference Cinema 4D Cinema 4D Prime Configuration Information for administrators
Function available in CINEMA 4D Prime, Visualize, Broadcast, Studio & BodyPaint 3D

Cinema 4D and the Command Line

Starting Cinema 4D via the Command Line

Cinema 4D can be started via the command line. This is useful if you want to control render functions using other software (e.g., render farm software). A Windows system is used in the example described below (references for Macintosh users are listed subsequently).

Enter the following to start Cinema 4D via the command line (this and all other paths must be enclosed in double quotation marks - here represented by ’ ):

"c:\programs\MAXON\Cinema 4D\Commandline.exe"

RELEASE 16

Tip:
C:\programs\MAXON\Cinema 4D\Cinema 4D.exe can also be used. However, Commandline.exe, which is installed in the installation directory in Cinema 4D R16 or later versions, is recommended because it also starts without the application interface and always leaves a console open.

For "c:\Programme\MAXON\Cinema 4D\" enter your individual path to the executable file.

-render

Example: "c:\programs\MAXON\Cinema 4D\Commandline.exe" -render "c:\scenes\hajopei.c4d"

This command will render the scene hajopei.c4d, located in the "c:\scenes" directory. The render settings already defined in Cinema 4D will be used.

RELEASE 17

-take

Example: "c:\Programme\MAXON\Cinema 4D\Commandline.exe" -render "c:\Szenen\hajopei.c4d" -take front

This command renders a specific Take. In this example it’s the Take named ,front’.

-frame

Example: "c:\programs\MAXON\Cinema 4D\Commandline.exe" -render "c:\scenes\hajopei.c4d" -frame 100 150 10

This command will render every 10th frame from frame 100 to 150. If 150 and 10 were not included in the command line, only frame 100 would be rendered. This command will override any scene settings.

-oimage

Example: "c:\programs\MAXON\Cinema 4D\Commandline.exe" -render "c:\scenes\hajopei.c4d" -oimage "d:\images\framename"

This will overwrite the save path for the scene file hajopei.c4d and render to the "d:\images" directory. The files will be named according to framename. Sequential frame numbers will be added automatically.

-oMulti-Pass

Example: "c:\programs\MAXON\Cinema 4D\Commandline.exe" -render "c:\scenes\hajopei.c4d" -oMulti-Pass "c:\mp\passes.psd"

This will overwrite the scene’s Multi-Pass path and save the Multi-Pass to the "c:\mp\" directory. Sequential frame numbers and Multi-Pass names will be added automatically.

-oformat

Example: "c:\programs\MAXON\Cinema 4D\Commandline.exe" -render "c:\scenes\hajopei.c4d -oformat JPG"

-oformat JPG

The output format defined in the scene file itself can be replaced with one of the following formats: TIFF, TGA, BMP, IFF, JPG, PICT, PSE, RLA, RPF, B3D.

-oresolution

Example: "c:\programs\MAXON\Cinema 4D\Commandline.exe" -render "c:\scenes\hajopei.c4d" -oresolution 800 600"

This will overwrite the render size as defined in the hajopei.c4d scene file. In this case the render output will have a resolution of 800 x 600.

-threads

Example: "c:\programs\MAXON\Cinema 4D\Commandline.exe" -render "c:\scenes\hajopei.c4d" -threads 2"

This defines the number of threads. 0 is the optimal number of threads.

RELEASE 16

g_logfile=[string]

Example: c:\Programs\MAXON\Cinema 4D\Commandline.exe - render c\Scenes\hajopei.c4d -g_logfile= c:\Report.txt

All information regarding render progress will be saved in a file on the hard drive (in this case Report.txt on your c: drive).

The following commands, with the exception of -help, are less useful when using the Commandline option and only have a function if the Cinema 4D (or BodyPaint 3D executable file iw used with the options described.

-help

Launches a brief description of supported commands

-noopengl

Deactivates Hardware OpenGL

Tip:
Make sure that this command comes first. Otherwise, new window may still be opened.

-nogui

Starts Cinema 4D without a GUI (interface)

-parallel

Example: "c:\Programme\MAXON\Cinema 4D\Cinema 4D.exe" -parallel

Use this command to initiate several Cinema 4D applications simultaneously.

-title

Windows only: "c:\programs\MAXON\Cinema 4D\Cinema 4D.exe" -title "Name"

This command assigns a name to a Cinema 4D window. This name will be displayed at the top left of the Cinema 4D window and in the task bar. This makes locating one of several open instances of Cinema 4D much easier using Alt+tab.

-layout

Example: "c:\Programme\MAXON\Cinema 4D\Cinema 4D.exe" -layout "c:\Programme\MAXON\Cinema 4D\library\layout\Modeling.l4d"

Use this command to load a specific layout when starting Cinema 4D. This command is especially useful when used in conjunction with the -parallel command. Each Cinema 4D instance opened can be opened with a different layout.

RELEASE 16

g_prefspath = my directory

Example: "c:\programs\MAXON\Cinema 4D\Cinema 4D.exe" g_prefspath=c:\test"

Normally all user-specific information (e.g., layouts, user settings, etc.) is saved to the user directory, as defined by your operating system (Open Folder button on the Preferences menu’s Common page). This path can be modified using the variable (if the path includes spaces, enclose the entire line in quotation marks).

-license [ip [port]]

Example: "c:\Programs\MAXON\Cinema 4D\CNEMA 4D.exe" -licence 192.168.30.15 5235

This lets you start program instances that access the MAXON License Server (if the server has also been started as a command line instance) or the RLM server (enter the host name instead of the IP address).

Macintosh Systems

The syntax for paths on Macs looks somewhat different. The executable Cinema 4D file can be launched directly from a console window:

1. Right-click on the Cinema 4D.app startup file in your installation directory and select Show Package Contents.

2. Switch to the contents/Mac OS directory.

3. Drag the Cinema 4D file into the terminal window. The correct path will automatically be used.

4. Enter the desired commands (e.g., -render, -nogui, etc.)

5. Drag the scene file to be rendered into the terminal window. Make sure the path is correct.

Additional command line information

The Cinema 4D SDK’s commandlinerender.cpp file should be interesting for render farm operators who use Cinema 4D via command line. This file contains the complete source code for the internal command line rendering (which you can adapt for your own purposes). This file also contains example batch scripts that can be called up on Windows or Mac OSX, excerpts of which are shown below.

To use Cinema 4D within a batch script, the following code can be written (the paths for the executable files must be adapted accordingly). Cinema 4D will then return the RENDERRESULT value as an error code.

====BATCH SCRIPT on Windows====

Commandline.exe -render cube.c4d -oimage test.tif

IF ERRORLEVEL 1 ECHO Error Detected

IF ERRORLEVEL 1000 IF NOT ERRORLEVEL 1001 ECHO Error Message: Project not found

IF ERRORLEVEL 1001 IF NOT ERRORLEVEL 1002 ECHO Error Message: Error loading project

IF ERRORLEVEL 1002 IF NOT ERRORLEVEL 1003 ECHO Error Message: No output file specified

IF ERRORLEVEL 1 IF NOT ERRORLEVEL 2 ECHO Error Message: Out of memory

IF ERRORLEVEL 2 IF NOT ERRORLEVEL 3 ECHO Error Message: Asset missing

IF ERRORLEVEL 5 IF NOT ERRORLEVEL 6 ECHO Error Message: Saving Failed

IF ERRORLEVEL 6 IF NOT ERRORLEVEL 7 ECHO Error Message: User Break

IF ERRORLEVEL 7 IF NOT ERRORLEVEL 8 ECHO Error Message: GI Cache missing

====BATCH SCRIPT on OS X====

#!/usr/bin/env/sh

Commandline.app/Contents/MacOS/Commandline -render cube.c4d -oimage test.tif

if [ "$?" = "0" ]; then

echo "rendering succeeded"

else

echo "rendering failed"

fi