Game Development Reference
In-Depth Information
Chapter 16
3D Scenes
In the previous pages, you learned something about how to draw 3D geometry, but
there
s much more to a 3D game than drawing a few triangles. Even a relatively bor-
ing 3D game has characters, interesting environments, dynamic objects, and a few
special effects here and there. Your first attempt at a 3D engine might be to just
draw everything. You might think that your blazing-fast Nvidia video card can han-
dle anything you throw at it, but you
'
d be wrong. It turns out to be pretty tricky to
get 3D scenes to look right and draw quickly.
This chapter exposes you to one solution for architecting a 3D engine
'
something
that can organize all the visible components of your game world and hopefully
draw them fast. Commercial 3D engines are highly optimized and pretty compli-
cated, but there are basic architectural ideas that ring true. With any luck, you
ll
end this chapter with a healthy respect for the programmers who build 3D engines
and have a little knowledge you can use to play with your very own.
'
Scene Graph Basics
A scene graph is a dynamic data structure, similar to a multiway tree. Each node
represents an object in a 3D world or perhaps an instruction to the renderer. Every
node can have zero or more children nodes. The scene graph is traversed every frame
to draw the visible world. Many commercial renderers use a scene graph as their
basic data structure. Before you get too excited, what you are about to see is a basic
523
 
 
 
 
Search WWH ::




Custom Search