
Nvidia
3-D Lighting Tutorial
The lighting effects
used in 3D graphics have a large effect on the quality, realism, and
complexity of the graphics, and the amount of computing power used
to produce them. To produce the complicated, high-quality lighting
effects such as those in movies like "Toy Story," the artists
rely on "server farms" of high-powered workstations, based
on traditional CPUs, operating in concert to render the images one
frame at a time. This is known as off-line rendering, since there is
a significant time difference between when the lighting effects are
specified, and when they are viewable following processing. In other
words, it is impossible for the artist to alter the light effects as
he or she watches the film.
It is possible to
generate lighting effects in a dynamic, as-you-watch manner. This is
useful because it allows the artist to experiment, and see the results
instantaneously. However, there is a tradeoff in lighting effects quality,
and the speed at which they can be generated. There are three processes
by which a 3D scene can be lit:
Light maps
Method
A light map
is a 2D shading texture that is produced by the artist separately from
the main graphics. During run time, the light map is combined with
existing texture maps in the graphics to produce lighting effects.
This is called multitexturing, and most graphic soft and hardware can
accomplish it quickly. The advantage to light maps is their smooth,
pixel-level detail.
Problem
Light maps are not dynamic. If the artist wishes to change the lighting of
a scene, even slightly, a new set of light maps must be produced off-line
to do so. The process uses too much computing power to be able to do
so on the fly, without extremely expensive hardware. It is also impossible
to view the effects of the changes until after the new maps have been
produced.
Vertex lighting
Method
All real-time 3D graphics are built from component triangles. Each of the
three vertices of every triangle contains information about its position,
color, lighting, texture, and other parameters. This information is used
to construct the scene. Per-vertex lighting schemes calculate the lighting
effects only at each vertex, then interpolate across the surface of the
triangle. This reduces the computing power needed to produce lighting
effects, to the point that is possible to calculate them in real time,
dynamically. The artist using this style of lighting has much more flexibility
than with light maps.
Problem
Because vertex lighting effects operate at the triangle, not the pixel level,
the grain of the lighting effect is directly related to the number and
size of triangles comprising a scene--this is known as the tessellation
of a scene. Less tessellation (fewer triangles) reduces hardware cost,
but also reduces quality. More tessellated scenes look better when using
this lighting effect, but require more powerful hardware to render.
Dot-product texel
lighting
Method
Textured 3D graphics are composed of elements known as texels. Like vertices,
these contain information on color and position, but at a per-pixel level.
By creating a special texture known as the normal map, artists can supply
these elements with the direction normal--the direction the light is
coming from. The process of combing this map with existing textures to
produce the lighting effect is known as a dot product. This method combines
the advantages of light mapping's per-pixel resolution, and the dynamic
calculation of vertex lighting, to produce high quality lighting effects
on scenes of all tessellations.
Problem
Because it occurs at the per-pixel level, texel lighting still taxes hardware
more than vertex lighting.
Nvidia's Quadro 2
chip
The Nvidia Quadro2
GPU (graphics processing unit) is a chip specifically designed for
3D graphic processing using a texel lighting scheme. The NVIDIA Shading
Rasterizer (NSR) technology, first introduced in GeForce2 GTS, is
designed to provide hardware support for real-time dot-product operations.
NSR uses register-based combiners and hardware acceleration of dot-product
calculations for on-the-fly programmable pixel-shading capabilities.
Because the GPU is optimized for this type of calculation, Nvidia
states that one workstation using this type of chip to perform dot-product
lighting effects can rival the performance of a small server farm
of CPU-based workstations running light maps or vertex lighting.
More info:*
Nvidia
Web site
Nvidia
3D Per-Pixel Lighting brief (pdf)
*The WAVE Report
is not responsible for content on additional sites
|