Game Development Reference
In-Depth Information
Blob Shadows
Shadows give a scene an extra dimension of depth and add to visual
realism. Generating shadows is processor intensive. Although shadows
in game environments are covered in Chapter Seven, a quick and easy
method for generating processor light shadows called Blob Shadows is
introduced here.
Usually the game rendering system calculates shadows based on the position
and intensity of lights and the position of game objects. When many real-
time shadows need to be calculated, such as those of moving objects, such
as characters, it can slow the frame rate considerably. This is a big problem for
games on mobile devices where such shadowing is not practical.
Unity Hands On
Blob Shadows
Step 1. Download Chapter Two/BlobShadows.zip from the Web
site, unzip, and open in Unity. In the Project, double-click on
blobshadowexamples of the Scenes folder to open the scene. The
Scene will appear with a character standing on a plane.
Step 2. Select Assets > Import Package > Projectors from the main
menu to import the projector package.
Step 3. Locate Blob Shadow Projector in the Project and drag and drop
it onto the Male game object. A frustum object will appear under the
Male model. This is the Blob Shadow Projector.
Step 4. Move the projector up until it is just above the top of the
model's head. A black blob will appear on the ground. This is the blob
shadow. The shadow is created using a material with the texture of
the round black blob on it. When the projector intersects a plane, as
it does here with the ground, the black texture is drawn inside the
intersection area of the plane and the projector frustum.
Step 5. In its current state the Male model is also inside the projector
frustum and therefore the shadow is drawn on it too. To fix this we
place the model into another drawing layer. Select the Male object in
the Hierarchy. In the Inspector at the very top to the right of Tag is a
property called Layer. Click on the drop-down box next to Layer and
select Add Layer .
Step 6. In the Tag Manager that opens in the Inspector, next to User Layer
8 , type in character . This will create a new drawing layer called character .
Step 7. Select the Male object in the Hierarchy again. In the Inspector,
set its Layer to character using the drop-down box.
Step 8. Select the Blob Shadow Projector in the Hierarchy. In the
Inspector's Projector Component, set the Ignore Layers property to
character . The projector will now ignore anything in the character
layer, which in this case is the Male model, and draw the shadow
object everywhere else it intersects.
Search Nedrilad ::




Custom Search