Modifying a material priority

Changing a material priority is very easy, you just need to call the RED::IMaterial::SetPriority function:

// Let imat1, imat2 and imat3 three existing RED::IMaterial.
// Let ishape1, ishape2 and ishape3 three RED::IShape.

// Change the material priorities:
RC_TEST( imat1->SetPriority( 1, iresmgr->GetState() ) );
RC_TEST( imat2->SetPriority( 0, iresmgr->GetState() ) );
// imat3 keeps it default priority.

// Set the material to the shapes:
RC_TEST( ishape1->SetMaterial( mat1, iresmgr->GetState() ) );
RC_TEST( ishape2->SetMaterial( mat2, iresmgr->GetState() ) );
RC_TEST( ishape3->SetMaterial( mat3, iresmgr->GetState() ) );

The previous code sample defines three RED::IMeshShape, each with its own material.

Material priorities are defined as:

The rendering order will be: