About

A MultipassObject represents a multipass element of the render settings. Cinema 4D's render engines will render and save different multipasses based on these settings.

MultipassObject objects are an instance of Zmultipass.

// This example searches for the "depth" multipass.
// If it is not found, it will be created.
RenderData* renderData = doc->GetActiveRenderData();
MultipassObject* multipass = renderData->GetFirstMultipass();
MultipassObject* depthPass = nullptr;
while (multipass)
{
BaseContainer* data = multipass->GetDataInstance();
const Int32 type = data->GetInt32(MULTIPASSOBJECT_TYPE);
if (type == VPBUFFER_DEPTH)
{
depthPass = multipass;
break;
}
multipass = multipass->GetNext();
}
if (!depthPass)
{
// allocate multipass
depthPass = static_cast<MultipassObject*>(BaseList2D::Alloc(Zmultipass));
if (!depthPass)
return false;
// set to depth pass
BaseContainer* data = depthPass->GetDataInstance();
// insert
renderData->InsertMultipass(depthPass);
renderData->Message(MSG_UPDATE);
}
// enable multi-passes

Access

Existing MultipassObject elements are stored in a list and can be accessed from a RenderData object:

Allocation/Deallocation

The MultipassObject class does not offer a static "Alloc" or "Free" function so the functions of BaseList2D have to be used with Zmultipass.

A newly created MultipassObject is added to the render settings by adding it to the RenderData object:

// allocate multipass
if (!depthPass)
return false;
// set to depth pass
BaseContainer* data = depthPass->GetDataInstance();
// insert
renderData->InsertMultipass(depthPass);

Navigate

MultipassObject objects are organized in a list:

// This example loops through all multipasses and prints their names.
RenderData* renderData = doc->GetActiveRenderData();
MultipassObject* multipass = renderData->GetFirstMultipass();
while (multipass)
{
GePrint("Multipass: " + multipass->GetName());
multipass = multipass->GetNext();
}

Types

All multipasses are MultipassObject objects. They only differ in their parameters. The type of a multipass is defined with:

Simple multipass types are:

Configurable multipass types are:

The parameter IDs of configurable multipasses are defined in zmultipass.h.

Additional multipass types are:

Example object buffer:

// This example creates an object buffer multipass.
if (multipass)
{
BaseContainer* data = multipass->GetDataInstance();
renderData->InsertMultipass(multipass);
}

Example blend channel:

// This example creates an blend multipass.
if (multipass)
{
BaseContainer* data = multipass->GetDataInstance();
renderData->InsertMultipass(multipass);
}

Example reflection channel:

// This example creates a reflection multipass.
if (multipass)
{
BaseContainer* data = multipass->GetDataInstance();
renderData->InsertMultipass(multipass);
}

Example specular channel:

// This example creates a specular multipass.
if (multipass)
{
BaseContainer* data = multipass->GetDataInstance();
renderData->InsertMultipass(multipass);
}

Further Reading