Point Light Creation

Lights in RPR fall into one of the three categories:

  • Implicit lights: point, directional and spot lights with zero surface area.

  • Environment lights which span the entire sphere around the scene (IBL maps and sky dome lights).

  • Area lights: these are created with an rpr_shape object for which a light emitting shader is created.

This tutorial covers point lights that are set to cast an amount of light (specified as radiant power) to the scene.

// Create a point light
rpr_light light = nullptr;
{
	CHECK(rprContextCreatePointLight(context, &light));

	// Create a transform: move 5 units in X axis, 8 units up Y axis, -2 units in Z axis
	RadeonProRender::matrix lightm = RadeonProRender::translation(RadeonProRender::float3(5, 8, -2));

	// Set transform for the light
	CHECK(rprLightSetTransform(light, RPR_TRUE, &lightm.m00));

	// Set the light’s radiant power    
	CHECK(rprPointLightSetRadiantPower3f(light, 255, 241, 224));

	// Attach the light to the scene
	CHECK(rprSceneAttachLight(scene, light));

An example of creating a point light can be found in the Basic Scene demo.