Light
The light is a key component in Unity to provides users with realistic lighting environment. In Unity, it provides with different types of light source to be used in different environments, including point light
, spotlight
, area light
, and directional light
. The scene would be dark if there is no light.
In Unity, it is easy to add a light component by clicking GameObject
, Light
, and choose the desired light type. You can change the light attributes on the Inspector
view.
Point Light
A light that gets emitted from a single point in all directions. You can change the location of the point light to get the desired lighting effects. The point light is common source inside the house, such as the candle.
You can also change the Light
attributes on the Inspector
view.
Type
: It is the type of the light source, includingPoint
,Spot
,Directional
, andArea
. You can directly transform it into another type of the light source.Range
: Set the range of the emitted light. Only both types ofSpot
andPoint
light can change the lighting range.
Color
: Set the lighting color.
Mode
: Set the lighting mode, includingRealtime
,Mixed
, andBaked
. Different lighting mode cause different lighting result on the area. TheRealtime
mode would reflect the directly lighting result at the run time, theBaked
mode would precompute the lighting result, and theMixed
mode would combine the above both. The following is the youtube vedio demostrated byHj Zo
. It is a very good demostration among lighting mode changes.
Unity 5.6 Light Mode Comparison
Intensity
: Set the strength of the light source.
Indirect Multiplier
: Set the value to vary the intensity of indirect light. TheIndirect Multiplier
defines the brightness of bounced light calculated by the global illumination (GI) system.
Shadow Type
: Set the object's shadow type generated by the light source. There are three types,No Shadows
,Soft Shadows
, andHard Shadows
. TheHard Shadows
produces shadows with a sharp edge, and it is looked more realistic thanSoft Shadows
.Draw Halo
: It is the switch for drawing the halo of the point light.
Flare
: Set the flare of the light source.
Render Mode
: Set the mode for rendering lighting to the scene. If it is set toNo Important
, there is no emitted light to the scene.
Spotlight
Spotlight emits the cone like light, and it is commonly used as the flashlight, searchlight, or car lamp.
The light attributes are similar with the point light.
- Parameter settings, including
Type
,Range
,Color
,Mode
,Intensity
,Indirect Multiplier
,Shadow Type
,Draw Halo
,Flare
, andRender Mode
, are similar with the point light. Spot Angle
: Set the spotlight emitting angle range from 0 to 360 degree.
Cookie
: The Cookie is the lighting texture, for example flashlight, etc. It is also easy to use different textures to simulate the object shadow, for example, flowers, etc.
Culling Mask
: The culling mask makes the lighted object is culled or is masked.
Directional Light
The Directional Light is commonly used as the sun light. The light attributes are similar with the above both light sources.
Light Mapping
In Unity, it also supports Light mapping. The Light mapping is the baked result to precompute the lighting result, and that is good for gaming performance. But it can't be a good solution for dynamic lighting, for example, location moving, color changing, or lighting strength, etc.
- It is easy to bake the object by transforming it into the
Static
mode. In Inspector view, you can set the parameters forLightmap Settings
.
- Choose the light, set the light mode to
Baked
, and set theShadow Type
toHard
orSoft Shadows
.
- Set the environment parameters by clicking
Window
,Lightening
,Settings
on the toolbar.- On the
Environement Lighting
, set the following parameter. Set theAmbient Mode
toBaked
. - On the
Lightmapping Settings
, set the following parameter. SetIndirect Resolution
,Lightmap Resolution
,Lightmap Padding
,Lightmap Size
,Compress Lightmaps
, andAmbient Occlusion
, etc.
- On the
Light Plugin
You can also download the lighting tool plugin and install it into the Unity, for example, Lighting Box 2
, etc.