Xenko

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • Manual
  • API
  • Release notes
    Show / Hide Table of Contents

    Skybox lights

    Beginner Designer Programmer

    A skybox light is an ambient light emitted by a skybox. Xenko analyzes the skybox cubemap and generates lighting using image-based lighting (Wikipedia).

    media/SkyboxLightOverview.png

    You don't need to actually display the skybox in the scene to use it as a light source. For example, you might not want to use the skybox to light the scene if the sky is only partly visible from an interior location (eg through windows of a room). As ambient lights aren't affected by shadows, they light every part of the scene, including interior spaces.

    How skyboxes light the scene

    These images show the difference between ambient and skybox lighting on two pure diffuse materials:

    Ambient lighting Skybox lighting
    Ambient lighting Skybox lighting.png

    These images show the effect of skybox lighting on a material with different metal and gloss properties:

    Material Plastic Metal 100% Gloss 50% Metal 100% Gloss 100%
    Material plastic Material 100% Gloss 100% Metal 100% Gloss 100%

    Notice how the skybox texture colors are reflected.

    Set up a skybox light

    To use a skybox as a light, you need to add a skybox asset, then select it in a Light component.

    1. In the Asset view, click Add asset

    2. Select Miscellaneous > Skybox.

      Choose asset type

      The Asset picker opens.

    3. Choose a skybox texture (.dds file) from the project assets and click OK.

      Choose texture

      Game Studio adds the skybox asset with the texture you specified.

    4. Select the entity you want to be the skybox light.

    5. In the Property grid (on the right by default), click Add component and select Light.

      Background component properties

    6. In the Light component properties, under Light, select Skybox.

      Light component property

    7. Click Hand icon (Pick an asset up):

      No skybox asset selected

    8. Select the skybox asset you want to use as a light source and click OK.

      Asset picker

    The Light component uses the skybox asset to light the scene.

    Skybox asset properties

    When you use a skybox as a light, Xenko uses it both in compressed form (spherical harmonics (Wikipedia)) and as a texture to light different kinds of material. You can control the detail of both in the skybox asset properties.

    Skybox lighting properties

    Property Description
    Cube Map The cubemap asset used for the skybox
    Specular Only Use the skybox only for specular lighting
    Diffuse SH Order The level of detail of the compressed skybox, used for diffuse lighting (dull materials). Order5 is more detailed than Order3
    Specular Cubemap Size The texture size used for specular lighting. Larger textures have more detail.

    Skybox light properties

    media/SkyboxLightProperties.png

    Property Description
    Intensity The light intensity
    Culling Mask Which entity groups are affected by the light. By default, all groups are affected

    Example code

    The following code changes the skybox light and its intensity:

    public Skybox skybox;
    public void ChangeSkyboxParameters()
    {
        // Get the light component from an entity
        var light = Entity.Get<LightComponent>();
    
        // Get the Skybox Light settings from the light component
        var skyboxLight = light.Type as LightSkybox;
    
        // Replace the existing skybox
        skyboxLight.Skybox = skybox;
    
        // Change the skybox light intensity
        light.Intensity = 1.5f;
    }
    

    See also

    • Skyboxes
    • Improve this Doc

    Back to top

    Copyright © 2016 Silicon Studio
    Generated by DocFX