3D Game Programming All
in One
By Kenneth C. Finney
Chapter 18
Making the Game World
Environment
Making the Game World
Environment
• Sky
• Clouds
• Water
Making the Game World
Environment
Skyboxes
• cube that surrounds the player
character
• each inside face depicts a view in
all cardinal directions, plus up
and down
• Skybox is never reachable by
player character
Making the Game World
Environment
Skyboxes
• perspective correction of skybox
images is necessary
• skybox images need to be tilable
• all images should be the same
resolution
• skybox image resolution can be
mathematically optimized
Making the Game World
Environment
Lab 1: Making Skybox Image
• Use paint program to create a
skybox
• Practice making images tilable
• Practice adjusting for perspective
error
• Introduction to material (DML) file
• Test in game world
Making the Game World
Environment
Cloud Layers
• Create cloud textures with alpha
channel
• Multiple layers can be created
• Layers move at different speeds
• Layers are unreachable
• Layers can be set to varying
'virtual' separations
Making the Game World
Environment
Lab 2: Creating clouds
• Practice making cloud images
with alpha channel
• Practice adjusting cloud layer
properties
• More practice with DML file
• Test in game world
Making the Game World
Environment
Fog
• limited volumetric fog
• adjustable vertical height &
thickness, but not horizontal
depth
• adjustable color
• fog is enterable by player
character
Making the Game World
Environment
Storms
• Torque has built-in storm
generation capability
• A storm is precipitation, fog,
thunder, and lightning
• Storm parameters are adjustable
• Timing, gradual onset and ending
Making the Game World
Environment
Storm Materials
• precipitation particle images
defined in a single PNG file with
alpha channel
• Precipitation particle image has
16 'drop' images in a 4x4 grid
Making the Game World
Environment
Storm Materials
• Lightning images defined in
separate PNG files without alpha
channel
• Black color is used to define
transparent areas of images
Making the Game World
Environment
Lightning
• Need a LightningData datablock
• LightningData datablock points to
lightning images with a DML file
• Need a Lightning object definition
• Lighting object points to the
desired LightningData datablock
Making the Game World
Environment
Rain
• PrecipitationData datablock
points to a DML file
• A Precipitation object definition
points to a PrecipitationData
datablock
• Rain only falls in an area around
the player character
Making the Game World
Environment
Lab 3: A Perfect Storm
• use console to invoke a storm
• combine use of Sky.stormCloud
method and
Precipitation.stormPrecipitation
method
Making the Game World
Environment
Waterblocks
• Special objects inserted as part
of a mission
• tiled like terrain tiles
• textures can be used, same as
clouds
Making the Game World
Environment
Terraforming
• Torque Terrain Editor allows you
to 'paint' terrain
• Adjustable brush can be used to
add or remove dirt
• Ideal method for quick terrain
creation
Making the Game World
Environment
Lab 4: Terraforming
• learn the Terrain Editor
• practice creating various terrain
shapes
• learn how to use 'fly' mode
Summary
• Skyboxes, clouds, and water define a
game world environment
• Use Skyboxes to simulate distant
horizons and sky
• Use Cloud layers in the Sky object to
define overhead cloud movement
• Storms are the integration of cloud
layers, fog, precipitation, and lightning
• Use WaterBlocks to define bodies of
water