MaximumPC 2008 08

(Dariusz) #1

62 |MAMAMAXIMXIMXIMXIMUUUUMMPPPCC|AUG 08 |www.maximumpc.com


WHITE PAPER

R&D^


EXAMINING TECHNOLOGY AND PUTTING IT TO USE

How 3D game rendering is changing with hardware advancements —ZACK STERN


Raster vs.Rays


WHITE PAPER

Raster vs.Rays


WHITE PAPER

T


he shiny, new hatchback you nudge
in a street race dents slightly on the
driver’s side door. Although you’re
playing a PC game, created with beaucoup
equations, the bend looks almost real. The
3D renderer sculpts all those numbers into
images, with help from the video API (appli-
cation program interface). However, several
completely different rendering techniques
can be the source of those images. Cur-
rently, the hardware and software indus-
tries are debating how to best utilize two
graphics-rendering techniques: ray tracing
and rasterization.
Rasterizing is widely used to render
current 3D games because it strikes a
compromise between real-time processing
demands and pretty pictures. Its regular,
predictable patterns are also suited to
specialized massively parallel processors,
such as GPUs. Essentially, the raster engine
looks at the thousands of 2D triangles that
build a 3D scene and determines which are
visible in the current perspective. With that

information, the engine analyzes the light
sources and other environment details to
light and color pixels onto each triangle.
Ray tracing takes the opposite ap-
proach, borrowing from the way photons
move in the real world. In nature, a light
source creates countless pho-
tons (or rays) that bounce off
objects, take on their color
and properties, and eventu-
ally reach your eye. Ray
tracing reverses the process,
firing its gaze away from the
camera perspective, assessing which objects
are in view. When a ray hits something, the
engine knows to draw a pixel.

THE GRAY AREA
These two techniques further diverge when
adding shadows and other details to a scene.
Rasterized graphics can use a few techniques
to create light and dark, frequently relying
on shadow maps. These guides are created
by rasterizing from the perspective of a light

source, seeing which objects are visible, and
shading the camera perspective based on
this blueprint. A ray tracer calculates shad-
ows just by tracing more beams and seeing
how they bounce. If a beam’s path leads back
to a light source, its pixel is drawn brighter.

If the beam ends without hitting a light, the
engine knows to draw that pixel in shadow.
Ray tracing’s realism—and system
burden—comes from the arbitrary point at
which the engine stops calculating these
bounces. Every time the beam ricochets off
another object, more color, shadow, and
refl ection details can be added back to the
fi rst collision pixel. Fog eff ects can be espe-
cially taxing, requiring the beams to refract
through a mist. The best-looking images can
take billions of rays; that’s just too much
number crunching for today’s CPUs and
GPUs to handle in real time.
And even if those chips could keep up,
other bottlenecks couldn’t keep pace with a
fully ray-traced real-time scene. “It’s just too
hard in terms of memory bandwidth; it’s too
hard in terms of silicon speed,” says David
Kirk, chief scientist at Nvidia. “It’s just too
hard. And I don’t think that’s the goal.”
“Graphics in general is the grand art of
cheating,” Kirk notes, regardless of tech-
nique. “We’re trying to approximate what
nature does—tracing gazillions of photons
around—by doing less work than that,
because even the most sophisticated and
powerful ray tracers don’t trace billions of
rays per second.”

TOOLS FOR THE JOB
“This whole CPU versus GPU distinction is
a little bit artifi cial,” says Bill Mark, senior
researcher at Intel’s Corporate Technology
Group. “Certainly you can build GPUs that
have some CPU-like characteristics. Simi-

HOW IT WORKS

In the real world, light comes from a source and bounces off surfaces. Some of the photons that
reach your eye hit your retina, allowing you to see. Ray tracing works the other way, by casting
rays back from the observer’s viewpoint to determine which pixels it should render.

VIEW POINT

IMAGE

“IF YOU COULD DO ALL RAY
TRACING, WOULD YOU?
I DON’T THINK YOU WOULD.”

In the real world, light comes from a source and bounces off surfaces. Some of the photons that

LIGHT
SOURCE

SCENE
OBJECT

SHADOW
RAY

VIEW
RAY

Rendering Pixels via Ray Tracing

Free download pdf