Solution to Cinema4D cross platform rendering

Some might find this useful:
gabgrenier.tv/site/wp/?p=262

i figured how to get a cross-platform render farm working with Cinema 4D, without Render Path problems

UPDATE: some of the errors, as “Asset missing” is now flagged as an error in Deadline!


I copy-paste my post here:

Solution to C4D + Deadline (cross platform + error handling)
You can use Thinkbox’s Deadline to manage Cinema 4D renders, which is a much more powerful solution than Maxon’s NETrender.
Deadline supports Cinema4D, but you need to tweak it a little. It gets even more complicated if you want to render with both PC and MAC slaves. Here are the steps on how i managed to get it working !
This solution might work with other versions of C4D and Deadline, but these steps are for C4D R14 and Deadline 5.0. Note that you will need a ‘CmdLine’ license to render with C4D through Deadline. Ask a MAXON dealer for a quote. Also, this is my personal workaround that worked for me with my installations, this is not tested, not guaranteed and this may mess up your Deadline installation.

Configuring Deadline to catch Cinema4D R14
If you have R12 or R13, skip this test !

  1. Navigate to your Deadline repository, and open the file “plugins/Cinema4D/Cinema4D.param” in any text editor.
  2. Duplicate the last entry (which says C4D_R13_RenderExecutable)
  3. In this new paragraph, change any “R13″ to “R14″
  4. You should see a line “Index=4″, change it to “Index=5″
    This should look like this: Image 1
    You can also take my version of the file: Cinema4D.param

This file tells Deadline where to find the C4D application, on both MAC & PC.

  1. Now open Deadline monitor, in Superuser mode, go to menu Tools > Configure Plugins
  2. Select Cinema4D in the list on the left
  3. Scroll down until you see the R14 settings
  4. Validate that the paths are there and click OK

Deadline can now catch R14 jobs !

Install the Deadline plugin for Cinema4D

  1. Go to your Deadline repository and copy the file “clientSetup/Cinema4D/SubmitToDeadline.pyp”

  2. Go to your C4D install folder and paste the file in the “plugins” folder
    Mac: /Applications/MAXON/CINEMA 4D R14/plugins
    PC: C:\Program Files\MAXON\Cinema 4D R14\plugins

  3. Start Deadline Slave on your slave machines

  4. Open C4D on your workstation, now in the Plugins menu you have ‘Submit to Deadline’. Use this to shoot your scene in the render farm !
    NOTE: your scene file (.c4d) should be in a network location accessible from all slaves, and do not check the “Submit scene file” option in the Submit to Deadline dialog, as it will not submit the textures needed to render. Also, all the assets you need should be in the ‘tex’ folder next to your C4D scene. This means you might not be able to use 3rd party libraries (ex.: Videocopilot shaders, Greyscale Gorilla packs) unless you install them on all slave machines.

—–
So this should be working, and you should now be able to Submit a C4D scene to your render farm…. if your farm is on the same platform as your workstation (all Mac or all PC). But what happens if you have both Mac and PC computers in your farm? Only the computers with the same platform as the submitted scene will render, the others won’t find the scene and won’t be able to render the rendered frame. Deadline has a solution for loading the scene, but not for the render part. Let’s continue…
—–

Translating paths with Deadline

  1. In Deadline monitor, go to Tools > Configure Repository options
  2. Select “Mapped Path Setup” on the left
    This will tell Deadline to translate the paths, depending on the platform. The logic used is: “If i find this string, and i’m on a PC, replace it to this other string”.
    Let’s assume our network drive (where the c4d scene file is located) is called “X”. On Windows, it is mounted on X:\ and on a Mac, in /Volumes/X/.
    See this screenshot to see how you should configure Deadline to translate the paths from a PC to a Mac, and from a Mac to a PC: Image 2.
    NOTE: you should use regular expressions to look for the “Path to replace”, as a plain text path can cause false positives and mess up the render path.

Done ! Well, for the “Read” part. By setting these paths, Deadline will tell the C4D slaves to open the scene file at the right location and both PC and MAC will be able to read the file. The problem then is that Deadline does not pass the render path to the slaves, so C4D will take the path that you’ve specified in the project to write the result. If you are on a Mac, the path will start with something like this: “/Volumes/X”. On a PC, this path does not exist, it should be “X:\” instead, but since Deadline is not passing the render path to C4D, it cannot translate it. To make it short: we need to re-code some parts of the C4D plugin, in python.

