NAV15AP
2. jakso lukuvuonna 2016-2017
2D LIGHTS
Normally
the 2D sprites don’t react to lights. There is a way to change this. If you
want lights to affect your sprites simply change the material. Create new
material by right clicking in the project window and selecting create ->
material.
Choose a shader for the material and use sprite -> diffuse.
From the sprite inspector click the small circle on the right in material selection and use your created material.
You
can now see that your sprite has turned dark. This means lights now affect your
sprite.
3D LIGHTS
There are
many different ways to create lights in Unity. Let’s inspect what light types
are available.
·
Point
light
o
Point
light emits light to every direction
o
It
fades after certain distance
o
Uses:
simulating lamps and other local sources of light
·
Spot
light
o
Emits
light in an angle
o
Fades
like point light
o
Uses:
artificial light sources like flashlights, car headlights and searchlights
·
Directional
light
o
Directional
light behaves much like sun light
o
It
doesn’t fade like the previous examples thus it can be placed further away from
objects in the scene
o
Always
emits light from a certain angle
o
Uses:
simulate sun or moonlight, shading for the objects in scene without determining
a certain point from which the light is emitting
·
Area
light
o
Emitted
from rectangular shape
o
Area
lights can be only used as baked lightmaps
o
Uses:
simulate lights in small areas as house interior
·
Emissive
material
o
Emits
light across the materials surface
o
Property
of the standard shader which allows static objects in scene to emit light
·
Ambient
light
o
Doesn’t
emit light from a certain source but is present all around the scene
o
Uses:
over all lighting without adjusting multiple individual lights
REALTIME
LIGHTING
Real time
lighting is the basic way of lighting in Unity. This way the light is updated
every frame and when things change in the scene the light reacts to it as well.
BAKED GI
LIGHTING
This type
of light is pre calculated and it will not change. This means the light is
static. Baked lights are useful when you want to increase performance since
they don’t need to updated and won’t use as much of computers capacity.
Baked
lighting can be used with real time lighting by overlaying it on top of it but
remember that real time lights won’t affect the light maps created earlier.
EXERCISE
For this exercise you're going to need a 3D scene in Unity which is preferably a simple room. If you don't have one pre made then take the example scene from your class folder. Open the scene and light the room as you see fit. Use at least two different kinds of lights and change some properties (eg. intensity, color range) so that the light fits the scene.