Uber Material Creation

The Uber Material tutorial illustrates how to use the Uber material (RPR_MATERIAL_NODE_UBERV2).

In order to have a source code focusing on the material, we are using a MatballScene class (defined inside common.cpp and using the concepts introduced inside the Basic Scene demo) to manage all the scene setup, filled with Material Ball models.

This tutorial currently illustrates nine material graphs (more materials may be added in the future).

An Uber material is created just like any other material:

rprMaterialSystemCreateNode(matsys, RPR_MATERIAL_NODE_UBERV2, &material);

Then it has a long list of inputs making this material able to represent the vast majority of materials used in PBR rendering.

Example of source code to create the material of the middle matball in the first line in the illustration.

rpr_material_node material = nullptr;

CHECK(rprMaterialSystemCreateNode(matballScene.m_matsys, RPR_MATERIAL_NODE_UBERV2, &material));
CHECK(rprMaterialNodeSetInputFByKey(material, RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR, 0.5f, 0.25f, 0.0f, 1.f));
CHECK(rprMaterialNodeSetInputFByKey(material, RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT, 1.f, 1.f, 1.f, 1.f));
CHECK(rprMaterialNodeSetInputFByKey(material, RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR, 0.5f, 0.5f, 0.5f, 1.f));
CHECK(rprMaterialNodeSetInputFByKey(material, RPR_MATERIAL_INPUT_UBER_REFLECTION_WEIGHT, 0.9f, 0.9f, 0.9f, 1.f));
CHECK(rprMaterialNodeSetInputFByKey(material, RPR_MATERIAL_INPUT_UBER_REFLECTION_ROUGHNESS, 0.1f, 0.f, 0.f, 0.f));
CHECK(rprMaterialNodeSetInputUByKey(material, RPR_MATERIAL_INPUT_UBER_REFLECTION_MODE, RPR_UBER_MATERIAL_IOR_MODE_METALNESS));
CHECK(rprMaterialNodeSetInputFByKey(material, RPR_MATERIAL_INPUT_UBER_REFLECTION_METALNESS, 0.f, 0.f, 0.f, 1.f));

See full code