###############################
Creating a Physical Sky Texture
###############################

Using HOOPS Luminate, you can create an instance of a physical sky:

.. code:: cpp
        
    RED::Object* sky = RED::Factory::CreateInstance( CID_REDLightShape );
    RED::ISkyLightShape* isky = sky->As< RED::ISkyLightShape >();

and set up its model using:

.. code:: cpp 
        
    RC_TEST( isky->SetPhysicalModel( 1.0,                             // scene scaling factor
                                    1.0,                             // viewing height in meters,
                                    1.0,                             // sky intensity multiplier
                                    10,                              // turbidity
                                    0.3,                             // ground albedo
                                    0.8,                             // aerosols albedo
                                    0.7,                             // aerosols asymmetry factor
                                    RED::Vector3( 0.0, 0.0, 0.35 ),  // direction to the sun
                                    1.0,                             // sun scaling factor
                                    1.0,                             // sun intensity multiplier
                                    RED::Vector3( 0.0, 0.0, -0.35 ), // direction to the moon
                                    1.0,                             // moon scaling factor
                                    1.0,                             // moon intensity multiplier
                                    1.0,                             // stars intensity multiplier
                                    1.0,                             // sky color saturation factor
                                    iresmgr->GetState() ) );

It's then easy to retrieve a spherical "picture" of that sky by calling:

.. code:: cpp 
        
    RED::Object* sky_tex = NULL;  // making this pointer NULL lets the method below to create the image instance for us.
    RC_TEST( isky->CreatePhysicalSkyTexture( sky_tex, false, 512, false, false, true, iresmgr->GetState() ) );

.. figure:: creating_a_physical_sky_texture.png
    :align: center 

    **Some physical sky textures at different times of the day**