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* const renderData = doc->GetActiveRenderData();
MultipassObject* multipass = renderData->GetFirstMultipass();
MultipassObject* depthPass = nullptr;
while (multipass != nullptr)
{
BaseContainer& data = multipass->GetDataInstanceRef();
const Int32 type = data.GetInt32(MULTIPASSOBJECT_TYPE);
if (type == VPBUFFER_DEPTH)
{
depthPass = multipass;
break;
}
multipass = multipass->GetNext();
}
if (depthPass == nullptr)
{
// allocate multipass
depthPass = static_cast<MultipassObject*>(BaseList2D::Alloc(Zmultipass));
if (depthPass == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// set to depth pass
BaseContainer& data = depthPass->GetDataInstanceRef();
// 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 == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
// set to depth pass
BaseContainer& data = depthPass->GetDataInstanceRef();
// insert
renderData->InsertMultipass(depthPass);

Navigate

MultipassObject objects are organized in a list:

// This example loops through all multipasses and prints their names.
RenderData* const renderData = doc->GetActiveRenderData();
MultipassObject* multipass = renderData->GetFirstMultipass();
while (multipass != nullptr)
{
ApplicationOutput("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.
MultipassObject* const multipass = static_cast<MultipassObject*>(BaseList2D::Alloc(Zmultipass));
if (multipass == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
BaseContainer& data = multipass->GetDataInstanceRef();
renderData->InsertMultipass(multipass);

Example blend channel:

// This example creates an blend multipass.
MultipassObject* const multipass = static_cast<MultipassObject*>(BaseList2D::Alloc(Zmultipass));
if (multipass == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
BaseContainer& data = multipass->GetDataInstanceRef();
renderData->InsertMultipass(multipass);

Example reflection channel:

// This example creates a reflection multipass.
MultipassObject* const multipass = static_cast<MultipassObject*>(BaseList2D::Alloc(Zmultipass));
if (multipass == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
BaseContainer& data = multipass->GetDataInstanceRef();
renderData->InsertMultipass(multipass);

Example specular channel:

// This example creates a specular multipass.
MultipassObject* const multipass = static_cast<MultipassObject*>(BaseList2D::Alloc(Zmultipass));
if (multipass == nullptr)
return maxon::OutOfMemoryError(MAXON_SOURCE_LOCATION);
BaseContainer& data = multipass->GetDataInstanceRef();
renderData->InsertMultipass(multipass);

Further Reading

MULTIPASSOBJECT_SPECULAR_SEPARATE_ALL
@ MULTIPASSOBJECT_SPECULAR_SEPARATE_ALL
Definition: zmultipass.h:40
MULTIPASSOBJECT_REFLECTION_SEPARATE_ALL
@ MULTIPASSOBJECT_REFLECTION_SEPARATE_ALL
Definition: zmultipass.h:27
MULTIPASSOBJECT_SPECULAR_MATERIALS
@ MULTIPASSOBJECT_SPECULAR_MATERIALS
Definition: zmultipass.h:38
DescID
Definition: lib_description.h:328
BaseContainer::SetInt32
void SetInt32(Int32 id, Int32 l)
Definition: c4d_basecontainer.h:505
MULTIPASSOBJECT_TYPE
@ MULTIPASSOBJECT_TYPE
Definition: zmultipass.h:6
MAXON_SOURCE_LOCATION
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:66
BaseContainer::SetBool
void SetBool(Int32 id, Bool b)
Definition: c4d_basecontainer.h:498
DESCFLAGS_SET::NONE
@ NONE
None.
RenderData::InsertMultipass
void InsertMultipass(MultipassObject *obj, MultipassObject *pred=nullptr)
BaseList2D::Alloc
static BaseList2D * Alloc(Int32 type)
RDATA_MULTIPASS_ENABLE
@ RDATA_MULTIPASS_ENABLE
Definition: drendersettings.h:330
MSG_UPDATE
#define MSG_UPDATE
Must be sent if the bounding box has to be recalculated. (Otherwise use MSG_CHANGE....
Definition: c4d_baselist.h:340
C4DAtom::SetParameter
Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
BaseList2D::GetDataInstanceRef
const BaseContainer & GetDataInstanceRef() const
Definition: c4d_baselist.h:2329
MULTIPASSOBJECT_SHADOW
@ MULTIPASSOBJECT_SHADOW
Definition: zmultipass.h:16
MultipassObject::GetNext
MultipassObject * GetNext(void)
Definition: c4d_basedocument.h:120
VPBUFFER_SPECULAR
#define VPBUFFER_SPECULAR
Specular multipass channel.
Definition: c4d_videopostdata.h:118
Int32
maxon::Int32 Int32
Definition: ge_sys_math.h:60
ApplicationOutput
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:208
C4DAtom::Message
Bool Message(Int32 type, void *data=nullptr)
Definition: c4d_baselist.h:1424
VPBUFFER_OBJECTBUFFER
#define VPBUFFER_OBJECTBUFFER
Object buffer multipass channel.
Definition: c4d_videopostdata.h:140
VPBUFFER_BLEND
#define VPBUFFER_BLEND
Blend multipass channel.
Definition: c4d_videopostdata.h:150
RenderData::GetFirstMultipass
MultipassObject * GetFirstMultipass()
BaseDocument::GetActiveRenderData
RenderData * GetActiveRenderData(void)
MULTIPASSOBJECT_OBJECTBUFFER
@ MULTIPASSOBJECT_OBJECTBUFFER
Definition: zmultipass.h:8
MULTIPASSOBJECT_REFLECTION_MATERIALS
@ MULTIPASSOBJECT_REFLECTION_MATERIALS
Definition: zmultipass.h:25
VPBUFFER_DEPTH
#define VPBUFFER_DEPTH
Depth multipass channel.
Definition: c4d_videopostdata.h:130
RenderData
Definition: c4d_basedocument.h:136
MultipassObject
Definition: c4d_basedocument.h:105
BaseList2D::GetName
String GetName() const
Definition: c4d_baselist.h:2348
Zmultipass
#define Zmultipass
Definition: ge_prepass.h:1142
MULTIPASSOBJECT_DIFFUSE
@ MULTIPASSOBJECT_DIFFUSE
Definition: zmultipass.h:14
BaseContainer::GetInt32
Int32 GetInt32(Int32 id, Int32 preset=0) const
Definition: c4d_basecontainer.h:303
BaseContainer
Definition: c4d_basecontainer.h:46
VPBUFFER_REFLECTION
#define VPBUFFER_REFLECTION
Reflection multipass channel.
Definition: c4d_videopostdata.h:120