Game Development Reference
In-Depth Information
However, lightmapping has its limitations. Since its effects are all
precalculated
, lightmapping cannot
account for shadows and illumination cast by dynamic objects—objects that move and change
while
the game is running
. The solutions to this problem take various forms, and Unity offers
Dynamic Lighting
and
Light Probes
(a special kind of semidynamic lighting). For CMOD and its low-contrast 'toon style,
we'll use lightmapping for static objects and full dynamic lighting for moveable objects. Light probes
will not be considered further in this topic. Dynamic lighting is simply the process of calculating lighting
for moving objects in real time. For performance reasons, this kind of lighting doesn't consider indirect
illumination and other more realistic effects. This means moving objects will be rendered less realistically
than static ones. But for a cartoon-style game, this shouldn't prove problematic.
Note
When lightmapping, take care over performance to use the LightMap Resolution field to size your
lightmap textures appropriately for your levels and target hardware.
For those interested in light probes, more information can be found at the Unity official documentation at
Before you can illuminate any scene with lightmapping in Unity, you'll need two things: a scene
with lights and at least one mesh instance marked as
Static
. If you've followed along from the
previous section, then all your scene architecture should be marked as Static, making it eligible for
lightmapping. Lights can be added to the scene using the main menu:
GameObject
➤
Create
Other
(see Figure
2-28
). From here, Unity offers a range of light types—namely, the
Directional Light
,
Point Light
,
Spotlight
, and
Area Light
.