Radeon ProRender

Layered Material Creation

More complex materials often blend or overlay different material properties over each other in a layered manner. This is done with a blend node RPR_MATERIAL_NODE_BLEND, which takes two input shaders. The resulting output is blended between the two with a “weight” parameter. Of course, these blend nodes can be chained together for more complex multi-layered materials.

// Create a shader.
	rpr_material_node layered;

	// Create a node.
	status = rprMaterialSystemCreateNode(matsys, RPR_MATERIAL_NODE_BLEND, &layered);
	assert (status == RPR_SUCCESS);

	// Set shader for base layer.
	status = rprMaterialNodeSetInputN(layered, "color0", base);
	assert (status == RPR_SUCCESS);

	// Set shader for top layer.
	status = rprMaterialNodeSetInputN(layered, "color1", top);
	assert (status == RPR_SUCCESS);

	rpr_material_node fresnel;
	status = rprMaterialSystemCreateNode(matsys, RPR_MATERIAL_NODE_FRESNEL, &fresnel);
	status = rprMaterialNodeSetInputF(fresnel, "ior", ior,ior,ior,ior );
	assert(status == RPR_SUCCESS);

	// Set index of refraction for base layer.
	status = rprMaterialNodeSetInputN(layered, "weight", fresnel);
	assert (status == RPR_SUCCESS);