[C4DtoA] How can I make my background object visible in refractions?


You can’t. The background object isn’t visible in refractions. Or reflections, or anything but camera rays.

Here’s an example: a refractive sphere in front of a torus, in front of the background checkerboard object. The black areas are where the background object isn’t visible to refraction rays.

c4d_background_object_refraction

The “background object” is actually a shader plugged into the Arnold background slot.

You won’t see it in Cinema 4D, but when C4DtoA translates the scene to Arnold, the background object is translated as a shader plugged into the options.background parameter (in Cinema 4D, this is the Environment > Background parameter in the Render Settings).

In an ASS file, it looks like this:

options
{
background "c4d|Background"
}

image_plane
{
 name c4d|Background
 color c4d|Arnold_Shader_Network|checkerboard
 lenx 1
 leny 1
 ox 0
 oy 0
}

The image_plane node is a shader, and if you were to check its code, you’d see that it handles camera rays only; for any other ray type (like refraction), the image_plane shader returns black.

shader_evaluate 
{ 
    if (!(sg->Rt & AI_RAY_CAMERA)) 
    {
        sg->out.RGBA = AI_RGBA_BLACK;
        return; 
    }

 

Setting the procedural’s load_at_init parameter to true would also fix this.


There’s an Arnold error that recommends setting the load_at_init parameter, but people don’t always know where to find that in their favorite Arnold plugin.

ERROR| [proc] c4d|Arnold_Procedural: bounds supplied to procedural node are not large enough to contain the actual underlying geometry.
Replace given bounds: (-1, -1, -1) X (1, 1, 1), with: (-9.4028616, -9.43616867, -9.21633244) X (9.3304739, 9.43616867, 9.21633244).
Setting the procedural's load_at_init parameter to true would also fix this.

The load_at_init parameter controls whether the procedural (standin) is loaded during scene intialization (before rendering starts), or during rendering (when a ray hits the procedural bounding box).

By default, load_at_init is false, which means that procedural loading is deferred until render time.

And so, in MtoA, C4DtoA, and SItoA, the load_at_init parameter is exposed as Defer Standin Load, which is enabled by default. In HtoA, you have a Load At Init parameter on for the Arnold Procedural node.

[C4DtoA] Understanding shaders and AOVs


Arnold takes care of writing the built-in AOVs like N, P, Pref, A, and the all-important beauty. But it’s shaders that write to AOVs like direct_diffuse. That’s why something like this is not going to give you what you might expect in the AOVs:

layer_colors

layer_color doesn’t write to AOVs, so you won’t see the layered result in an AOV like direct_diffuse. standard does write to the direct_diffuse AOV (and others), but in this setup, you have multiple standards and they end up overwriting each other, so you get just the last standard output in the AOVs.

It’s better practice to avoid having multiple standard nodes in a single material; instead, layer the maps that go into the standard parameters like the diffuse and specular colors.

Or you could use a node like mix, or the third-party alLayer, which support AOVs. You can tell if a node writes AOVs by looking at its Attribute Editor: there’s usually a tab or list where you can change the names of the AOV outputs.

mix_aovs

[C4DtoA] Installing C4DtoA in a custom location


The C4DtoA installer puts the C4DtoA plugin in the default location: the plugins folder of the Cinema 4D install.

If you want to put C4DtoA somewhere else, like a shared network location, you can use the C4D_PLUGINS_DIR environment variable to point to your custom plugin location.

For example, on Windows I moved C4DtoA to a different drive and then set my environment like this:

set C4D_PLUGINS_DIR=F:\plugins
set PATH=F:/plugins/C4DtoA/arnold/bin;%PATH%

Note that I had to set PATH so C4D could find ai.dll, and that I had to use forward slashes (on Windows, C4D doesn’t like backslashes in the PATH and drops them).

On Windows, the C4DtoA installer puts a second copy of ai.dll in the C:\Program Files\MAXON\CINEMA 4D R17, so you’ll have to remove that ai.dll, and use PATH to point to the ai.dll in the C4DtoA arnold/bin folder.