Game Development Reference
In-Depth Information
Fog
In Unity, fog is handy and easy to use. Think of it as more than just the gray fog
that is seen in the real world (although Unity's fog can be used to do that as well).
Fog in Unity can be used to make dark scenes darker as the player gazes into the
faraway corners of a space. Fog in Unity can be used to provide a soft haze on
the horizon line to soften the sky/ground plane line. Fog can be used to make
underwater feel like a murky mess, or just allow the water to “blue-out” as it gets
further from the player. In short, fog—with a bit of tweaking—can be used for all
sorts of interesting effects that can bring depth and polish to the scene.
In the case of Incursion , fog will be used to hide the edge of the water, and to give
the scene a damp and murky feel. It will provide a sense of ambiance of a truly
abandoned location, but one in which the player is never quite sure if he is alone.
Step 13: Change the background color of the Main Camera to gray.
The background color is an attribute of the Camera component. In the
Hierarchy panel, expand the First Person Controller and select the Main
Camera GameObject. Its attributes will appear in the Inspector. Under
the Camera component, click the long blue swatch next to Background.
Choose a new color that is rather gray-blue (this can be changed easily
later; Figure 6.6 ). Jot down the RGBA values (mine were 89,101,120,255).
Figure 6.6 Changing the
background color.
Why?
When there is no skybox present, cameras paint a solid color behind all
visible geometry (or actually more accurately, it draws a solid color field and
then draws the geometry on top of it). Unfortunately, fog doesn't affect this
background quite as we would expect. Regardless of the density of the fog,
that color field will still be visible. For that matter, a skybox is also still visible
even if the fog is so thick the player can't see any other geometry. This, of
course is not how fog really works, so to fix this, match the background
color to the fog color to begin with so the fog really appears to thicken the
further it gets away from the player even if there is no geometry out there.
Search WWH ::




Custom Search