Radeon ProRender

Two Sided Materials

Normally, a material attached to a shape will be the same on both sides. To assign different materials to the front side and back side, the Two Sided Material tutorial uses the RPR_MATERIAL_NODE_TWOSIDED node. This node takes the two inputs: ‘frontface’ and ‘backface’. They can describe different materials.

Source code from the tutorial.

// Material used for front face
rpr_material_node materialA = NULL;

CHECK(rprMaterialSystemCreateNode(matsys,RPR_MATERIAL_NODE_DIFFUSE,&materialA));
CHECK(rprMaterialNodeSetInputFByKey(materialA, RPR_MATERIAL_INPUT_COLOR, 1.0f, 0.2f, 0.1f, 0.0f));

// Material used for back face
rpr_material_node materialB = NULL;
CHECK( rprMaterialSystemCreateNode(matsys,RPR_MATERIAL_NODE_DIFFUSE,&materialB));
CHECK( rprMaterialNodeSetInputFByKey(materialB, RPR_MATERIAL_INPUT_COLOR, 0.3f, 0.8f, 1.0f, 0.0f));

// Two sided material taking the front and back materials
rpr_material_node material2sides = NULL;
CHECK( rprMaterialSystemCreateNode(matsys,RPR_MATERIAL_NODE_TWOSIDED,&material2sides));
CHECK( rprMaterialNodeSetInputNByKey(material2sides, RPR_MATERIAL_INPUT_FRONTFACE, materialA));
CHECK( rprMaterialNodeSetInputNByKey(material2sides, RPR_MATERIAL_INPUT_BACKFACE, materialB));

See full code