Game Development Reference
In-Depth Information
All looks good so far, but you are missing a crucial item in the scene: a light source!
5.
From the GameObjects menu, Create Other, choose a Directional Light.
6.
Toggle the Scene Lighting button on from the middle of the Scene view's tool bar.
The lighting improves. Directional lights cast parallel rays and are generally the choice for lighting
outdoor scenes. If you are not using Unity Pro, they are the only lights that can cast shadows—
which you have probably just realized are missing from the scene. Shadows of any kind tend to
be costly, so they are not turned on as a default. Shadows are also set to display only as far as a
specified distance from the camera.
7.
In the Directional Light's Light component, set the Shadow Type to Soft
Shadows.
8.
Adjust the shadow Strength to about 0.6 .
Now you can see the problem with the BigTrees or, to be more accurate, their leaf material's shader
(Figure 2-48 ). The leaf texture's alpha channel is being ignored for shadows. If you pan around the
view, you will notice that the Palms' fronds cast their shadows correctly. Both are using opacity
channels rather than geometry. To fix the problem, you can replace the “hidden” material with one of
those already available for the Tree Creator. Generally, the easiest way to edit prefabs is to drag one
into the scene view, make the changes, and then delete them from the scene.
Figure 2-48. Solid shadows for the BigTrees
9.
Locate the BigTree prefab in the Project view, and drag one into the Scene
view.
10.
In the Project view, Assets, Standard Assets, Tree Creator, Sources, select
the Materials folder.
 
Search WWH ::




Custom Search