Game Development Reference
In-Depth Information
shadows, Unity will tell you this feature requires Unity Pro). However, it will be
important that this light is casting shadows when the scene bakes. To make
sure that the Sun is indeed casting shadows in the baking calculation select
Window>Lightmapping. In the Lightmapping window, click the Object tag/
button. The Sun(Light) object will appear here. Change the Baked Shadows
setting to On (Realtime: Hard Shadows).
Step 4: Create custom Lightmap UVs. In the Project panel, select
EntryWay. In the Inspector, in the (FBXImporter) section, check the
Generate Lightmap UVs checkmark. Click Apply.
Why?
In some cases this doesn't need to be done. If the model imported has no
overlapping UVs (and all the UVs are completely contained in the top-right
quadrant of Maya's UV Texture Editor), the existing UVs will work fine. Unity
will bake the shadows and know right where to paint those shadows on
the surface. However, if you have used any overlapping UVs or worked with
tiled textures your UVs won't work for lightmapping; with overlapping UVs
a shadow would be painted across objects multiple times and be wrong.
By clicking this Generate Lightmap UVs button, Unity knows that it needs
to create a custom set of UVs (with no overlapping UVs) for the entire scene
that it will use to map the lightmap it will render in the coming steps. This
new lightmap is reasonably well laid out and tightly packed. So although a
second UV set could be manually created in Maya before importing, usually
it's not worth the effort since Unity's automatic version works quite well.
Step 5: Prepare geometry for baking. In the Hierarchy panel click the EntryWay
GameObject. In the Inspector panel look for the Static checkbox (it will be in
the upper-right-hand corner of the Inspector). Check this. A warning dialog will
pop up (called Change is Static) that will ask, “Do you want to make the object
and all its child objects static?” Click the Yes, change children button.
Why?
What's this static business? The Static check box is (among other things)
Unity's way of knowing which objects to be included in the baking
process. Generally, the thinking here is to bake in shadows and objects
only of things that won't move. Since only the door in the EntryWay level
will move, we can have everything in the EntryWay GameObject inherit
the Static label. This means all these objects will be included.
Step 6: Ensure that the Terrain is also set to Static. Remember to select
the GameObject in the Hierarchy and look for the Static checkbox in the
Inspector.
Step 7: Prepare to bake the scene. Open the Lightmapping window via
Window>Lightmapping. Click the Bake tab/button at the top. For this first
pass, if using Unity Pro, change the Bounces setting to 2. Change the Bounce
Boost and Bounce Intensity settings. Change both of these to 2 ( Figure 7.24 ).
Search WWH ::




Custom Search