NTU Grand Prix
|
Introduction
|
In this assignment, there are a few objectives to achieve.
There are :
1) Terrain (with texture)
2) Skybox (with texture)
3) A racing machine (can be just two rectangular box)
4) Provide a simple collision detection (wheel-terrain) to ensure the Go Kart always
stays on top of the terrain.
5) Provide simple mouse/keyboard input to initiate the movement of the racing machine
|
Approach
|
1) Terrain |
|
The terrain was
generated using a height map. A height map is a grey-scale image
that is used to determine the height of vertices of a NxN polygon
plane. |
|
Fig.1 Height map of the generated terrain
|
Fig.2 Rendered terrain model
|
|
Next is the texture of the terrain.
Using the same image from the grey-scale
height map (above), various colors of the terrain were added to
make it more realistic.
|
|
Fig.3 Texture image of the terrain
|
Fig.4 Rendered terrain model with texture
|
|
Even though the rendered terrain
model with texture looks nice (see Fig.4), there are some details
in the terrain we must consider. When the terrain is in closeup,
the terrain will look 'bloachy'. This is due to the fact that
texture image are mapped and stretched across thousands of polygons.
In order to overcome this without losing processing power (ie
redefine a detailed terrain model with larger polygons counts),
a technique knowns as bump mapping is used (refer to Assignment
3). |
|
Fig.5 Bump (Normal) Map of the terrain
|
Fig.6 Closeup terrain model without bump map
Fig.7 Closeup terrain model with bump map
|
|
2) Skybox |
|
Skybox are used
to give an illusion of a wide and unlimited 3D world. This give
a feeling of an infinite background that will improve realism.
There are various implementation such as using spheres to model
the sky environment (skydome) or a simple 3D cube (skybox).
In this assignment, a Skybox is used because it is easy to do
planar texturing. |
|

   
Fig.8 Sky texture used for the sky box
|
|
The terrain will
be enclosed by this skybox. Usually the terrain will be much
smaller than the skybox, this will give the feeling of unlimited
world when travelling on the terrain. |
|

Fig.9 Skybox Model
|
|
To add further realism, the clouds were
made 'moving'. This is done by rotating the whole skybox about the Y-axis. |
|




Fig.10 Moving Clouds
|
|
3) Go Kart |
|
A Simple Go Kart
with 2 rectangules are used because the camera is looking from
behind the Go Kart. Hence, only top and back rectangles of the
Go Kart are modeled. Lastly, texture maps of the Go Kart (in
this case, a racing car) are used. |
|

Fig.11 Go Kart Model
|
|
4) Collision Detection (wheel-terrain) |
|
In an undulating terrain, it is
important for the Go Kart to stay on the terrain itself. It will be weird to see
a flying car moving around in this scene. Hence, a mechanism similar to gravity,
will pull the Go Kart back to ground level whenever it is not on the surface.
This is done by making a check on all the 4 corners of the Go Kart. If the y-coordinates
of these corners are above the height of the terrain, reset the values back to the height
of the terrain.
By making this check, the Go Kart will orientate itself according to the terrain (see below Figures).
|
|
Fig.12 Go Kart orientate to the steepness of slope 1
|
Fig.13 Go Kart orientate to the steepness of slope 2
|
|
5) Mouse/Keyboard Control |
|
UP or W to go forward,
DOWN or S to move backward,
LEFT, RIGHT or A, D to steer left and right while the kart is in motion
MOUSE MOVEMENT to change the camera view.
|
|
Conclusion
|
With terrain and skybox, all game scene will look more convincing and more realistic.
Whether an indoor or outdoor game, with proper skybox, players will be able to immerse themselves
into the game environment. With skybox, the modelling of a complex scene will be greater reduce,
thus saving processing power in rendering the environment (ie do not require to model the actual
clouds in the sky).
Terrain provides the height aspect in this part of the game, as a
result, the whole gaming experience will be truely 3-dimensional when
height is considered. |
Download Code and Executable
|
Acknowledgments
|
1. I wish to thank Dr Edmond C. Prakash for
this opportunity to do some hands-on on the concepts of skybox, terrain, collision detection learned in lecture.
2. Ben Humphrey (DigiBen) from www.GameTutorials.com for his tutorial
and code on terrain
rendering.
|
-Home-
|