#####################
Enable Shadow Mapping
#####################

First, a light that supports shadow mapping is needed for this to be efficient:

    * A spot light (:doc:`/tasks/ta_ca/ta_ca_light/tk_setup_a_spot_light`)
    * A beam light (:doc:`/tasks/ta_ca/ta_ca_light/tk_setup_a_beam_light`)
    * Point lights also support shadow mapping, but this is a 6 pass process, that is taking more time (:doc:`/tasks/ta_ca/ta_ca_light/tk_setup_a_point_light`)

Then:

.. code:: cpp
        
    RED::ILightShape* ilight = light->As< RED::ILightShape >();
    RC_TEST( ilight->SetShadowMapping( true, iresmgr->GetState() ) );

All the methods needed to configure a shadow map are detailed in the doc :doc:`/book/subjects/bk_sgo/bk_sgo_ls/bk_sg_real_time_lights` under the section **Configuring Shadow Mapping**. 