Modify the C4D Deadline plugin
You might need a base of Python coding to understand what happens here, if you don’t you can download my version of the recoded plugin: here. But be careful if you use it, it might break things if you don’t have the same version of Deadline.

  1. Navigate to your Deadline repository
  2. Open the file “plugins/Cinema4D/Cinema4D.py” (make backup of it before)
  3. Under the line “def RenderArgument( self ):” you should add (respecting the python code hierarchy):

outputFile = GetPluginInfoEntryWithDefault(“OutputFile”,GetDataFilename())
outputFile = CheckPathMapping( outputFile )
if IsRunningOnWindows():
outputFile = outputFile.replace( “/”, “\” )
else:
outputFile = outputFile.replace( “\”, “/” )

Screenshot.
4. Under the line “argument += ” -render \”" + sceneFile + “\”"”, add these two lines:

argument += " -oimage “” + outputFile + “”"
argument += " -omultipass “” + outputFile + “”"

Screenshot.
5. Save the file

That’s it for the Cinema4D plugin! Now we need to configure the Submit To Deadline plugin so it passes to Deadline the output path from your C4D scene.

Modify the Submit To Deadline plugin
Again, you can download my version of the plugin here, but it might not work on all Deadline versions…

  1. Navigate to your Deadline repository
  2. Open the file “plugins/submission/SubmitC4DToDeadline.py” (make backup of it before)
  3. Under the line “DepartmentBoxID = 30″, add:

OutputBoxID = 31

Screenshot.
4. Under the line “self.AddTextBoxGroup( self.DepartmentBoxID, “Description” )”, add:

self.AddTextBoxGroup( self.OutputBoxID, “Output Path”)

Screenshot.
5. Under the line “endFrame = scene.GetMaxTime().GetFrame( frameRate )”, add:

renderData = scene.GetActiveRenderData().GetData()
outputFilename = renderData.GetFilename( 5041 )

Screenshot.
6. Under the line “initDepartment = “”", add:

initOutput = outputFilename

Screenshot.
7. Under the line “fileHandle.write( “Version=%s\n” % (c4d.GetC4DVersion() / 1000) )”, add:

fileHandle.write( “OutputFile=%s\n” % output )

Screenshot.
8. Restart Cinema4D to reload the plugin

Now when you submit a scene in Submit To Deadline, you have a new option box to set the output path (see screenshot). It takes the output path specified in your render settings.

You are done! You can now render C4D files in Deadline, with both PC and MAC slaves

NOTE: Multipass files will be handled, but without naming preferences (they will be saved along with the main pass, with the same prefix name, sorry, I didn’t find the way to retrieve this info from C4D, but it is possible so maybe in the future!)

NOTE: Deadline will flag your job as ‘Done’ even if it didn’t rendered… This is a known bug and this is happening on Maxon’s side. To see if a job runs correctly, watch the Deadline Slave log. There is a workaround for that as well: to register some of the output message from C4D as an error to Deadline.

  1. Navigate to your Deadline repository
  2. Open the file “plugins/Cinema4D/Cinema4D.py” (make backup of it before)
  3. Under the line “self.AddStdoutHandler(“.Invalid License from License Server.”,self.HandleStdoutError)”, add:

self.AddStdoutHandler(".Rendering failed.",self.HandleStdoutError)
self.AddStdoutHandler(".Asset missing.",self.HandleStdoutError)

This will register any “Rendering Failed” or “Asset missing” message as an error and tell Deadline that the frame could not be rendered. Warning: this is a workaround and might not cover all error messages, but it helps a little !
Screenshot.

1 Like

Thanks for posting this info! I’m sure others will find it very helpful.

Just wanted to note a few improvements that we’ve made to our C4D support since Deadline 5.0:

  1. Cinema 4D 14 support was added in Deadline 5.2.49424.
  2. In Deadline 5.1.46114, we started including the output paths with the job so that Path Mapping could be performed on them.
  3. In Deadline 5.1.46114, we added the option to Export the C4D scene prior to rendering. This takes the scene file and its assets and puts it on the network so that all machines can see them during rendering. This also automatically disables the option to submit the scene file with the job.

Thanks for these additional handlers. We didn’t have these specific ones yet, so we’ll add them in Deadline 6.

Cheers,

  • Ryan

you could also add:

self.AddStdoutHandler(".Project not found.",self.HandleStdoutError)

thanks

Yup, we had that one already in our current version. :slight_smile:

Cheers,

  • Ryan