Using LitMode and Light Sources

# Course Introduction

Let's learn how to apply light sources to a world.

# Activating LitMode

Activating UseLitDefaultMaterial will set all entities' LitMode to Lit. When it does, light sources can change other entities' surface color and brightness. However, entities with individual LitMode settings will follow their own LitMode value. Please reference [WorldConfig](/docs?postId=1101%7B%22target%22:%22_blank%22%7D).

[png](17690502093656710f5fb817140c9a9a28d28b004452c)

# Activating Scene, Play Light Sources

Activate the Light button to view the light source in the Scene. There must be at least 1 light source on the map for it to show as intended. [png](176898121208690f5d291af7549b4ab5b626659c0fa40)

# Applying Light Sources

There are 4 ways to apply a light source in a world.

  1. Add [LightComponent](/apiReference/Components/LightComponent%7B%22target%22:%22_blank%22%7D) to an entity.
  2. Set LitMode in Material and link it to an entity.
  3. Add a component with a LitMode property to an entity.
  4. Call a service method that can set LitMode.



## LightComponent

Add [LightComponent](/apiReference/Components/LightComponent%7B%22target%22:%22_blank%22%7D) to the entity and create a light source. Recommended for use with [TransformComponent](/apiReference/Components/TransformComponent%7B%22target%22:%22_blank%22%7D).

### Types of Light Sources

There are 4 types of light sources you can choose from in [LightComponent](/apiReference/Components/LightComponent%7B%22target%22:%22_blank%22%7D).

#### Spot

This is a circular light source. Change the property value to adjust its shape. [png](1768806563088453cd1c0bd1343fb9ae6a2831c42472a)

#### Freeform

This is a light source with a custom shape. [png](176880659998300d7ad91465c4202bd72461fd6d1977a)

#### Global

This is a light source that affects the entire screen. The SortingLayer can't be affected by light source effects from multiple Global Lights. [png](17688065857736f88865eafe848bb9ad57a593e2a3d4f)

#### Sprite

This displays a light source in a shape and color defined by a combination of the spotlight's RBGA color information that the creator selects. [png](1768806616414dd2742c352b94e2593bdb10c27eaf428)

## Main Properties

#### Combining Light

OverlapOperation is a property that calculates how the light will appear if there is any overlap. There are two property values: Additive and AlphaBlend.

  * Additive: The more lights overlap, the brighter the overlap is. [png](17688093939099217ddd692914320ae627a2988768431)

  * AlphaBlend: The color of the light source with the largest LightOrder value will appear in the overlap. [png](176889079569765366e3dcd9a428d94e0a4a05283396a)




#### Applying Light Sources

You can set the light source application status for the SortingLayer as TargetAllSortingLayers or TargetSortingLayers.

  * TargetAllSortingLayers: Applies the light source to all SortingLayers. Deactivating this property enables the TargetSortingLayers setting.
  * TargetSortingLayers: Creators can specify which SortingLayer the light source will be applied to. Each SortingLayer creates and renders separate light source textures. However, keep in mind that this may be too cumbersome for mobile environments. [png](1768981275922b7f81c3174424b25b3e94ef44eda830f)



# LitMode

Select the shader rendering method with LitMode. The type you choose will determine how the world will render the shading.

  * Default: The shader is determined by the settings of UseLitDefaultMaterial for WorldConfig.
  * Lit: This is a shader with light. The color and brightness of the surface of an entity dpeneds on the light source's locaiton, color, and brightness. [png](1768981320032fee08fc41e7a4be4befdd25514a49228)
  * Unlit: This is a shader without light that shows an entity with its set values unaffected by a light source. It lowers system load due to lighter calculations. [png](176898133639077712dc343dd4c4f9f17e03b6d39a80d)



> Note Certain entities and components are always rendered with the *Unlit shader. It is not affected by the LitMode value.
> 
>   * UI entity under Hierarchy - ui
>   * [TextComponent](/apiReference/Components/TextComponent%7B%22target%22:%22_blank%22%7D)
>   * [YoutubePlayerComponent](/apiReference/Components/YoutubePlayerComponent%7B%22target%22:%22_blank%22%7D)
>   * [WebViewComponent](/apiReference/Components/WebViewComponent%7B%22target%22:%22_blank%22%7D)
> 


#### Material

Entities using Material can set the Material's LitMode. [png](1769049749888008654fbcf2f434ab5b5aed87cc9b093)

#### Components

The following components can set LitMode individually.

  * [AreaComponent](/apiReference/Components/AreaParticleComponent%7B%22target%22:%22_blank%22%7D)
  * [BasicParticleComponent](/apiReference/Components/BasicParticleComponent%7B%22target%22:%22_blank%22%7D)
  * [SpriteParticleComponent](/apiReference/Components/SpriteParticleComponent%7B%22target%22:%22_blank%22%7D)
  * [DamageSkinSettingComponent](/apiReference/Components/DamageSkinSettingComponent%7B%22target%22:%22_blank%22%7D)



#### Sevices

The following services can set LitMode when using the 'Play()' method.

  * [DamageSkinService](/apiReference/Services/DamageSkinService%7B%22target%22:%22_blank%22%7D)
  * [EffectService](/apiReference/Services/EffectService%7B%22target%22:%22_blank%22%7D)
  * [ParticleService](/apiReference/Services/ParticleService%7B%22target%22:%22_blank%22%7D)