Setup a Physical Moon Light

A physical moon light can’t exist without a physical sky light. So all starts with the creation of a physical sky light (Setup a Physical Sky Light).

Then the sky light is used to set up the moon light according to its sky model:

// "sky" is a pointer to a previously created and set up RED sky light instance.
RED::ISkyLightShape* isky = sky->As< RED::ISkyLightShape >();

// Initialize the moon light according to the current sky model settings.
RED::Object* sun = NULL;  // passing NULL makes the method below to create the sun instance for us.
RC_TEST( isky->SetMoonLight( sun, iresmgr->GetState() ) );

Because the moon is a physical light, no other parameters are needed (like colour or intensity) and all other data are computed based on physics simulation.

Note

The moon is a very weak source of light. Therefore, its contribution to a scene is often quite subtle.