Radeon ProRender

Subsurface Scattering Uber Material

This tutorial shows how to use Uber Shaders with subsurface scattering. It is fairly similar to the previous tutorial. The notable part is that one must also enable diffuse backscattering (or glass). The reason is that all Uber Shaders with interior substance share properties in the shader.

CHECK(rprxCreateMaterial(xctxt, RPRX_MATERIAL_UBER, &material));

	CHECK(rprxShapeAttachMaterial(xctxt, cube, material));

	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_BACKSCATTER_WEIGHT, 1.f, 1.f, 1.f, 0.f);
	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_BACKSCATTER_COLOR, 1.f, 1.f, 1.f, 1.f);

	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_REFLECTION_WEIGHT, 1.f, 1.f, 1.f, 1.f);
	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_REFLECTION_COLOR, 1.f, 1.f, 1.f, 1.f);
	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_REFLECTION_ROUGHNESS, 0.f, 0.f, 0.f, 0.f); 

	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_SSS_WEIGHT, 1.f, 1.f, 1.f, 1.f);
	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_SSS_SCATTER_COLOR, 0.9f, 0.5f, 0.1f, 0.f);
	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_SSS_SCATTER_DISTANCE, 0.1f, 0.1f, 0.1f, 1.f);
	status = rprxMaterialSetParameterF(xctxt, material, RPRX_UBER_MATERIAL_SSS_SCATTER_DIRECTION, 0.f, 0.f, 0.f, 0.f);
	status = rprxMaterialSetParameterU(xctxt, material, RPRX_UBER_MATERIAL_SSS_MULTISCATTER, RPR_TRUE);

	CHECK(rprxMaterialCommit(xctxt, material));