Cinema 4D and 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 ( If a path or file name contains spaces it can help to enclose them in quotation marks):
For c:\Programme\MAXON\Cinema 4D\ enter your individual path to the executable file.
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.
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’.
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.
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.
Example: c:\programs\MAXON\Cinema 4D\Commandline.exe -render c:\scenes\hajopei.c4d -omultipass 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.
Example: c:\programs\MAXON\Cinema 4D\Commandline.exe -render c:\scenes\hajopei.c4d -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.
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.
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.
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.
Launches a brief description of supported commands
Deactivates Hardware OpenGL
Starts Cinema 4D without a GUI (interface)
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.
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.
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).
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.
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====
Commandline.app/Contents/MacOS/Commandline -render cube.c4d -oimage test.tif
if [ $? = 0 ]; then
echo rendering succeeded
echo rendering failed