HDR rendering pipeline

This is the last part of our book. Now that we have managed to customize all our lighting, using HDR environment background images, and a HDR material, we need to turn REDsdk's HDR rendering on, as detailed below:

RED::IOptions* iwinopt = _window->As< RED::IOptions >();
RC_TEST( iwinopt->SetOptionValue( RED::OPTIONS_WINDOW_HDR, 1, iresmgr->GetState() ) );

RC_TEST( idefvrl->SetBackgroundImages( _sky_cube, RED::Matrix::IDENTITY, NULL, RED::Matrix::IDENTITY, true, iresmgr->GetState() ) );

RED::PostProcess& pp = icamera->GetPostProcessSettings();
RC_TEST( pp.SetToneMapping( RED::TMO_EXPOSURE ) );
RC_TEST( pp.SetExposure( _exposure ) );

RED::IOptions* icamopt = _camera->As< RED::IOptions >();
RC_TEST( icamopt->SetOptionValue( RED::OPTIONS_RAY_TRANSPARENCY, 2, iresmgr->GetState() ) );

We use a simple tonemapping to rescale our lighting intensities. The RED::TMO_EXPOSURE is just a simple scale of lighting intensities that result of the rendering, so pressing the two toolbar buttons will change the overall brightness of the rendered images. This tonemapping, unlike the RED::TMO_PHOTOGRAPHIC does not rely on image luminance values, so it does not vary with the image contents.

We also manage to add a few transparency layers using the RED::OPTIONS_RAY_TRANSPARENCY, to ensure that we see through our transparent objects a little bit of themselves.