Game Development Reference
In-Depth Information
6.
In the Paint Trees section, select the Palm and click Edit Tree.
7.
Adjust the Bend Factor up and down to see how the trees react.
8.
Leave the Bend Factor at 2 .
Note that the distant billboard trees are not affected by the wind, so you may have to zoom in closer
to the palm trees to see results.
9.
Select the Wind Zone, and check out the parameters and options.
10.
Stop Play mode.
The Wind Zone is deleted once you stop Play mode. Feel free to add another more permanent Wind
Zone now that you are no longer in Play mode.
Terrain Bloopers
So far, you've been practicing with well-behaved assets. There are, however, a lot things that can go
wrong with assets that look perfectly okay when brought into the scene on their own. It is worthwhile
being familiar with a few typical problems.
The first issue is due to the way Unity calculates wind on Detail meshes. The values used to
calculate the amount of movement from “wind” are stored on the object's vertices. Besides the
vertices' x, y, and z locations, vertices store other types of information. Vertex color, one such piece
of information, can tint the mesh to add to the texture. This can help give the Detail meshes extra
depth without adding extra texture maps. With terrain wind, Unity uses the vertex alpha channel to
determine how much movement each vertex receives. The bottom of the plant should have black
as its vertex alpha color, and the top of the plants should grade up to gray. The lighter the alpha
value, the more bend there will be. The problem comes with meshes that have had no vertex alpha
assigned. A default color of white for vertex color adds no color. White for the alpha vertex colors
means that the entire mesh will move back and forth. If no alpha was specified, white may be the
default color for the vertex alpha, depending on what application the object was created in and how
it was exported.
In the first experiment, the cabbage mesh uses an alpha channel for its outer leaves, so it must use
the Grass Render Mode. The regular Cabbage object has black for its alpha vertex color, and the
Fast Cabbage has the default white.
1.
Load both of the cabbage objects in as Detail Meshes with Render Mode set
to Grass.
2.
Tint them slightly different colors, and paint a patch of each onto the terrain.
3.
Click Play, and switch back to the Scene view.
4.
Watch the Fast Cabbages flock back and forth across the terrain.
Another problem comes if the object's texture unwrap is not “atlased,” or packed within a unit size.
With regular objects, the overflow causes the texture to be tiled. With terrain objects, the texture maps
are internally joined together, so the overflow ends up on a different object's texture (Figure 2-59 ).
 
Search WWH ::




Custom Search