Open Search

    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();
    {
    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
    Definition: c4d_basecontainer.h:48
    Int32 GetInt32(Int32 id, Int32 preset=0) const
    Definition: c4d_basecontainer.h:340
    void SetInt32(Int32 id, Int32 l)
    Definition: c4d_basecontainer.h:579
    const BaseContainer & GetDataInstanceRef() const
    Definition: c4d_baselist.h:2386
    static BaseList2D * Alloc(Int32 type)
    Bool SetParameter(const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
    Bool Message(Int32 type, void *data=nullptr)
    Definition: c4d_baselist.h:1458
    Definition: c4d_basedocument.h:112
    MultipassObject * GetNext()
    Definition: c4d_basedocument.h:126
    Definition: c4d_basedocument.h:143
    MultipassObject * GetFirstMultipass()
    void InsertMultipass(MultipassObject *obj, MultipassObject *pred=nullptr)
    @ RDATA_MULTIPASS_ENABLE
    Definition: drendersettings.h:330
    maxon::Int32 Int32
    Definition: ge_sys_math.h:60
    #define MSG_UPDATE
    Must be sent if the bounding box has to be recalculated. (Otherwise use MSG_CHANGE....
    Definition: c4d_baselist.h:359
    #define MAXON_SOURCE_LOCATION
    Definition: memoryallocationbase.h:67
    #define VPBUFFER_DEPTH
    Depth multipass channel.
    Definition: c4d_videopostdata.h:131
    #define Zmultipass
    Definition: ge_prepass.h:1284
    #define ConstDescID(...)
    Definition: lib_description.h:594
    PyObject ** type
    Definition: pycore_pyerrors.h:34
    const char * doc
    Definition: pyerrors.h:226
    Represents a level within a DescID.
    Definition: lib_description.h:298
    @ MULTIPASSOBJECT_TYPE
    Definition: zmultipass.h:6

    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();
    }
    String GetName() const
    Definition: c4d_baselist.h:2412
    #define ApplicationOutput(formatString,...)
    Definition: debugdiagnostics.h:210

    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);
    #define VPBUFFER_OBJECTBUFFER
    Object buffer multipass channel.
    Definition: c4d_videopostdata.h:141
    @ MULTIPASSOBJECT_OBJECTBUFFER
    Definition: zmultipass.h:8

    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);
    void SetBool(Int32 id, Bool b)
    Definition: c4d_basecontainer.h:572
    #define VPBUFFER_BLEND
    Blend multipass channel.
    Definition: c4d_videopostdata.h:151
    @ MULTIPASSOBJECT_DIFFUSE
    Definition: zmultipass.h:14
    @ MULTIPASSOBJECT_SHADOW
    Definition: zmultipass.h:16

    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);
    #define VPBUFFER_REFLECTION
    Reflection multipass channel.
    Definition: c4d_videopostdata.h:121
    @ MULTIPASSOBJECT_REFLECTION_MATERIALS
    Definition: zmultipass.h:25
    @ MULTIPASSOBJECT_REFLECTION_SEPARATE_ALL
    Definition: zmultipass.h:27

    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);
    #define VPBUFFER_SPECULAR
    Specular multipass channel.
    Definition: c4d_videopostdata.h:119
    @ MULTIPASSOBJECT_SPECULAR_SEPARATE_ALL
    Definition: zmultipass.h:40
    @ MULTIPASSOBJECT_SPECULAR_MATERIALS
    Definition: zmultipass.h:38

    Further Reading