Scene Export - Arnold for Cinema4d
Arnold Scene Source (.ass) is Arnold's native scene definition format, stored in human-readable, editable ASCII files that can later be rendered outside of CINEMA 4D with kick (a multi-platform, command-line utility) or used for rendering via procedurals. Besides ASS files Arnold offers writing scenes to Universal Scene Description (USD) format.
Scene Export Dialog
C4DtoA lets you save scenes to ASS or USD files. The scene export dialog can be accessed from the Arnold > Scene Export menu.
The dialog shows Arnold-related options and frame settings described below.
Path
The path where the archive (.ass, .usd, .usda, .usdc) will be saved to. A padding pattern () can be used to save a file sequence (animation). If padding is not specified, .#### is added to the file name automatically. For example /path/to/test.ass will produce /path/to/test.0000.ass, /path/to/test.0001.ass, /path/to/test.0002.ass and so on.
Format
File format, e.g. ASS or USD.
Mode
Set to Scene to export the whole scene, or set to Procedural to export only the selected meshes to be loaded in an Arnold Procedural (stand-in).
Objects
Defines the objects to be exported:
- All: Export all objects (geometries, lights, etc.) from the scene.
- Selected: Export only the selected objects.
- Selected individually: Export the selected objects to separate ASS files. The object name is added to the file name as a suffix (e.g. myexport_Sphere.ass, myexport_Cube.ass, etc.)
Export Object Hierarchy
Exports the whole hierarchy of the selected objects (instead of manually selecting all children).
Replace With Arnold Procedural
Available in Procedural mode. When enabled the exported objects are replaced with an Arnold Procedural object pointing to the exported file.
Absolute Paths
When enabled all paths are exported as absolute paths, even if they are defined as relative in the scene.
ASS
ASS format specific settings.
Gzip Compression (.ass.gz)
Exports the scene directly to gzip-compressed files with the .ass.gz extension. You can expect compression rates in the 4-5x range (compared to full ASCII form, obviously there will be a lower compression ratio if the binary encoding option is being used).
Binary
Specifies whether binary encoding is used to compress large arrays ( bigger than 16) containing float in their components. They are encoded into a more compact ASCII representation (b85), leading to smaller files and faster load times, whilst still being mostly human-readable. In addition, the binary encoding has exact 32-bit precision, whereas without this binary output floating-point values are truncated into at most 8 ASCII digits (e.g. 1234.5678). The encoded arrays are indicated by prefixing the array type with "b85" as in the example below. POINT2, POINT, and VECTOR arrays are encoded. 16 float
polymesh
{
name mymesh
nsides 54 1 UINT 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3
vlist 47 1 b85POINT
LJ4iv4THCEE/NV4/1nPCvhpuBkEMk10/LJ4iv2uf+kDVzHI/36OGvhkc/kD9+Fs/LGenvtmU8EDqJVo/l1cGv+Ij50D1 ...
}
Expand Procedurals
Internally, Arnold creates shape nodes from procedural nodes (usually on demand). 'Expand procedurals' expands the nodes before doing the ASS export. Therefore when saving .ass file you will get all of the nodes that have been created by the procedural.
USD
USD format specific settings.
Binary
Specifies whether the output USD file is binary-encoded (.usd) or ASCII text based (.usda).
Include
Specifies which of the following node types are included in the export:
- Option
- Cameras
- Lights
- Shapes
- Shaders
- Drivers
- Filters
Animation
Frame Range
Specifies the range of frames to be exported:
- Use render settings: frames specified for render (Render Setting / Output) will be exported.
- Current frame: exports only the current frame.
- Custom: exports frames specified by the Frame start/end/step settings.
Frame Start
Specifies the start frame of the sequence to be exported in custom mode.
Frame End
Specifies the end frame of the sequence to be exported in custom mode.
Frame Step
The increment between the frames to be exported in custom mode.
Currently, animation can not be written to a single USD file, a different file is created for each frame.
Scene Export from command line
Scene export can be executed from the command line as well via the -arnoldSceneExport parameter followed by the export options.
The following options are available:
- scene: Path of the C4D scene file which needs to be exported. This parameter is mandatory.
- format: Output file format, ASS or USD. If not specified, the plugin guesses the format from the file extension.
- filename: Path of the output file. If not given, the file is written next to the c4d scene file.
- compressed: If given the scene is exported directly to gzip-compressed files (.ass.gz). Only for ASS format.
- asciiAss: If given values exported to a standard text format, if not given (default) binary encoding is used. Only for ASS format.
- expandProcedurals: If given procedurals will be expanded before exporting the scene.
- exportObjectHierarchy: If given the whole hierarchy (children) of the selected objects is exported.
- mask: Specifies which Arnold node types are included in the .ass export. See the AtNodeEntry page of the Arnold API for the available node types.
- exportType: S pecifies which objects are exported. Possible values are:
- 0: all
- 1: selected
- 2: selected individually
- startFrame: Specifies the start frame to be exported. When not given Start Frame from the render settings is used.
- endFrame: Specifies the end frame to be exported. When not given End Frame from the render settings is used.
- frameStep: Specifies the increment between frames. When not given Frame Step from the render settings is used.
- camera: You can override active scene camera by this option by specifying the name of the camera. Note that camera names must be unique otherwise always the first camera with the same name is used.
- take: Specifies the take to be exported. Alternatively you can use the
-take
argument instead of this option.
For example, the following command exports frame range 10-20 of myscene.c4d to myscene.ass:
Commandline.exe -arnoldSceneExport "scene=c:\path\to\myscene.c4d;format=ASS;filename=c:\path\to\myscene.ass;startFrame=10;endFrame=20"
Note that on Windows the export is executed in the background, therefore, you have no output in the console. You can redirect the output to a file using the >
directive as follows:
Commandline.exe -arnoldSceneExport "scene=c:\path\to\myscene.c4d;format=ASS;filename=c:\path\to\myscene.ass;startFrame=10;endFrame=20" > export.log 2>&1
Scene Export from python
The arnold.scene module in the C4DtoA python API offers a convenient method to export the Cinema 4D scene to an Arnold ASS or USD file.
Export(doc, filename, fileFormat, compressed, bbox, binary, expandProcedurals, mask, startFrame, endFrame, stepFrame, objectMode, exportObjectHierarchy, replaceWithProcedural)
Available options:
- doc (c4d.documents.BaseDocument): The scene to export.
- filename (str): Path of the output file. If None, the file is exported next to the c4d scene file.
- fileFormat (int): Output file format. If None, the format is guessed from the filename. Available values are:
arnold.scene.SCENE_EXPORT_FORMAT_ASS
arnold.scene.SCENE_EXPORT_FORMAT_USD
- compressed (boolean): If true the scene is exported directly to gzip-compressed files (.ass.gz).
- bbox (boolean): If true bounding box of the scene are added to the ASS meta data.
- binary (boolean): If true binary encoding is used.
- expandProcedurals (boolean): If true procedurals will be expanded before exporting the scene.
- mask (int): Specifies which Arnold node types are included in the output. See the AtNodeEntry page of the Arnold API for the available node types.
- startFrame (int): Specifies the first frame when exporting an animation. If None, the scene's render settings will be used.
- endFrame (int): Specifies the last frame when exporting an animation. If None, the scene's render settings will be used.
- stepFrame (int): Specifies the increment between frames when exporting an animation. If None, the scene's render settings will be used.
- objectMode (int): Specifies which objects are exported (all, selected, selected individually). Available values are:
arnold.scene.SCENE_EXPORT_OBJECT_MODE_ALL
arnold.scene.SCENE_EXPORT_OBJECT_MODE_SELECTED
arnold.scene.SCENE_EXPORT_OBJECT_MODE_SELECTED_INDIVIDUALLY
- exportObjectHierarchy (boolean): If true, exports the whole hierarchy (children) in 'selected' object mode.
- replaceWithProcedural (boolean): If true, replaces the exported objects with an Arnold Procedural pointing to the exported file.
Example
import arnold.scene as arnold_scene
# export the current scene to ASS
arnold_scene.Export(doc, "/path/to/my/scene.ass", binary = False)
# export frame 10, 11 and 12 to USD
arnold_scene.Export(doc, "c:\\path\\to\\my\\scene.usd", startFrame = 10, endFrame = 12)