Finding your way through the complexities of automatic file naming for Redshift using C4D tokens is tricky. Let’s start at the beginning…

C4D file naming tokens

With the launch of C4D R17 Maxon introduced tokens. Tokens are variables for attributes you can use to automatically name your rendered files.

Listed below are the default tokens included with R17, which remain unchanged todate:

$camera Current Camera – MyCamera
$frame Current Frame – 0000
$pass Current Pass Name – MyPass
$userpass Current Pass Name (User Defined) – MyUserPass
$take CurrentTake Name – My Take
$range Frame Range – 000-000
$fps FrameRate – 00
$prj Project Name – MyDocument
$rs Render Settings – MyRenderSettings
$res Resolution – 0000×0000

These tokens were a start, but many basic options were missing – dates and times being the most obvious. Fortunately the team at Cineversity came up trumps and published ‘CV-tokens’ – a set of additional tokens that could be added to your C4D installation.

At the time of writing (June 2020) you can still download CV-tokens from:
https://www.cineversity.com/vidplaylist/cineversity_resources/cv-tokens_install
Click the ‘Files’ button below the video to download. Unzip the file and add it to your plugins folder.

CV-tokens adds the following:

$cvComputer Computer Name [CV] – Computer Name
$DD Date Day [CV] – 03
$hh Date Hour [CV] – 09
$mm Date Minute [CV] – 59
$MM Date Month [CV] – 09
$ss Date Second {CV] – 59
$YY Date Year(2) {CV] – 19
$YYYY Date Year(4) {CV] – 2019
$cv01 Increment 2-digit [CV] – 01
$cv001 Increment l-digit [CV] – 001
$cv0001 Increment 4-digit [CV] – ll001
$cvUsername OS Username [CV] – User Name
$cvPhySampler Physical Sampler [CV] – Adaptive
$cvAuthor Project Author [CV] – Author Name
$cvRenderer Render Engine [CV] – Physical
$cvHeight Render Height I Yres [CV] – 1080
$cvTake Take Hierarchy [CV] – ParentTake_Take
$cvParentTake Take Parent [CV] – Parent Take

With CV-tokens on board, automatic file naming is much more useful. You can create a token string such as:

$prj_$YY$MM$DD_$hh$mm$ss_$camera_$take

…paste it into the Render settings > Save file field slot, tick ‘Save’ – and then whenever you render you’ll get an automatic file name based on that info, eg:

myProject_200101_120000_Camera1_main

Save that token string in a “new.c4d” template file saved in your ‘Program Files > Maxon Cinema 4D version’ folder and you’ll never have to name a file again! Well, almost never : )

Redshift: The tale of four file paths

So, you’re working with Redshift and you want to employ C4D tokens for automatic file naming. First, you need to get to grips with the not-so-simple Redshift file naming set up.

Let’s say you want to output the following sets of files:

  • A regular image (RI) in exr format.
  • A multi-pass image (MP) in multi-layer exr format – to contain a variety of AOV passes.
  • A cryptomatte – for object or material selections.

Regular and Multi-pass Image saves

Setting up tokens for the RI and MP saves is fairly straightforward. I like to create a folder for my renders named after the project itself, and some subfolders. I then like to name my files with the project name, the date and time, the ‘take’ name, and RI or MP to identify the file. So my C4D token strings are:

for the Regular image save:
./$prj_renders/RI/$prj_$YY$MM$DD_T$hh$mm$ss_$take_RI

for the Multi-pass image save:
./$prj_renders/MP/$prj_$YY$MM$DD_T$hh$mm$ss_$take_MP

The first two parts of the string create a folder in the same directory as the project file named:
“myProject renders” and within that a subfolder named “RI” for the Regular images, and “MP” for the Multi-pass images.

I set the format for both these files to OpenEXR 16 Bit float with DWAA or DWAB compression.

The AOV and Cryptomatte saves

Redshit can save AOV’s via two routes – using C4D’s built in multi-pass system, a “multi-pass AOV”; or directly through Redshift’s own file management system, a “Direct AOV”.

Most AOV’s can be saved using C4D’s built-in multipass system. To do that simply tick the ‘Multi-pass’ box for the relevant AOV in the AOV manager. Those AOV’s will be saved as part of the multi-pass file, whose name you’ve already specified on the Render settings save page.

However, the structure of the Cryptomatte AOV means it can’t be saved as part of a multi-pass file. It has to be saved through the ‘Direct’ system as an independent exr. To do this you’ll need to tick the ‘Direct’ box, rather than the Multi-pass box in the AOV manager.

So, where do you specify the Cryptomatte filename – or that for any other ‘Direct’ AOV? In the Render settings > Redshift > AOV tab you’ll find a ‘filename’ field near the top of the page. This filename field is only relevant to the saving of Direct AOV’s. It provides the base filename for that output. This base file name is combined with the file path from the RI file path you specify on the Render settings page. For the base AOV filename I use:

../DAOV/$prj_$YY$MM$DD_T$hh$mm$ss_$take_AOV

This creates an DAOV (Direct-AOV) subfolder in my renders folder, and a file named with the date, time, take, and “_AOV” at the end. But that’s not all you need. In the AOV manager – for the Cryptomatte or any other direct AOV – you’ll find a Direct Output > Path field. Its default is:

$filepath$filename_$pass

The $filepath and $filename reference back to the RI file path and AOV file name token strings you specified earlier. The direct AOV gets saved by combining:

the Regular Image (RI) file path
the AOV base file name
and the AOV name: $pass – ‘Cryptomatte’ in this case

The time-stamp conundrum

There are a couple of approaches you might consider to automatically date and time stamp (D&TS) your renders. You could D&TS the files themselves, or the containing folders. Naming the files with a D&TS is not a problem – the token sequence I’ve given above does that. However, trying to D&TS folders can can an issue if you are outputting ‘Direct’ AOV’s. Consider the following token string:

./$prj_renders_$YY$MM$DD_T$hh$mm$ss/MP/$prj_$take_MP

This aims to D&TS the containing folder. That works for C4D multi-pass output because the date and time stamp are recorded at the start of the render run – and remain fixed for that run, so your folder would be a name such as:

myProject_renders_200101_T120000

The problem comes with direct output AOV’s – such as Cryptomatte. With the direct output method Redshift D&TSs the AOV file at the time of saving – not at the start of the overall render run. The system then looks to see if there is a folder with a matching D&TS. There isn’t because the previously created folder has an earlier D&TS – so it creates one and saves the AOV inside. This on-going D&TS process means you get a folder for every single AOV… probably not what you want.

So I don’t think it’s currently possible to D&TS folders in a useful way, in the context of ‘Direct’ AOV output.