Escolar Documentos
Profissional Documentos
Cultura Documentos
PDF generated using the open source mwlib toolkit. See http://code.pediapress.com/ for more information.
PDF generated at: Fri, 31 Jan 2014 12:14:57 UTC
Contents
Articles
Preface
3D rendering
Concepts
1
1
6
Alpha mapping
Ambient occlusion
Anisotropic filtering
Back-face culling
11
Beam tracing
12
13
Bilinear filtering
14
16
21
Bounding volume
24
Bump mapping
27
29
31
Cube mapping
34
Diffuse reflection
37
Displacement mapping
40
42
Edge loop
43
Euler operator
44
False radiosity
45
Fragment
46
Geometry pipelines
47
Geometry processing
48
Global illumination
48
Gouraud shading
51
Graphics pipeline
53
55
56
59
Image-based lighting
64
Image plane
65
Irregular Z-buffer
65
Isosurface
66
68
Lambertian reflectance
70
Level of detail
71
Mipmap
74
Newell's algorithm
76
77
Normal
86
Normal mapping
90
92
Painter's algorithm
95
Parallax mapping
97
Particle system
98
Path tracing
101
Per-pixel lighting
105
107
Phong shading
110
Photon mapping
112
Polygon
115
116
118
Procedural generation
119
Procedural texture
125
3D projection
128
132
Radiosity
143
Ray casting
148
Ray tracing
151
Reflection
159
Reflection mapping
161
Relief mapping
164
165
Rendering
165
Retained mode
174
Scanline rendering
174
Schlick's approximation
177
177
Self-shadowing
182
Shadow mapping
182
Shadow volume
188
Silhouette edge
193
Spectral rendering
194
Specular highlight
195
Specularity
199
Sphere mapping
199
Stencil buffer
200
Stencil codes
202
Subdivision surface
207
Subsurface scattering
210
Surface caching
212
Texel
212
Texture atlas
213
Texture filtering
214
Texture mapping
216
Texture synthesis
219
Tiled rendering
223
UV mapping
225
UVW mapping
227
Vertex
227
229
Vertex normal
234
Viewing frustum
235
Virtual actor
236
Volume rendering
238
Volumetric lighting
244
Voxel
245
Z-buffering
249
Z-fighting
253
Appendix
3D computer graphics software
References
255
255
257
263
Article Licenses
License
267
Preface
3D rendering
3D computer graphics
Basics
3D modeling / 3D scanning
3D rendering / 3D printing
3D computer graphics software
Primary Uses
v
t
e [1]
3D rendering is the 3D computer graphics process of automatically converting 3D wire frame models into 2D
images with 3D photorealistic effects or non-photorealistic rendering on a computer.
3D rendering
Rendering methods
Rendering is the final process of creating the actual 2D image or animation from the prepared scene. This can be
compared to taking a photo or filming the scene after the setup is finished in real life. Several different, and often
specialized, rendering methods have been developed. These range from the distinctly non-realistic wireframe
rendering through polygon-based rendering, to more advanced techniques such as: scanline rendering, ray tracing, or
radiosity. Rendering may take from fractions of a second to days for a single image/frame. In general, different
methods are better suited for either photo-realistic rendering, or real-time rendering.
Real-time
Rendering for interactive media, such as games and
simulations, is calculated and displayed in real time, at
rates of approximately 20 to 120 frames per second. In
real-time rendering, the goal is to show as much
information as possible as the eye can process in a
fraction of a second (a.k.a. in one frame. In the case of
30 frame-per-second animation a frame encompasses
one 30th of a second). The primary goal is to achieve
an as high as possible degree of photorealism at an
A screenshot from Second Life, an example of a modern simulation
acceptable minimum rendering speed (usually 24
which renders frames in real time.
frames per second, as that is the minimum the human
eye needs to see to successfully create the illusion of
movement). In fact, exploitations can be applied in the way the eye 'perceives' the world, and as a result the final
image presented is not necessarily that of the real-world, but one close enough for the human eye to tolerate.
Rendering software may simulate such visual effects as lens flares, depth of field or motion blur. These are attempts
to simulate visual phenomena resulting from the optical characteristics of cameras and of the human eye. These
effects can lend an element of realism to a scene, even if the effect is merely a simulated artifact of a camera. This is
the basic method employed in games, interactive worlds and VRML. The rapid increase in computer processing
power has allowed a progressively higher degree of realism even for real-time rendering, including techniques such
as HDR rendering. Real-time rendering is often polygonal and aided by the computer's GPU.
3D rendering
Non real-time
Animations for non-interactive media, such as feature
films and video, are rendered much more slowly.
Non-real time rendering enables the leveraging of
limited processing power in order to obtain higher
image quality. Rendering times for individual frames
may vary from a few seconds to several days for
complex scenes. Rendered frames are stored on a hard
disk then can be transferred to other media such as
motion picture film or optical disk. These frames are
then displayed sequentially at high frame rates,
typically 24, 25, or 30 frames per second, to achieve
the illusion of movement.
When the goal is photo-realism, techniques such as ray
tracing or radiosity are employed. This is the basic
method employed in digital media and artistic works.
Techniques have been developed for the purpose of
simulating other naturally-occurring effects, such as the
interaction of light with various forms of matter.
Examples of such techniques include particle systems
(which can simulate rain, smoke, or fire), volumetric
sampling (to simulate fog, dust and other spatial
atmospheric effects), caustics (to simulate light
focusing by uneven light-refracting surfaces, such as
the light ripples seen on the bottom of a swimming
pool), and subsurface scattering (to simulate light
reflecting inside the volumes of solid objects such as
human skin).
3D rendering
can be broken down into two orthogonal issues, which are often studied independently:
Reflection/Scattering - How light interacts with the surface at a given point
Shading - How material properties vary across the surface
Reflection
Reflection or scattering is the relationship
between
incoming
and
outgoing
illumination at a given point. Descriptions
of scattering are usually given in terms of a
bidirectional scattering distribution function
or BSDF. Popular reflection rendering
techniques in 3D computer graphics include:
Flat shading: A technique that shades
each polygon of an object based on the
polygon's "normal" and the position and
intensity of a light source.
Gouraud shading: Invented by H.
Gouraud in 1971, a fast and
resource-conscious vertex shading
technique used to simulate smoothly
shaded surfaces.
Texture mapping: A technique for simulating a large amount of surface detail by mapping images (textures) onto
polygons.
Phong shading: Invented by Bui Tuong Phong, used to simulate specular highlights and smooth shaded surfaces.
Bump mapping: Invented by Jim Blinn, a normal-perturbation technique used to simulate wrinkled surfaces.
Cel shading: A technique used to imitate the look of hand-drawn animation.
Shading
Shading addresses how different types of scattering are distributed across the surface (i.e., which scattering function
applies where). Descriptions of this kind are typically expressed with a program called a shader. (Note that there is
some confusion since the word "shader" is sometimes used for programs that describe local geometric variation.) A
simple example of shading is texture mapping, which uses an image to specify the diffuse color at each point on a
surface, giving it more apparent detail.
3D rendering
Transport
Transport describes how illumination in a scene gets from one place to another. Visibility is a major component of
light transport.
Projection
The shaded three-dimensional objects
must be flattened so that the display
device - namely a monitor - can
display it in only two dimensions, this
process is called 3D projection. This is
done using projection and, for most
applications, perspective projection.
The basic idea behind perspective
projection is that objects that are
further away are made smaller in
Perspective Projection
relation to those that are closer to the
eye. Programs produce perspective by
multiplying a dilation constant raised to the power of the negative of the distance from the observer. A dilation
constant of one means that there is no perspective. High dilation constants can cause a "fish-eye" effect in which
image distortion begins to occur. Orthographic projection is used mainly in CAD or CAM applications where
scientific modeling requires precise measurements and preservation of the third dimension.
External links
References
[1]
[2]
[3]
[4]
[5]
Concepts
Alpha mapping
Alpha mapping is a technique in 3D computer graphics where an image is mapped (assigned) to a 3D object, and
designates certain areas of the object to be transparent or translucent. The transparency can vary in strength, based on
the image texture, which can be greyscale, or the alpha channel of an RGBA image texture.
Ambient occlusion
In computer graphics, ambient occlusion is used to represent how
exposed each point in a scene is to ambient lighting. So the enclosed
inside of a tube is typically more occluded (and hence darker) than the
exposed outer surfaces; and deeper inside the tube, the more occluded
(and darker) it becomes. The result is diffuse, non-directional lighting
throughout the scene, casting no clear shadows, but with enclosed and
sheltered areas darkened. In this way, it attempts to approximate the
way light radiates in real life, especially off what are normally
considered non-reflective surfaces.
Unlike local methods like Phong shading, ambient occlusion is a global
method, meaning the illumination at each point is a function of other
geometry in the scene. However, it is a very crude approximation to
full global illumination. The soft appearance achieved by ambient
occlusion alone is similar to the way an object appears on an overcast
day.
Implementation
In real-time games, Screen space ambient occlusion can be used as a
The ambient occlusion map for this scene darkens
only the innermost angles of corners.
faster approximation of true ambient occlusion, using pixel depth
rather than scene geometry to form an ambient occlusion map.
However, newer technologies are making true ambient occlusion feasible even in real-time.
Ambient occlusion is related to accessibility shading, which determines appearance based on how easy it is for a
surface to be touched by various elements (e.g., dirt, light, etc.). It has been popularized in production animation due
to its relative simplicity and efficiency. In the industry, ambient occlusion is often referred to as "sky light".[citation
needed]
The ambient occlusion shading model has the nice property of offering a better perception of the 3d shape of the
displayed objects. This was shown in a paper where the authors report the results of perceptual experiments showing
that depth discrimination under diffuse uniform sky lighting is superior to that predicted by a direct lighting model.
The occlusion
at a point
Ambient occlusion
where
and
, defined to be zero if
approximate this integral in practice: perhaps the most straightforward way is to use the Monte Carlo method by
casting rays from the point and testing for intersection with other scene geometry (i.e., ray casting). Another
approach (more suited to hardware acceleration) is to render the view from
a white background and taking the (cosine-weighted) average of rasterized fragments. This approach is an example
of a "gathering" or "inside-out" approach, whereas other algorithms (such as depth-map ambient occlusion) employ
"scattering" or "outside-in" techniques.
In addition to the ambient occlusion value, a "bent normal" vector
is often generated, which points in the average
direction of unoccluded samples. The bent normal can be used to look up incident radiance from an environment
map to approximate image-based lighting. However, there are some situations in which the direction of the bent
normal is a misrepresentation of the dominant direction of illumination, e.g.,
In this example the bent normal Nb has an unfortunate direction, since it is pointing at an occluded surface.
In this example, light may reach the point p only from the left or right sides, but the bent normal points to the
average of those two sources, which is, unfortunately, directly toward the obstruction.
Ambient occlusion
Recognition
In 2010, Hayden Landis, Ken McGaugh and Hilmar Koch were awarded a Scientific and Technical Academy Award
for their work on ambient occlusion rendering.[1]
References
[1] Oscar 2010: Scientific and Technical Awards (http:/ / www. altfg. com/ blog/ awards/ oscar-2010-scientific-and-technical-awards-489/ ), Alt
Film Guide, Jan 7, 2010
External links
Depth Map based Ambient Occlusion (http://www.andrew-whitehurst.net/amb_occlude.html)
NVIDIA's accurate, real-time Ambient Occlusion Volumes (http://research.nvidia.com/publication/
ambient-occlusion-volumes)
Assorted notes about ambient occlusion (http://www.cs.unc.edu/~coombe/research/ao/)
Ambient Occlusion Fields (http://www.tml.hut.fi/~janne/aofields/) real-time ambient occlusion using
cube maps
PantaRay ambient occlusion used in the movie Avatar (http://research.nvidia.com/publication/
pantaray-fast-ray-traced-occlusion-caching-massive-scenes)
Fast Precomputed Ambient Occlusion for Proximity Shadows (http://hal.inria.fr/inria-00379385) real-time
ambient occlusion using volume textures
Dynamic Ambient Occlusion and Indirect Lighting (http://download.nvidia.com/developer/GPU_Gems_2/
GPU_Gems2_ch14.pdf) a real time self ambient occlusion method from Nvidia's GPU Gems 2 book
GPU Gems 3 : Chapter 12. High-Quality Ambient Occlusion (http://http.developer.nvidia.com/GPUGems3/
gpugems3_ch12.html)
ShadeVis (http://vcg.sourceforge.net/index.php/ShadeVis) an open source tool for computing ambient
occlusion
xNormal (http://www.xnormal.net) A free normal mapper/ambient occlusion baking application
3dsMax Ambient Occlusion Map Baking (http://www.mrbluesummers.com/893/video-tutorials/
baking-ambient-occlusion-in-3dsmax-monday-movie) Demo video about preparing ambient occlusion in 3dsMax
Anisotropic filtering
Anisotropic filtering
In 3D computer graphics, anisotropic filtering (abbreviated AF) is a method of enhancing the image quality of
textures on surfaces of computer graphics that are at oblique viewing angles with respect to the camera where the
projection of the texture (not the polygon or other primitive on which it is rendered) appears to be non-orthogonal
(thus the origin of the word: "an" for not, "iso" for same, and "tropic" from tropism, relating to direction; anisotropic
filtering does not filter the same in every direction).
Like bilinear and trilinear filtering, anisotropic filtering eliminates aliasing effects, but improves on these other
techniques by reducing blur and preserving detail at extreme viewing angles.
Anisotropic compression is relatively intensive (primarily memory bandwidth and to some degree computationally,
though the standard space-time tradeoff rules apply) and only became a standard feature of consumer-level graphics
cards in the late 1990s. Anisotropic filtering is now common in modern graphics hardware (and video driver
software) and is enabled either by users through driver settings or by graphics applications and video games through
programming interfaces.
With RIP map anisotropic filtering, in addition to downsampling to 128 128, images are also sampled to 256 128
and 32 128 etc. These anisotropically downsampled images can be probed when the texture-mapped image
frequency is different for each texture axis. Therefore, one axis need not blur due to the screen frequency of another
axis, and aliasing is still avoided. Unlike more general anisotropic filtering, the RIP mapping described for
illustration is limited by only supporting anisotropic probes that are axis-aligned in texture space, so diagonal
anisotropy still presents a problem, even though real-use cases of anisotropic texture commonly have such
screenspace mappings.
In layman's terms, anisotropic filtering retains the "sharpness" of a texture normally lost by MIP map texture's
attempts to avoid aliasing. Anisotropic filtering can therefore be said to maintain crisp texture detail at all viewing
Anisotropic filtering
orientations while providing fast anti-aliased texture filtering.
Implementation
True anisotropic filtering probes the texture anisotropically on the fly on a per-pixel basis for any orientation of
anisotropy.
In graphics hardware, typically when the texture is sampled anisotropically, several probes (texel samples) of the
texture around the center point are taken, but on a sample pattern mapped according to the projected shape of the
texture at that pixel.
Each anisotropic filtering probe is often in itself a filtered MIP map sample, which adds more sampling to the
process. Sixteen trilinear anisotropic samples might require 128 samples from the stored texture, as trilinear MIP
map filtering needs to take four samples times two MIP levels and then anisotropic sampling (at 16-tap) needs to
take sixteen of these trilinear filtered probes.
However, this level of filtering complexity is not required all the time. There are commonly available methods to
reduce the amount of work the video rendering hardware must do.
The anisotropic filtering method most commonly implemented on graphics hardware is the composition of the
filtered pixel values from only one line of MIP map samples, which is referred to as "footprint assembly".[1]
10
Anisotropic filtering
References
[1] Schilling, A.; Knittel, G., May 22, 2001
External links
The Naked Truth About Anisotropic Filtering (http://www.extremetech.com/computing/
51994-the-naked-truth-about-anisotropic-filtering)
Back-face culling
In computer graphics, back-face culling determines whether a polygon of a graphical object is visible. It is a step in
the graphical pipeline that tests whether the points in the polygon appear in clockwise or counter-clockwise order
when projected onto the screen. If the user has specified that front-facing polygons have a clockwise winding, if the
polygon projected on the screen has a counter-clockwise winding it has been rotated to face away from the camera
and will not be drawn.
The process makes rendering objects quicker and more efficient by reducing the number of polygons for the program
to draw. For example, in a city street scene, there is generally no need to draw the polygons on the sides of the
buildings facing away from the camera; they are completely occluded by the sides facing the camera.
A related technique is clipping, which determines whether polygons are within the camera's field of view at all.
Another similar technique is Z-culling, also known as occlusion culling, which attempts to skip the drawing of
polygons which are covered from the viewpoint by other visible polygons.
This technique only works with single-sided polygons, which are only visible from one side. Double-sided polygons
are rendered from both sides, and thus have no back-face to cull.
One method of implementing back-face culling is by discarding all polygons where the dot product of their surface
normal and the camera-to-polygon vector is greater than or equal to zero.
11
Back-face culling
Further reading
Geometry Culling in 3D Engines [1], by Pietari Laurila
References
[1] http:/ / www. gamedev. net/ reference/ articles/ article1212. asp
Beam tracing
Beam tracing is an algorithm to simulate wave propagation. It was developed in the context of computer graphics to
render 3D scenes, but it has been also used in other similar areas such as acoustics and electromagnetism
simulations.
Beam tracing is a derivative of the ray tracing algorithm that replaces rays, which have no thickness, with beams.
Beams are shaped like unbounded pyramids, with (possibly complex) polygonal cross sections. Beam tracing was
first proposed by Paul Heckbert and Pat Hanrahan.[1]
In beam tracing, a pyramidal beam is initially cast through the entire viewing frustum. This initial viewing beam is
intersected with each polygon in the environment, typically from nearest to farthest. Each polygon that intersects
with the beam must be visible, and is removed from the shape of the beam and added to a render queue. When a
beam intersects with a reflective or refractive polygon, a new beam is created in a similar fashion to ray-tracing.
A variant of beam tracing casts a pyramidal beam through each pixel of the image plane. This is then split up into
sub-beams based on its intersection with scene geometry. Reflection and transmission (refraction) rays are also
replaced by beams.This sort of implementation is rarely used, as the geometric processes involved are much more
complex and therefore expensive than simply casting more rays through the pixel. Cone tracing is a similar
technique using a cone instead of a complex pyramid.
Beam tracing solves certain problems related to sampling and aliasing, which can plague conventional ray tracing
approaches.[2] Since beam tracing effectively calculates the path of every possible ray within each beam [3](which
can be viewed as a dense bundle of adjacent rays), it is not as prone to under-sampling (missing rays) or
over-sampling (wasted computational resources). The computational complexity associated with beams has made
them unpopular for many visualization applications. In recent years, Monte Carlo algorithms like distributed ray
tracing (and Metropolis light transport?) have become more popular for rendering calculations.
A 'backwards' variant of beam tracing casts beams from the light source into the environment. Similar to backwards
raytracing and photon mapping, backwards beam tracing may be used to efficiently model lighting effects such as
caustics.[4] Recently the backwards beam tracing technique has also been extended to handle glossy to diffuse
material interactions (glossy backward beam tracing) such as from polished metal surfaces.[5]
Beam tracing has been successfully applied to the fields of acoustic modelling[6] and electromagnetic propagation
modelling.[7] In both of these applications, beams are used as an efficient way to track deep reflections from a source
to a receiver (or vice-versa). Beams can provide a convenient and compact way to represent visibility. Once a beam
tree has been calculated, one can use it to readily account for moving transmitters or receivers.
Beam tracing is related in concept to cone tracing.
12
Beam tracing
References
[1] P. S. Heckbert and P. Hanrahan, " Beam tracing polygonal objects (http:/ / www. eng. utah. edu/ ~cs7940/ papers/ p119-heckbert. pdf)",
Computer Graphics 18(3), 119-127 (1984).
[2] A. Lehnert, "Systematic errors of the ray-tracing algorithm", Applied Acoustics 38, 207-221 (1993).
[3] Steven Fortune, "Topological Beam Tracing", Symposium on Computational Geometry 1999: 59-68
[4] M. Watt, "Light-water interaction using backwards beam tracing", in "Proceedings of the 17th annual conference on Computer graphics and
interactive techniques(SIGGRAPH'90)",377-385(1990).
[5] B. Duvenhage, K. Bouatouch, and D.G. Kourie, "Exploring the use of Glossy Light Volumes for Interactive Global Illumination", in
"Proceedings of the 7th International Conference on Computer Graphics, Virtual Reality, Visualisation and Interaction in Africa", 2010.
[6] T. Funkhouser, I. Carlbom, G. Elko, G. Pingali, M. Sondhi, and J. West, "A beam tracing approach to acoustic modelling for interactive
virtual environments", in Proceedings of the 25th annual conference on Computer graphics and interactive techniques (SIGGRAPH'98),
21-32 (1998).
[7] Steven Fortune, "A Beam-Tracing Algorithm for Prediction of Indoor Radio Propagation", in WACG 1996: 157-166
References
13
Bilinear filtering
Bilinear filtering
Bilinear filtering is a texture filtering method used to smooth textures
when displayed larger or smaller than they actually are.
Most of the time, when drawing a textured shape on the screen, the
texture is not displayed exactly as it is stored, without any distortion.
A zoomed small portion of a bitmap, using
Because of this, most pixels will end up needing to use a point on the
nearest-neighbor filtering (left), bilinear filtering
texture that is "between" texels, assuming the texels are points (as
(center), and bicubic filtering (right).
opposed to, say, squares) in the middle (or on the upper left corner, or
anywhere else; it does not matter, as long as it is consistent) of their
respective "cells". Bilinear filtering uses these points to perform bilinear interpolation between the four texels nearest
to the point that the pixel represents (in the middle or upper left of the pixel, usually).
The formula
In a mathematical context, bilinear interpolation is the problem of finding a function f(x,y) of the form
f(x,y) = c11xy + c10x + c01y + c00 satisfying
f(x1,y1) = z11, f(x1,y2) = z12, f(x2,y1) = z21, and f(x2,y2) = z22.
The usual, and usually computationally least expensive way to compute f is through linear interpolation used twice,
for example to compute two functions f1 and f2, satisfying
f1(y1) = z11, f1(y2) = z12, f2(y1) = z21, and f2(y2) = z22,
and then to combine these functions (which are linear in y) into one function f satisfying
f(x1,y) = f1(y), and f(x2,y) = f2(y).
In computer graphics, bilinear filtering is usually performed on a texture during texture mapping, or on a bitmap
during resizing. In both cases, the source data (bitmap or texture) can be seen as a two-dimensional array of values
zij, or several (usually three) of these in the case of full-color data. The data points used in bilinear filtering are the
2x2 points surrounding the location for which the color is to be interpolated.
Additionally, one does not have to compute the actual coefficients of the function f; computing the value f(x,y) is
sufficient.
The largest integer not larger than x shall be called [x], and the fractional part of x shall be {x}. Then, x = [x] + {x},
and {x} < 1. We have x1 = [x], x2 = [x] + 1, y1 = [y], y2 = [y] + 1. The data points used for interpolation are taken
from the texture / bitmap and assigned to z11, z12, z21, and z22.
f1(y1) = z11, f1(y2) = z12 are the two data points for f1; subtracting the former from the latter yields
f1(y2) - f1(y1) = z12 - z11.
Because f1 is linear, its derivative is constant and equal to
(z12 - z11) / (y2 - y1) = z12 - z11.
Because f1(y1) = z11,
f1(y1 + {y}) = z11 + {y}(z12 - z11),
and similarly,
f2(y1 + {y}) = z21 + {y}(z22 - z21).
Because y1 + {y} = y, we have computed the endpoints f1(y) and f2(y) needed for the second interpolation step.
The second step is to compute f(x,y), which can be accomplished by the very formula we used for computing the
intermediate values:
14
Bilinear filtering
15
Sample code
This code assumes that the texture is square (an extremely common occurrence), that no mipmapping comes into
play, and that there is only one channel of data (not so common. Nearly all textures are in color so they have red,
green, and blue channels, and many have an alpha transparency channel, so we must make three or four calculations
of y, one for each channel). The location of UV-coordinates is at center of texel. For example, {(0.25,0.25),
(0.75,0.25), (0.25,0.75), (0.75,0.75)} are values for 2x2 texture.
double getBilinearFilteredPixelColor(Texture tex, double u, double v)
{
u = u * tex.size - 0.5;
v = v * tex.size - 0.5;
int x = floor(u);
int y = floor(v);
double u_ratio = u - x;
double v_ratio = v - y;
double u_opposite = 1 - u_ratio;
double v_opposite = 1 - v_ratio;
double result = (tex[x][y]
* u_opposite
u_ratio) * v_opposite +
(tex[x][y+1] * u_opposite
u_ratio) * v_ratio;
return result;
}
+ tex[x+1][y]
+ tex[x+1][y+1] *
Limitations
Bilinear filtering is rather accurate until the scaling of the texture gets below half or above double the original size of
the texture - that is, if the texture was 256 pixels in each direction, scaling it to below 128 or above 512 pixels can
make the texture look bad, because of missing pixels or too much smoothness. Often, mipmapping is used to provide
a scaled-down version of the texture for better performance; however, the transition between two differently-sized
mipmaps on a texture in perspective using bilinear filtering can be very abrupt. Trilinear filtering, though somewhat
more complex, can make this transition smooth throughout.
For a quick demonstration of how a texel can be missing from a filtered texture, here's a list of numbers representing
the centers of boxes from an 8-texel-wide texture (in red and black), intermingled with the numbers from the centers
of boxes from a 3-texel-wide down-sampled texture (in blue). The red numbers represent texels that would not be
used in calculating the 3-texel texture at all.
0.0625, 0.1667, 0.1875, 0.3125, 0.4375, 0.5000, 0.5625, 0.6875, 0.8125, 0.8333, 0.9375
Bilinear filtering
Special cases
Textures aren't infinite, in general, and sometimes one ends up with a pixel coordinate that lies outside the grid of
texel coordinates. There are a few ways to handle this:
Wrap the texture, so that the last texel in a row also comes right before the first, and the last texel in a column also
comes right above the first. This works best when the texture is being tiled.
Make the area outside the texture all one color. This may be of use for a texture designed to be laid over a solid
background or to be transparent.
Repeat the edge texels out to infinity. This works best if the texture is not designed to be repeated.
Overview
Binary space partitioning is a generic process of recursively dividing a scene into two until the partitioning satisfies
one or more requirements. It can be seen as a generalisation of other spatial tree structures such as k-d trees and
quadtrees, one where hyperplanes that partition the space may have any orientation, rather than being aligned with
the coordinate axes as they are in k-d trees or quadtrees. When used in computer graphics to render scenes composed
of planar polygons, the partitioning planes are frequently (but not always) chosen to coincide with the planes defined
by polygons in the scene.
The specific choice of partitioning plane and criterion for terminating the partitioning process varies depending on
the purpose of the BSP tree. For example, in computer graphics rendering, the scene is divided until each node of the
BSP tree contains only polygons that can render in arbitrary order. When back-face culling is used, each node
therefore contains a convex set of polygons, whereas when rendering double-sided polygons, each node of the BSP
tree contains only polygons in a single plane. In collision detection or ray tracing, a scene may be divided up into
primitives on which collision or ray intersection tests are straightforward.
Binary space partitioning arose from the computer graphics need to rapidly draw three dimensional scenes composed
of polygons. A simple way to draw such scenes is the painter's algorithm, which produces polygons in order of
distance from the viewer, back to front, painting over the background and previous polygons with each closer object.
This approach has two disadvantages: time required to sort polygons in back to front order, and the possibility of
errors in overlapping polygons. Fuchs and co-authors showed that constructing a BSP tree solved both of these
problems by providing a rapid method of sorting polygons with respect to a given viewpoint (linear in the number of
polygons in the scene) and by subdividing overlapping polygons to avoid errors that can occur with the painter's
algorithm. A disadvantage of binary space partitioning is that generating a BSP tree can be time-consuming.
Typically, it is therefore performed once on static geometry, as a pre-calculation step, prior to rendering or other
realtime operations on a scene. The expense of constructing a BSP tree makes it difficult and inefficient to directly
implement moving objects into a tree.
16
Generation
The canonical use of a BSP tree is for rendering polygons (that are double-sided, that is, without back-face culling)
with the painter's algorithm. Each polygon is designated with a front side and a back side which could be chosen
arbitrarily and only affects the structure of the tree but not the required result. Such a tree is constructed from an
unsorted list of all the polygons in a scene. The recursive algorithm for construction of a BSP tree from that list of
polygons is:
1. Choose a polygon P from the list.
2. Make a node N in the BSP tree, and add P to the list of polygons at that node.
3. For each other polygon in the list:
1. If that polygon is wholly in front of the plane containing P, move that polygon to the list of nodes in front of
P.
2. If that polygon is wholly behind the plane containing P, move that polygon to the list of nodes behind P.
3. If that polygon is intersected by the plane containing P, split it into two polygons and move them to the
respective lists of polygons behind and in front of P.
4. If that polygon lies in the plane containing P, add it to the list of polygons at node N.
4. Apply this algorithm to the list of polygons in front of P.
5. Apply this algorithm to the list of polygons behind P.
The following diagram illustrates the use of this algorithm in converting a list of lines or polygons into a BSP tree.
At each of the eight steps (i.-viii.), the algorithm above is applied to a list of lines, and one new node is added to the
tree.
Start with a list of lines, (or in 3-D, polygons) making up the scene. In the tree diagrams, lists are denoted
by rounded rectangles and nodes in the BSP tree by circles. In the spatial diagram of the lines, direction
chosen to be the 'front' of a line is denoted by an arrow.
i.
ii.
We now apply the algorithm to the list of lines in front of A (containing B2, C2, D2). We choose a line, B2,
add it to a node and split the rest of the list into those lines that are in front of B2 (D2), and those that are
behind it (C2, D3).
iii.
Choose a line, D2, from the list of lines in front of B2. It is the only line in the list, so after adding it to a
node, nothing further needs to be done.
iv.
We are done with the lines in front of B2, so consider the lines behind B2 (C2 and D3). Choose one of
these (C2), add it to a node, and put the other line in the list (D3) into the list of lines in front of C2.
v.
Now look at the list of lines in front of C2. There is only one line (D3), so add this to a node and continue.
17
vi.
We have now added all of the lines in front of A to the BSP tree, so we now start on the list of lines behind
A. Choosing a line (B1) from this list, we add B1 to a node and split the remainder of the list into lines in
front of B1 (i.e. D1), and lines behind B1 (i.e. C1).
vii.
Processing first the list of lines in front of B1, D1 is the only line in this list, so add this to a node and
continue.
viii. Looking next at the list of lines behind B1, the only line in this list is C1, so add this to a node, and the BSP
tree is complete.
The final number of polygons or lines in a tree is often larger (sometimes much larger) than the original list, since
lines or polygons that cross the partitioning plane must be split into two. It is desirable to minimize this increase, but
also to maintain reasonable balance in the final tree. The choice of which polygon or line is used as a partitioning
plane (in step 1 of the algorithm) is therefore important in creating an efficient BSP tree.
Traversal
A BSP tree is traversed in a linear time, in an order determined by the particular function of the tree. Again using the
example of rendering double-sided polygons using the painter's algorithm, to draw a polygon P correctly requires
that all polygons behind the plane P lies in must be drawn first, then polygon P, then finally the polygons in front of
P. If this drawing order is satisfied for all polygons in a scene, then the entire scene renders in the correct order. This
procedure can be implemented by recursively traversing a BSP tree using the following algorithm. From a given
viewing location V, to render a BSP tree,
1. If the current node is a leaf node, render the polygons at the current node.
2. Otherwise, if the viewing location V is in front of the current node:
1. Render the child BSP tree containing polygons behind the current node
2. Render the polygons at the current node
3. Render the child BSP tree containing polygons in front of the current node
3. Otherwise, if the viewing location V is behind the current node:
1. Render the child BSP tree containing polygons in front of the current node
2. Render the polygons at the current node
3. Render the child BSP tree containing polygons behind the current node
4. Otherwise, the viewing location V must be exactly on the plane associated with the current node. Then:
1. Render the child BSP tree containing polygons in front of the current node
2. Render the child BSP tree containing polygons behind the current node
Applying this algorithm recursively to the BSP tree generated above results in the following steps:
The algorithm is first applied to the root node of the tree, node A. V is in front of node A, so we apply the
algorithm first to the child BSP tree containing polygons behind A
This tree has root node B1. V is behind B1 so first we apply the algorithm to the child BSP tree containing
polygons in front of B1:
This tree is just the leaf node D1, so the polygon D1 is rendered.
We then render the polygon B1.
18
Timeline
1969 Schumacker et al. published a report that described how carefully positioned planes in a virtual environment
could be used to accelerate polygon ordering. The technique made use of depth coherence, which states that a
polygon on the far side of the plane cannot, in any way, obstruct a closer polygon. This was used in flight
simulators made by GE as well as Evans and Sutherland. However, creation of the polygonal data organization
was performed manually by scene designer.
1980 Fuchs et al. extended Schumackers idea to the representation of 3D objects in a virtual environment by
using planes that lie coincident with polygons to recursively partition the 3D space. This provided a fully
automated and algorithmic generation of a hierarchical polygonal data structure known as a Binary Space
Partitioning Tree (BSP Tree). The process took place as an off-line preprocessing step that was performed once
per environment/object. At run-time, the view-dependent visibility ordering was generated by traversing the tree.
1981 Naylor's Ph.D thesis containing a full development of both BSP trees and a graph-theoretic approach using
strongly connected components for pre-computing visibility, as well as the connection between the two methods.
BSP trees as a dimension independent spatial search structure was emphasized, with applications to visible
surface determination. The thesis also included the first empirical data demonstrating that the size of the tree and
the number of new polygons was reasonable (using a model of the Space Shuttle).
1983 Fuchs et al. describe a micro-code implementation of the BSP tree algorithm on an Ikonas frame buffer
system. This was the first demonstration of real-time visible surface determination using BSP trees.
1987 Thibault and Naylor described how arbitrary polyhedra may be represented using a BSP tree as opposed to
the traditional b-rep (boundary representation). This provided a solid representation vs. a surface
based-representation. Set operations on polyhedra were described using a tool, enabling Constructive Solid
Geometry (CSG) in real-time. This was the fore runner of BSP level design using brushes, introduced in the
Quake editor and picked up in the Unreal Editor.
1990 Naylor, Amanatides, and Thibault provide an algorithm for merging two BSP trees to form a new BSP tree
from the two original trees. This provides many benefits including: combining moving objects represented by
BSP trees with a static environment (also represented by a BSP tree), very efficient CSG operations on polyhedra,
exact collisions detection in O(log n * log n), and proper ordering of transparent surfaces contained in two
interpenetrating objects (has been used for an x-ray vision effect).
19
References
Additional references
[NAYLOR90] B. Naylor, J. Amanatides, and W. Thibualt, "Merging BSP Trees Yields Polyhedral Set
Operations", Computer Graphics (Siggraph '90), 24(3), 1990.
[NAYLOR93] B. Naylor, "Constructing Good Partitioning Trees", Graphics Interface (annual Canadian CG
conference) May, 1993.
[CHEN91] S. Chen and D. Gordon. Front-to-Back Display of BSP Trees. (http://cs.haifa.ac.il/~gordon/
ftb-bsp.pdf) IEEE Computer Graphics & Algorithms, pp 7985. September 1991.
[RADHA91] H. Radha, R. Leoonardi, M. Vetterli, and B. Naylor Binary Space Partitioning Tree Representation
of Images, Journal of Visual Communications and Image Processing 1991, vol. 2(3).
[RADHA93] H. Radha, "Efficient Image Representation using Binary Space Partitioning Trees.", Ph.D. Thesis,
Columbia University, 1993.
[RADHA96] H. Radha, M. Vetterli, and R. Leoonardi, Image Compression Using Binary Space Partitioning
Trees, IEEE Transactions on Image Processing, vol. 5, No.12, December 1996, pp.16101624.
[WINTER99] AN INVESTIGATION INTO REAL-TIME 3D POLYGON RENDERING USING BSP TREES.
Andrew Steven Winter. April 1999. available online
Mark de Berg, Marc van Kreveld, Mark Overmars, and Otfried Schwarzkopf (2000). Computational Geometry
(2nd revised ed.). Springer-Verlag. ISBN3-540-65620-0. Section 12: Binary Space Partitions: pp.251265.
Describes a randomized Painter's Algorithm.
Christer Ericson: Real-Time Collision Detection (The Morgan Kaufmann Series in Interactive 3-D Technology).
Verlag Morgan Kaufmann, S. 349-382, Jahr 2005, ISBN 1-55860-732-3
20
External links
BSP trees presentation (http://www.cs.wpi.edu/~matt/courses/cs563/talks/bsp/bsp.html)
Another BSP trees presentation (http://web.archive.org/web/20110719195212/http://www.cc.gatech.edu/
classes/AY2004/cs4451a_fall/bsp.pdf)
A Java applet that demonstrates the process of tree generation (http://symbolcraft.com/graphics/bsp/)
A Master Thesis about BSP generating (http://archive.gamedev.net/archive/reference/programming/features/
bsptree/bsp.pdf)
BSP Trees: Theory and Implementation (http://www.devmaster.net/articles/bsp-trees/)
BSP in 3D space (http://www.euclideanspace.com/threed/solidmodel/spatialdecomposition/bsp/index.htm)
Overview
Bounding interval hierarchies (BIH) exhibit many of the properties of both bounding volume hierarchies (BVH) and
kd-trees. Whereas the construction and storage of BIH is comparable to that of BVH, the traversal of BIH resemble
that of kd-trees. Furthermore, BIH are also binary trees just like kd-trees (and in fact their superset, BSP trees).
Finally, BIH are axis-aligned as are its ancestors. Although a more general non-axis-aligned implementation of the
BIH should be possible (similar to the BSP-tree, which uses unaligned planes), it would almost certainly be less
desirable due to decreased numerical stability and an increase in the complexity of ray traversal.
The key feature of the BIH is the storage of 2 planes per node (as opposed to 1 for the kd tree and 6 for an axis
aligned bounding box hierarchy), which allows for overlapping children (just like a BVH), but at the same time
featuring an order on the children along one dimension/axis (as it is the case for kd trees).
It is also possible to just use the BIH data structure for the construction phase but traverse the tree in a way a
traditional axis aligned bounding box hierarchy does. This enables some simple speed up optimizations for large ray
bundles [3] while keeping memory/cache usage low.
Some general attributes of bounding interval hierarchies (and techniques related to BIH) as described by [4] are:
21
Operations
Construction
To construct any space partitioning structure some form of heuristic is commonly used. For this the surface area
heuristic, commonly used with many partitioning schemes, is a possible candidate. Another, more simplistic
heuristic is the "global" heuristic described by which only requires an axis-aligned bounding box, rather than the full
set of primitives, making it much more suitable for a fast construction.
The general construction scheme for a BIH:
calculate the scene bounding box
use a heuristic to choose one axis and a split plane candidate perpendicular to this axis
sort the objects to the left or right child (exclusively) depending on the bounding box of the object (note that
objects intersecting the split plane may either be sorted by its overlap with the child volumes or any other
heuristic)
calculate the maximum bounding value of all objects on the left and the minimum bounding value of those on the
right for that axis (can be combined with previous step for some heuristics)
store these 2 values along with 2 bits encoding the split axis in a new node
continue with step 2 for the children
Potential heuristics for the split plane candidate search:
Classical: pick the longest axis and the middle of the node bounding box on that axis
Classical: pick the longest axis and a split plane through the median of the objects (results in a leftist tree which is
often unfortunate for ray tracing though)
Global heuristic: pick the split plane based on a global criterion, in the form of a regular grid (avoids unnecessary
splits and keeps node volumes as cubic as possible)
Surface area heuristic: calculate the surface area and amount of objects for both children, over the set of all
possible split plane candidates, then choose the one with the lowest costs (claimed to be optimal, though the cost
function poses unusual demands to proof the formula, which can not be fulfilled in real life. also an exceptionally
slow heuristic to evaluate)
Ray traversal
The traversal phase closely resembles a kd-tree traversal: One has to distinguish 4 simple cases, where the ray
For the third case, depending on the ray direction (negative or positive) of the component (x, y or z) equalling the
split axis of the current node, the traversal continues first with the left (positive direction) or the right (negative
direction) child and the other one is pushed onto a stack.
Traversal continues until a leaf node is found. After intersecting the objects in the leaf, the next element is popped
from the stack. If the stack is empty, the nearest intersection of all pierced leafs is returned.
It is also possible to add a 5th traversal case, but which also requires a slightly complicated construction phase. By
swapping the meanings of the left and right plane of a node, it is possible to cut off empty space on both sides of a
node. This requires an additional bit that must be stored in the node to detect this special case during traversal.
Handling this case during the traversal phase is simple, as the ray
just intersects the only child of the current node or
intersects nothing
22
Properties
Numerical stability
All operations during the hierarchy construction/sorting of the triangles are min/max-operations and comparisons.
Thus no triangle clipping has to be done as it is the case with kd-trees and which can become a problem for triangles
that just slightly intersect a node. Even if the kd implementation is carefully written, numerical errors can result in a
non-detected intersection and thus rendering errors (holes in the geometry) due to the missed ray-object intersection.
Extensions
Instead of using two planes per node to separate geometry, it is also possible to use any number of planes to create a
n-ary BIH or use multiple planes in a standard binary BIH (one and four planes per node were already proposed in
and then properly evaluated in [5]) to achieve better object separation.
References
Papers
[1] Nam, Beomseok; Sussman, Alan. A comparative study of spatial indexing techniques for multidimensional scientific datasets (http:/ /
ieeexplore. ieee. org/ Xplore/ login. jsp?url=/ iel5/ 9176/ 29111/ 01311209. pdf)
[2] Zachmann, Gabriel. Minimal Hierarchical Collision Detection (http:/ / zach. in. tu-clausthal. de/ papers/ vrst02. html)
[3] Wald, Ingo; Boulos, Solomon; Shirley, Peter (2007). Ray Tracing Deformable Scenes using Dynamic Bounding Volume Hierarchies (http:/ /
www. sci. utah. edu/ ~wald/ Publications/ 2007/ / / BVH/ download/ / togbvh. pdf)
[4] Wchter, Carsten; Keller, Alexander (2006). Instant Ray Tracing: The Bounding Interval Hierarchy (http:/ / ainc. de/ Research/ BIH. pdf)
[5] Wchter, Carsten (2008). Quasi-Monte Carlo Light Transport Simulation by Efficient Ray Tracing (http:/ / vts. uni-ulm. de/ query/ longview.
meta. asp?document_id=6265)
External links
BIH implementations: Javascript (http://github.com/imbcmdth/jsBIH).
23
Bounding volume
24
Bounding volume
For building code compliance, see Bounding.
In computer graphics and computational geometry, a bounding
volume for a set of objects is a closed volume that completely contains
the union of the objects in the set. Bounding volumes are used to
improve the efficiency of geometrical operations by using simple
volumes to contain more complex objects. Normally, simpler volumes
have simpler ways to test for overlap.
A bounding volume for a set of objects is also a bounding volume for
the single object consisting of their union, and the other way around.
Therefore it is possible to confine the description to the case of a single
object, which is assumed to be non-empty and bounded (finite).
A three dimensional model with its bounding box
drawn in dashed lines.
Bounding volume
bounding boxes become more sophisticated.
A bounding box is a cuboid, or in 2-D a rectangle, containing the object. In dynamical simulation, bounding boxes
are preferred to other shapes of bounding volume such as bounding spheres or cylinders for objects that are roughly
cuboid in shape when the intersection test needs to be fairly accurate. The benefit is obvious, for example, for objects
that rest upon other, such as a car resting on the ground: a bounding sphere would show the car as possibly
intersecting with the ground, which then would need to be rejected by a more expensive test of the actual model of
the car; a bounding box immediately shows the car as not intersecting with the ground, saving the more expensive
test.
A bounding capsule is a swept sphere (i.e. the volume that a sphere takes as it moves along a straight line segment)
containing the object. Capsules can be represented by the radius of the swept sphere and the segment that the sphere
is swept across). It has traits similar to a cylinder, but is easier to use, because the intersection test is simpler. A
capsule and another object intersect if the distance between the capsule's defining segment and some feature of the
other object is smaller than the capsule's radius. For example, two capsules intersect if the distance between the
capsules' segments is smaller than the sum of their radii. This holds for arbitrarily rotated capsules, which is why
they're more appealing than cylinders in practice.
A bounding cylinder is a cylinder containing the object. In most applications the axis of the cylinder is aligned with
the vertical direction of the scene. Cylinders are appropriate for 3-D objects that can only rotate about a vertical axis
but not about other axes, and are otherwise constrained to move by translation only. Two vertical-axis-aligned
cylinders intersect when, simultaneously, their projections on the vertical axis intersect which are two line
segments as well their projections on the horizontal plane two circular disks. Both are easy to test. In video
games, bounding cylinders are often used as bounding volumes for people standing upright.
A bounding ellipsoid is an ellipsoid containing the object. Ellipsoids usually provide tighter fitting than a sphere.
Intersections with ellipsoids are done by scaling the other object along the principal axes of the ellipsoid by an
amount equal to the multiplicative inverse of the radii of the ellipsoid, thus reducing the problem to intersecting the
scaled object with a unit sphere. Care should be taken to avoid problems if the applied scaling introduces skew.
Skew can make the usage of ellipsoids impractical in certain cases, for example collision between two arbitrary
ellipsoids.
A bounding slab is related to the AABB and used to speed up ray tracing[1]
A bounding sphere is a sphere containing the object. In 2-D graphics, this is a circle. Bounding spheres are
represented by centre and radius. They are very quick to test for collision with each other: two spheres intersect
when the distance between their centres does not exceed the sum of their radii. This makes bounding spheres
appropriate for objects that can move in any number of dimensions.
In many applications the bounding box is aligned with the axes of the co-ordinate system, and it is then known as an
axis-aligned bounding box (AABB). To distinguish the general case from an AABB, an arbitrary bounding box is
sometimes called an oriented bounding box (OBB). AABBs are much simpler to test for intersection than OBBs,
but have the disadvantage that when the model is rotated they cannot be simply rotated with it, but need to be
recomputed.
A bounding triangle in 2-D is quite useful to speedup the clipping or visibility test of a B-Spline curve. See "Circle
and B-Splines clipping algorithms" under the subject Clipping (computer graphics) for an example of use.
A convex hull is the smallest convex volume containing the object. If the object is the union of a finite set of points,
its convex hull is a polytope.
A discrete oriented polytope (DOP) generalizes the AABB. A DOP is a convex polytope containing the object (in
2-D a polygon; in 3-D a polyhedron), constructed by taking a number of suitably oriented planes at infinity and
moving them until they collide with the object. The DOP is then the convex polytope resulting from intersection of
the half-spaces bounded by the planes. Popular choices for constructing DOPs in 3-D graphics include the
25
Bounding volume
26
axis-aligned bounding box, made from 6 axis-aligned planes, and the beveled bounding box, made from 10 (if
beveled only on vertical edges, say), 18 (if beveled on all edges), or 26 planes (if beveled on all edges and corners).
A DOP constructed from k planes is called a k-DOP; the actual number of faces can be less than k, since some can
become degenerate, shrunk to an edge or a vertex.
A minimum bounding rectangle or MBR the least AABB in 2-D is frequently used in the description of
geographic (or "geospatial") data items, serving as a simplified proxy for a dataset's spatial extent (see geospatial
metadata) for the purpose of data search (including spatial queries as applicable) and display. It is also a basic
component of the R-tree method of spatial indexing.
For the ranges m,n and o,p it can be said that they do not intersect if m>p or o>n. Thus, by projecting the ranges of 2
OBBs along the I, J, and K axes of each OBB, and checking for non-intersection, it is possible to detect
non-intersection. By additionally checking along the cross products of these axes (I0I1, I0J1, ...) one can be more
certain that intersection is impossible.
This concept of determining non-intersection via use of axis projection also extends to convex polyhedra, however
with the normals of each polyhedral face being used instead of the base axes, and with the extents being based on the
minimum and maximum dot products of each vertex against the axes. Note that this description assumes the checks
are being done in world space.
References
[1] POV-Ray Documentation (http:/ / www. povray. org/ documentation/ view/ 3. 6. 1/ 323/ )
External links
Illustration of several DOPs for the same model, from epicgames.com (http://udn.epicgames.com/Two/rsrc/
Two/CollisionTutorial/kdop_sizes.jpg)
Bump mapping
27
Bump mapping
Bump mapping is a technique in
computer graphics for simulating
bumps and wrinkles on the surface of
an object. This is achieved by
perturbing the surface normals of the
object and using the perturbed normal
during lighting calculations. The result
is an apparently bumpy surface rather
than a smooth surface although the
surface of the underlying object is not
actually changed. Bump mapping was
introduced by Blinn in 1978.[1]
A sphere without bump mapping (left). A bump map to be applied to the sphere (middle).
The sphere with the bump map applied (right) appears to have a mottled surface
resembling an orange. Bump maps achieve this effect by changing how an illuminated
surface reacts to light without actually modifying the size or shape of the surface
Bump mapping is limited in that it does not actually modify the shape of the underlying
object. On the left, a mathematical function defining a bump map simulates a crumbling
surface on a sphere, but the object's outline and shadow remain those of a perfect sphere.
On the right, the same function is used to modify the surface of a sphere by generating an
isosurface. This actually models a sphere with a bumpy surface with the result that both
its outline and its shadow are rendered realistically.
There are primarily two methods to perform bump mapping. The first uses a height map for simulating the surface
displacement yielding the modified normal. This is the method invented by Blinn and is usually what is referred to as
bump mapping unless specified. The steps of this method are summarized as follows.
Before lighting a calculation is performed for each visible point (or pixel) on the object's surface:
1. Look up the height in the heightmap that corresponds to the position on the surface.
2. Calculate the surface normal of the heightmap, typically using the finite difference method.
3. Combine the surface normal from step two with the true ("geometric") surface normal so that the combined
normal points in a new direction.
Bump mapping
4. Calculate the interaction of the new "bumpy" surface with lights in the scene using, for example, the Phong
reflection model.
The result is a surface that appears to have real depth. The algorithm also ensures that the surface appearance
changes as lights in the scene are moved around.
The other method is to specify a normal map which contains the modified normal for each point on the surface
directly. Since the normal is specified directly instead of derived from a height map this method usually leads to
more predictable results. This makes it easier for artists to work with, making it the most common method of bump
mapping today.
There are also extensions which modify other surface features in addition to increasing the sense of depth. Parallax
mapping is one such extension.
The primary limitation with bump mapping is that it perturbs only the surface normals without changing the
underlying surface itself.[3] Silhouettes and shadows therefore remain unaffected, which is especially noticeable for
larger simulated displacements. This limitation can be overcome by techniques including the displacement mapping
where bumps are actually applied to the surface or using an isosurface.
References
[1] Blinn, James F. "Simulation of Wrinkled Surfaces" (http:/ / portal. acm. org/ citation. cfm?id=507101), Computer Graphics, Vol. 12 (3),
pp.286-292 SIGGRAPH-ACM (August 1978)
[2] Mikkelsen, Morten. Simulation of Wrinkled Surfaces Revisited (http:/ / image. diku. dk/ projects/ media/ morten. mikkelsen. 08. pdf), 2008
(PDF)
[3] Real-Time Bump Map Synthesis (http:/ / web4. cs. ucl. ac. uk/ staff/ j. kautz/ publications/ rtbumpmapHWWS01. pdf), Jan Kautz1, Wolfgang
Heidrichy2 and Hans-Peter Seidel1, (1Max-Planck-Institut fr Informatik, 2University of British Columbia)
External links
Bump shading for volume textures (http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=291525), Max,
N.L., Becker, B.G., Computer Graphics and Applications, IEEE, Jul 1994, Volume 14, Issue 4, pages 18 20,
ISSN 0272-1716
Bump Mapping tutorial using CG and C++ (http://www.blacksmith-studios.dk/projects/downloads/
bumpmapping_using_cg.php)
Simple creating vectors per pixel of a grayscale for a bump map to work and more (http://freespace.virgin.net/
hugo.elias/graphics/x_polybm.htm)
Bump Mapping example (http://www.neilwallis.com/java/bump2.htm) (Java applet)
28
29
Recursive evaluation
CatmullClark surfaces are defined recursively, using the following
refinement scheme:
Start with a mesh of an arbitrary polyhedron. All the vertices in this
mesh shall be called original points.
For each face, add a face point
Set each face point to be the average of all original points for the
respective face.
continuity). After one iteration, the number of extraordinary points on the surface
remains constant.
The arbitrary-looking barycenter formula was chosen by Catmull and Clark based on the aesthetic appearance of the
resulting surfaces rather than on a mathematical derivation, although Catmull and Clark do go to great lengths to
rigorously show that the method yields bicubic B-spline surfaces.
Exact evaluation
The limit surface of CatmullClark subdivision surfaces can also be evaluated directly, without any recursive
refinement. This can be accomplished by means of the technique of Jos Stam. This method reformulates the
recursive refinement process into a matrix exponential problem, which can be solved directly by means of matrix
diagonalization.
3ds max
3D-Coat
AC3D
Anim8or
AutoCAD
Blender
Carrara
CATIA (Imagine and Shape)
CGAL
Cheetah3D
Cinema4D
Clara.io
DAZ Studio, 2.0
Gelato
Hammer
Hexagon
Houdini
K-3D
LightWave 3D, version 9
Maya
Metasequoia
modo
Mudbox
PRMan
Realsoft3D
Remo 3D
Shade
Rhinoceros 3D - Grasshopper 3D Plugin - Weaverbird Plugin
Silo
SketchUp - Requires a Plugin.
Softimage XSI
Strata 3D CX
Wings 3D
Zbrush
TopMod
30
References
Definition
A unit quaternion can be described as:
We can associate a quaternion with a rotation around an axis by the following expression
where is a simple rotation angle (the value in radians of the angle of rotation) and cos(x), cos(y) and cos(z) are
the "direction cosines" locating the axis of rotation (Euler's Theorem).
31
32
Rotation matrices
The orthogonal matrix (post-multiplying a
column vector) corresponding to a
clockwise/left-handed rotation by the unit
quaternion
is
given by the inhomogeneous expression:
Euler angles The xyz (fixed) system is shown in blue, the XYZ (rotated) system
is shown in red. The line of nodes, labelled N, is shown in green.
If
is not a unit quaternion then the homogeneous form is still a scalar multiple of a rotation
matrix, while the inhomogeneous form is in general no longer an orthogonal matrix. This is why in numerical work
the homogeneous form is to be preferred if distortion is to be avoided.
The direction cosine matrix corresponding to a Body 3-2-1 sequence with Euler angles (, , ) is given by:
33
Conversion
By combining the quaternion representations of the Euler rotations we get for the Body 3-2-1 sequence, where the
airplane first does yaw (body-z) turn during taxing on the runway, then pitches (body-y) during take-off, and finally
rolls (body-x) in the air. The resulting orientation of Body 3-2-1 sequence is equivalent to that of Lab 1-2-3
sequence, where the airplane is rolled first (lab-X axis), and then nosed up around the horizontal lab-Y axis, and
finally rotated around the vertical Lab-Z axis:
Yaw
where the X-axis points forward, Y-axis to the right and Z-axis
downward and in the example to follow the rotation occurs in the
order yaw, pitch, roll (about body-fixed axes).
Singularities
One must be aware of singularities in the Euler angle
parametrization when the pitch approaches 90 (north/south
pole). These cases must be handled specially. The common name
for this situation is gimbal lock.
External links
Q60. How do I convert Euler rotation angles to a quaternion? [2] and related questions at The Matrix and
Quaternions FAQ
References
[1] http:/ / www. euclideanspace. com/ maths/ geometry/ rotations/ conversions/ quaternionToEuler/
[2] http:/ / www. j3d. org/ matrix_faq/ matrfaq_latest. html#Q60
Cube mapping
34
Cube mapping
In computer graphics, cube mapping is a method of
environment mapping that uses the six faces of a cube
as the map shape. The environment is projected onto
the sides of a cube and stored as six square textures,
or unfolded into six regions of a single texture. The
cube map is generated by first rendering the scene six
times from a viewpoint, with the views defined by an
orthogonal 90 degree view frustum representing each
cube face.[1]
In the majority of cases, cube mapping is preferred
over the older method of sphere mapping because it
eliminates many of the problems that are inherent in
sphere mapping such as image distortion, viewpoint
dependency, and computational inefficiency. Also,
cube mapping provides a much larger capacity to
support real-time rendering of reflections relative to
sphere mapping because the combination of
inefficiency and viewpoint dependency severely limit
the ability of sphere mapping to be applied when there
is a consistently changing viewpoint.
The lower left image shows a scene with a viewpoint marked with a
black dot. The upper image shows the net of the cube mapping as seen
from that viewpoint, and the lower right image shows the cube
superimposed on the original scene.
History
Cube mapping was first proposed in 1986 by Ned Greene in his paper Environment Mapping and Other
Applications of World Projections,[2] ten years after environment mapping was first put forward by Jim Blinn and
Martin Newell. However, hardware limitations on the ability to access six texture images simultaneously made it
infeasible to implement cube mapping without further technological developments. This problem was remedied in
1999 with the release of the Nvidia GeForce 256. Nvidia touted cube mapping in hardware as a breakthrough image
quality feature of GeForce 256 that ... will allow developers to create accurate, real-time reflections. Accelerated in
hardware, cube environment mapping will free up the creativity of developers to use reflections and specular lighting
effects to create interesting, immersive environments.[3] Today, cube mapping is still used in a variety of graphical
applications as a favored method of environment mapping.
Advantages
Cube mapping is preferred over other methods of environment mapping because of its relative simplicity. Also, cube
mapping produces results that are similar to those obtained by ray tracing, but is much more computationally
efficient the moderate reduction in quality is compensated for by large gains in efficiency.
Predating cube mapping, sphere mapping has many inherent flaws that made it impractical for most applications.
Sphere mapping is view dependent meaning that a different texture is necessary for each viewpoint. Therefore, in
applications where the viewpoint is mobile, it would be necessary to dynamically generate a new sphere mapping for
each new viewpoint (or, to pre-generate a mapping for every viewpoint). Also, a texture mapped onto a sphere's
surface must be stretched and compressed, and warping and distortion (particularly along the edge of the sphere) are
a direct consequence of this. Although these image flaws can be reduced using certain tricks and techniques like
Cube mapping
pre-stretching, this just adds another layer of complexity to sphere mapping.
Paraboloid mapping provides some improvement on the limitations of sphere mapping, however it requires two
rendering passes in addition to special image warping operations and more involved computation.
Conversely, cube mapping requires only a single render pass, and due to its simple nature, is very easy for
developers to comprehend and generate. Also, cube mapping uses the entire resolution of the texture image,
compared to sphere and paraboloid mappings, which also allows it to use lower resolution images to achieve the
same quality. Although handling the seams of the cube map is a problem, algorithms have been developed to handle
seam behavior and result in a seamless reflection.
Disadvantages
If a new object or new lighting is introduced into scene or if some object that is reflected in it is moving or changing
in some manner, then the reflection changes and the cube map must be re-rendered. When the cube map is affixed to
an object that moves through the scene then the cube map must also be re-rendered from that new position.
Applications
Stable Specular Highlights
Computer-aided design (CAD) programs use specular highlights as visual cues to convey a sense of surface
curvature when rendering 3D objects. However, many CAD programs exhibit problems in sampling specular
highlights because the specular lighting computations are only performed at the vertices of the mesh used to
represent the object, and interpolation is used to estimate lighting across the surface of the object. Problems occur
when the mesh vertices are not dense enough, resulting in insufficient sampling of the specular lighting. This in turn
results in highlights with brightness proportionate to the distance from mesh vertices, ultimately compromising the
visual cues that indicate curvature. Unfortunately, this problem cannot be solved simply by creating a denser mesh,
as this can greatly reduce the efficiency of object rendering.
Cube maps provide a fairly straightforward and efficient solution to rendering stable specular highlights. Multiple
specular highlights can be encoded into a cube map texture, which can then be accessed by interpolating across the
surface's reflection vector to supply coordinates. Relative to computing lighting at individual vertices, this method
provides cleaner results that more accurately represent curvature. Another advantage to this method is that it scales
well, as additional specular highlights can be encoded into the texture at no increase in the cost of rendering.
However, this approach is limited in that the light sources must be either distant or infinite lights, although
fortunately this is usually the case in CAD programs.[4]
Skyboxes
Perhaps the most trivial application of cube mapping is to create pre-rendered panoramic sky images which are then
rendered by the graphical engine as faces of a cube at practically infinite distance with the view point located in the
center of the cube. The perspective projection of the cube faces done by the graphics engine undoes the effects of
projecting the environment to create the cube map, so that the observer experiences an illusion of being surrounded
by the scene which was used to generate the skybox. This technique has found a widespread use in video games
since it allows designers to add complex (albeit not explorable) environments to a game at almost no performance
cost.
35
Cube mapping
36
Skylight Illumination
Cube maps can be useful for modelling outdoor illumination accurately. Simply modelling sunlight as a single
infinite light oversimplifies outdoor illumination and results in unrealistic lighting. Although plenty of light does
come from the sun, the scattering of rays in the atmosphere causes the whole sky to act as a light source (often
referred to as skylight illumination).However, by using a cube map the diffuse contribution from skylight
illumination can be captured. Unlike environment maps where the reflection vector is used, this method accesses the
cube map based on the surface normal vector to provide a fast approximation of the diffuse illumination from the
skylight. The one downside to this method is that computing cube maps to properly represent a skylight is very
complex; one recent process is computing the spherical harmonic basis that best represents the low frequency diffuse
illumination from the cube map. However, a considerable amount of research has been done to effectively model
skylight illumination.
Dynamic Reflection
Basic environment mapping uses a static cube map - although the
object can be moved and distorted, the reflected environment stays
consistent. However, a cube map texture can be consistently updated to
represent a dynamically changing environment (for example, trees
swaying in the wind). A simple yet costly way to generate dynamic
reflections, involves building the cube maps at runtime for every
frame. Although this is far less efficient than static mapping because of
additional rendering steps, it can still be performed at interactive rates.
Unfortunately, this technique does not scale well when multiple reflective objects are present. A unique dynamic
environment map is usually required for each reflective object. Also, further complications are added if reflective
objects can reflect each other - dynamic cube maps can be recursively generated approximating the effects normally
generated using raytracing.
Global Illumination
An algorithm for global illumination computation at interactive rates using a cube-map data structure, was presented
at ICCVG 2002.[5]
Projection textures
Another application which found widespread use in video games, projective texture mapping relies on cube maps to
project images of an environment onto the surrounding scene; for example, a point light source is tied to a cube map
which is a panoramic image shot from inside a lantern cage or a window frame through which the light is filtering.
This enables a game developers to achieve realistic lighting without having to complicate the scene geometry or
resort to expensive real-time shadow volume computations.
Related
A large set of free cube maps for experimentation: http://www.humus.name/index.php?page=Textures
Mark VandeWettering took M. C. Escher's famous self portrait Hand with Reflecting Sphere and reversed the
mapping to obtain these cube map images: left [6], right [7], up [8], down [9], back [10], front [11]. Here is a three.js
demo using these images (best viewed in wide browser window, and may need to refresh page to view demo): http://
mrdoob.github.io/three.js/examples/webgl_materials_cubemap_escher.html
Cube mapping
37
References
[1] Fernando, R. & Kilgard M. J. (2003). The CG Tutorial: The Definitive Guide to Programmable Real-Time Graphics. (1st ed.).
Addison-Wesley Longman Publishing Co., Inc. Boston, MA, USA. Chapter 7: Environment Mapping Techniques
[2] Greene, N. 1986. Environment mapping and other applications of world projections. IEEE Comput. Graph. Appl. 6, 11 (Nov. 1986), 21-29.
(http:/ / dx. doi. org/ 10. 1109/ MCG. 1986. 276658)
[3] Nvidia, Jan 2000. Technical Brief: Perfect Reflections and Specular Lighting Effects With Cube Environment Mapping (http:/ / developer.
nvidia. com/ object/ Cube_Mapping_Paper. html)
[4] Nvidia, May 2004. Cube Map OpenGL Tutorial (http:/ / developer. nvidia. com/ object/ cube_map_ogl_tutorial. html)
[5] http:/ / citeseerx. ist. psu. edu/ viewdoc/ summary?doi=10. 1. 1. 95. 946
[6] http:/ / mrdoob. github. io/ three. js/ examples/ textures/ cube/ Escher/ px. jpg
[7] http:/ / mrdoob. github. io/ three. js/ examples/ textures/ cube/ Escher/ nx. jpg
[8] http:/ / mrdoob. github. io/ three. js/ examples/ textures/ cube/ Escher/ py. jpg
[9] http:/ / mrdoob. github. io/ three. js/ examples/ textures/ cube/ Escher/ ny. jpg
[10] http:/ / mrdoob. github. io/ three. js/ examples/ textures/ cube/ Escher/ pz. jpg
[11] http:/ / mrdoob. github. io/ three. js/ examples/ textures/ cube/ Escher/ nz. jpg
Diffuse reflection
Diffuse reflection is the reflection of light from a surface such that an
incident ray is reflected at many angles rather than at just one angle as
in the case of specular reflection. An illuminated ideal diffuse
reflecting surface will have equal luminance from all directions which
lie in the half-space adjacent to the surface (Lambertian reflectance).
A surface built from a non-absorbing powder such as plaster, or from
fibers such as paper, or from a polycrystalline material such as white
marble, reflects light diffusely with great efficiency. Many common
materials exhibit a mixture of specular and diffuse reflection.
The visibility of objects, excluding light-emitting ones, is primarily
caused by diffuse reflection of light: it is diffusely-scattered light that
forms the image of the object in the observer's eye.
Diffuse reflection
38
Mechanism
Diffuse reflection from solids is generally not due to
surface roughness. A flat surface is indeed required to
give specular reflection, but it does not prevent diffuse
reflection. A piece of highly polished white marble
remains white; no amount of polishing will turn it into
a mirror. Polishing produces some specular reflection,
but the remaining light continues to be diffusely
reflected.
The most general mechanism by which a surface gives
diffuse reflection does not involve exactly the surface:
most of the light is contributed by scattering centers
beneath the surface,[1][2] as illustrated in Figure1 at
right. If one were to imagine that the figure represents
snow, and that the polygons are its (transparent) ice
crystallites, an impinging ray is partially reflected (a
few percent) by the first particle, enters in it, is again
reflected by the interface with the second particle,
enters in it, impinges on the third, and so on, generating
a series of "primary" scattered rays in random
directions, which, in turn, through the same
mechanism, generate a large number of "secondary"
scattered rays, which generate "tertiary" rays...[3] All
these rays walk through the snow crystallytes, which do
not absorb light, until they arrive at the surface and exit
in random directions.[4] The result is that the light that
was sent out is returned in all directions, so that snow is
white despite being made of transparent material (ice
crystals).
For simplicity, "reflections" are spoken of here, but
more generally the interface between the small particles
that constitute many materials is irregular on a scale
comparable with light wavelength, so diffuse light is
generated at each interface, rather than a single
reflected ray, but the story can be told the same way.
This mechanism is very general, because almost all common materials are made of "small things" held together.
Mineral materials are generally polycrystalline: one can describe them as made of a 3D mosaic of small, irregularly
shaped defective crystals. Organic materials are usually composed of fibers or cells, with their membranes and their
complex internal structure. And each interface, inhomogeneity or imperfection can deviate, reflect or scatter light,
reproducing the above mechanism.
Few materials don't follow it: among them are metals, which do not allow light to enter; gases, liquids, glass, and
transparent plastics (which have a liquid-like amorphous microscopic structure); single crystals, such as some gems
or a salt crystal; and some very special materials, such as the tissues which make the cornea and the lens of an eye.
These materials can reflect diffusely, however, if their surface is microscopically rough, like in a frost glass
Diffuse reflection
(Figure2), or, of course, if their homogeneous structure deteriorates, as in the eye lens.
A surface may also exhibit both specular and diffuse reflection, as is the case, for example, of glossy paints as used
in home painting, which give also a fraction of specular reflection, while matte paints give almost exclusively diffuse
reflection.
Colored objects
Up to now white objects have been discussed, which do not absorb light. But the above scheme continues to be valid
in the case that the material is absorbent. In this case, diffused rays will lose some wavelengths during their walk in
the material, and will emerge colored.
More, diffusion affects in a substantial manner the color of objects, because it determines the average path of light in
the material, and hence to which extent the various wavelengths are absorbed.[5] Red ink looks black when it stays in
its bottle. Its vivid color is only perceived when it is placed on a scattering material (e.g. paper). This is so because
light's path through the paper fibers (and through the ink) is only a fraction of millimeter long. Light coming from
the bottle, instead, has crossed centimeters of ink, and has been heavily absorbed, even in its red wavelengths.
And, when a colored object has both diffuse and specular reflection, usually only the diffuse component is colored.
A cherry reflects diffusely red light, absorbs all other colors and has a specular reflection which is essentially white.
This is quite general, because, except for metals, the reflectivity of most materials depends on their refraction index,
which varies little with the wavelength (though it is this variation that causes the chromatic dispersion in a prism), so
that all colors are reflected nearly with the same intensity. Reflections from different origin, instead, may be colored:
metallic reflections, such as in gold or copper, or interferential reflections: iridescences, peacock feathers, butterfly
wings, beetle elytra, or the antireflection coating of a lens.
39
Diffuse reflection
40
Interreflection
Diffuse interreflection is a process whereby light reflected from an object strikes other objects in the surrounding
area, illuminating them. Diffuse interreflection specifically describes light reflected from objects which are not shiny
or specular. In real life terms what this means is that light is reflected off non-shiny surfaces such as the ground,
walls, or fabric, to reach areas not directly in view of a light source. If the diffuse surface is colored, the reflected
light is also colored, resulting in similar coloration of surrounding objects.
In 3D computer graphics, diffuse interreflection is an important component of global illumination. There are a
number of ways to model diffuse interreflection when rendering a scene. Radiosity and photon mapping are two
commonly used methods.
References
[1] P.Hanrahan and W.Krueger (1993), Reflection from layered surfaces due to subsurface scattering, in SIGGRAPH 93 Proceedings, J. T.
Kajiya, Ed., vol.27, pp.165174 (http:/ / www. cs. berkeley. edu/ ~ravir/ 6998/ papers/ p165-hanrahan. pdf).
[2] H.W.Jensen et al. (2001), A practical model for subsurface light transport, in ' Proceedings of ACM SIGGRAPH 2001', pp.511518 (http:/ /
www. cs. berkeley. edu/ ~ravir/ 6998/ papers/ p511-jensen. pdf)
[3] Only primary and secondary rays are represented in the figure.
[4] Or, if the object is thin, it can exit from the opposite surface, giving diffuse transmitted light.
[5] Paul Kubelka, Franz Munk (1931), Ein Beitrag zur Optik der Farbanstriche, Zeits. f. Techn. Physik, 12, 593601, see The Kubelka-Munk
Theory of Reflectance (http:/ / web. eng. fiu. edu/ ~godavart/ BME-Optics/ Kubelka-Munk-Theory. pdf)
Displacement mapping
Displacement mapping is an alternative computer graphics technique
in contrast to bump mapping, normal mapping, and parallax mapping,
using a (procedural-) texture- or height map to cause an effect where
the actual geometric position of points over the textured surface are
displaced, often along the local surface normal, according to the value
the texture function evaluates to at each point on the surface. It gives
surfaces a great sense of depth and detail, permitting in particular
self-occlusion, self-shadowing and silhouettes; on the other hand, it is
the most costly of this class of techniques owing to the large amount of
additional geometry.
For years, displacement mapping was a peculiarity of high-end
rendering systems like PhotoRealistic RenderMan, while realtime
APIs, like OpenGL and DirectX, were only starting to use this feature.
One of the reasons for this is that the original implementation of
displacement mapping required an adaptive tessellation of the surface
in order to obtain enough micropolygons whose size matched the size
of a pixel on the screen.
Displacement mapping
Displacement mapping
41
Displacement mapping
42
Further reading
References
[1]
[2]
[3]
[4]
[5]
[6]
Evaluation
External links
[1] D. Doo: A subdivision algorithm for smoothing down irregularly shaped polyhedrons, Proceedings on Interactive Techniques in Computer
Aided Design, pp. 157 - 165, 1978 ( pdf (http:/ / trac2. assembla. com/ DooSabinSurfaces/ export/ 12/ trunk/ docs/ Doo 1978 Subdivision
algorithm. pdf))
[2] D. Doo and M. Sabin: Behavior of recursive division surfaces near extraordinary points, Computer-Aided Design, 10 (6) 356360 (1978), (
doi (http:/ / dx. doi. org/ 10. 1016/ 0010-4485(78)90111-2), pdf (http:/ / www. cs. caltech. edu/ ~cs175/ cs175-02/ resources/ DS. pdf))
[3] Jos Stam, Exact Evaluation of CatmullClark Subdivision Surfaces at Arbitrary Parameter Values, Proceedings of SIGGRAPH'98. In
Computer Graphics Proceedings, ACM SIGGRAPH, 1998, 395404 ( pdf (http:/ / www. dgp. toronto. edu/ people/ stam/ reality/ Research/
pdf/ sig98. pdf), downloadable eigenstructures (http:/ / www. dgp. toronto. edu/ ~stam/ reality/ Research/ SubdivEval/ index. html))
Edge loop
An edge loop, in computer graphics, can loosely be defined as a set of connected edges across a surface. Usually the
last edge meets again with the first edge, thus forming a loop. The set or string of edges can for example be the outer
edges of a flat surface or the edges surrounding a 'hole' in a surface.
In a stricter sense an edge loop is defined as a set of edges where the loop follows the middle edge in every 'four way
junction'.[1] The loop will end when it encounters another type of junction (three or five way for example). Take an
edge on a mesh surface for example, say at one end of the edge it connects with three other edges, making a four way
junction. If you follow the middle 'road' each time you would either end up with a completed loop or the edge loop
would end at another type of junction.
Edge loops are especially practical in organic models which need to be animated. In organic modeling edge loops
play a vital role in proper deformation of the mesh.[2] A properly modeled mesh will take into careful consideration
the placement and termination of these edge loops. Generally edge loops follow the structure and contour of the
muscles that they mimic. For example, in modeling a human face edge loops should follow the orbicularis oculi
muscle around the eyes and the orbicularis oris muscle around the mouth. The hope is that by mimicking the way the
muscles are formed they also aid in the way the muscles are deformed by way of contractions and expansions. An
edge loop closely mimics how real muscles work, and if built correctly, will give you control over contour and
silhouette in any position.
An important part in developing proper edge loops is by understanding poles.[3] The E(5) Pole and the N(3) Pole are
the two most important poles in developing both proper edge loops and a clean topology on your model. The E(5)
Pole is derived from an extruded face. When this face is extruded, four 4-sided polygons are formed in addition to
the original face. Each lower corner of these four polygons forms a five-way junction. Each one of these five-way
junctions is an E-pole. An N(3) Pole is formed when 3 edges meet at one point creating a three-way junction. The
N(3) Pole is important in that it redirects the direction of an edge loop.
References
[1] Edge Loop (http:/ / wiki. cgsociety. org/ index. php/ Edge_Loop), CG Society
[2] Modeling With Edge Loops (http:/ / zoomy. net/ 2008/ 04/ 02/ modeling-with-edge-loops/ ), Zoomy.net
[3] "The pole" (http:/ / www. subdivisionmodeling. com/ forums/ showthread. php?t=907), SubdivisionModeling.com
External links
Edge Loop (http://wiki.cgsociety.org/index.php/Edge_Loop), CG Society
43
Euler operator
44
Euler operator
In mathematics Euler operators may refer to:
EulerLagrange differential operator d/dx see Lagrangian system
CauchyEuler operators e.g. xd/dx
quantum white noise conservation or QWN-Euler operator QWN-Euler operator
Description
V E F H S G
MBFLV
Make Body-Face-Loop-Vertex
MEV
Make Edge-Vertex
MEFL
Make Edge-Face-Loop
MEKL
-1
KFLEVB
Kill Faces-Loops-Edges-Vertices-Body
-1
Geometry
Euler operators modify the mesh's graph creating or removing faces, edges and vertices according to simple rules
while preserving the overall topology thus maintaining a valid boundary (i.e. not introducing holes). The operators
themselves don't define how geometric or graphical attributes map to the new graph: e.g. position, gradient, uv
texture coordinate, these will depend on the particular implementation.
References
[1] Baumgart, B.G^ "Winged edge polyhedron representation", Stanford Artificial Intelligence Report No. CS-320, October, 1972.
Euler operator
compsci/1587). Unfortunately this typo-ridden (OCRd?) paper can be quite hard to read.
Easier-to-read reference (http://solidmodel.me.ntu.edu.tw/lessoninfo/file/Chapter03.pdf), from a
solid-modelling course at NTU.
Another reference (http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/model/euler-op.html) that
uses a slightly different definition of terms.
Sven Havemann, Generative Mesh Modeling (http://www.eg.org/EG/DL/dissonline/doc/havemann.pdf),
PhD thesis, Braunschweig University, Germany, 2005.
Martti Mntyl, An Introduction to Solid Modeling, Computer Science Press, Rockville MD, 1988. ISBN
0-88175-108-1.
False radiosity
False Radiosity is a 3D computer graphics technique used to create texture mapping for objects that emulates patch
interaction algorithms in radiosity rendering. Though practiced in some form since the late 90s, this term was coined
only around 2002 by architect Andrew Hartness, then head of 3D and real-time design at Ateliers Jean Nouvel.
During the period of nascent commercial enthusiasm for radiosity-enhanced imagery, but prior to the
democratization of powerful computational hardware, architects and graphic artists experimented with time-saving
3D rendering techniques. By darkening areas of texture maps corresponding to corners, joints and recesses, and
applying maps via self-illumination or diffuse mapping in a 3D program, a radiosity-like effect of patch interaction
could be created with a standard scan-line renderer. Successful emulation of radiosity required a theoretical
understanding and graphic application of patch view factors, path tracing and global illumination algorithms. Texture
maps were usually produced with image editing software, such as Adobe Photoshop. The advantage of this method is
decreased rendering time and easily modifiable overall lighting strategies.
Another common approach similar to false radiosity is the manual placement of standard omni-type lights with
limited attenuation in places in the 3D scene where the artist would expect radiosity reflections to occur. This
method uses many lights and can require an advanced light-grouping system, depending on what assigned
materials/objects are illuminated, how many surfaces require false radiosity treatment, and to what extent it is
anticipated that lighting strategies be set up for frequent changes.
References
Autodesk interview with Hartness about False Radiosity and real-time design [1]
References
[1] http:/ / usa. autodesk. com/ adsk/ servlet/ item?siteID=123112& id=5549510& linkID=10371177
45
Fragment
Fragment
In computer graphics, a fragment is the data necessary to generate a single pixel's worth of a drawing primitive in
the frame buffer.
This data may include, but is not limited to:
raster position
depth
interpolated attributes (color, texture coordinates, etc.)
stencil
alpha
window ID
As a scene is drawn, drawing primitives (the basic elements of graphics output, such as points,lines, circles, text etc.
[1]
) are rasterized into fragments which are textured and combined with the existing frame buffer. How a fragment is
combined with the data already in the frame buffer depends on various settings. In a typical case, a fragment may be
discarded if it is farther away than the pixel that is already at that location (according to the depth buffer). If it is
nearer than the existing pixel, it may replace what is already there, or, if alpha blending is in use, the pixel's color
may be replaced with a mixture of the fragment's color and the pixel's existing color, as in the case of drawing a
translucent object.
In general, a fragment can be thought of as the data needed to shade the pixel, plus the data needed to test whether
the fragment survives to become a pixel (depth, alpha, stencil, scissor, window ID, etc.)
References
[1] The Drawing Primitives by Janne Saarela (http:/ / baikalweb. jinr. ru/ doc/ cern_doc/ asdoc/ gks_html3/ node28. html)
46
Geometry pipelines
Geometry pipelines
Geometric manipulation of modeling primitives, such as that performed by a geometry pipeline, is the first stage in
computer graphics systems which perform image generation based on geometric models. While Geometry Pipelines
were originally implemented in software, they have become highly amenable to hardware implementation,
particularly since the advent of very-large-scale integration (VLSI) in the early 1980s. A device called the Geometry
Engine developed by Jim Clark and Marc Hannah at Stanford University in about 1981 was the watershed for what
has since become an increasingly commoditized function in contemporary image-synthetic raster display systems.
Geometric transformations are applied to the vertices of polygons, or other geometric objects used as modelling
primitives, as part of the first stage in a classical geometry-based graphic image rendering pipeline. Geometric
computations may also be applied to transform polygon or patch surface normals, and then to perform the lighting
and shading computations used in their subsequent rendering.
History
Hardware implementations of the geometry pipeline were introduced in the early Evans & Sutherland Picture
System, but perhaps received broader recognition when later applied in the broad range of graphics systems products
introduced by Silicon Graphics (SGI). Initially the SGI geometry hardware performed simple model space to screen
space viewing transformations with all the lighting and shading handled by a separate hardware implementation
stage, but in later, much higher performance applications such as the RealityEngine, they began to be applied to
perform part of the rendering support as well.
More recently, perhaps dating from the late 1990s, the hardware support required to perform the manipulation and
rendering of quite complex scenes has become accessible to the consumer market. Companies such as Nvidia and
AMD Graphics (formerly ATI) are two current leading representatives of hardware vendors in this space. The
GeForce line of graphics cards from Nvidia was the first to support full OpenGL and Direct3D hardware geometry
processing in the consumer PC market, while some earlier products such as Rendition Verite incorporated hardware
geometry processing through proprietary programming interfaces. On the whole, earlier graphics accelerators by
3Dfx, Matrox and others relied on the CPU for geometry processing.
This subject matter is part of the technical foundation for modern computer graphics, and is a comprehensive topic
taught at both the undergraduate and graduate levels as part of a computer science education.
References
47
Geometry processing
Geometry processing
Geometry processing, or mesh processing, is a fast-growing[citation needed] area of research that uses concepts from
applied mathematics, computer science and engineering to design efficient algorithms for the acquisition,
reconstruction, analysis, manipulation, simulation and transmission of complex 3D models.
Applications of geometry processing algorithms already cover a wide range of areas from multimedia, entertainment
and classical computer-aided design, to biomedical computing, reverse engineering and scientific computing.[citation
needed]
References
External links
Siggraph 2001 Course on Digital Geometry Processing (http://www.multires.caltech.edu/pubs/DGPCourse/),
by Peter Schroder and Wim Sweldens
Symposium on Geometry Processing (http://www.geometryprocessing.org/)
Multi-Res Modeling Group (http://www.multires.caltech.edu/), Caltech
Mathematical Geometry Processing Group (http://geom.mi.fu-berlin.de/index.html), Free University of
Berlin
Computer Graphics Group (http://www.graphics.rwth-aachen.de), RWTH Aachen University
Polygonal Mesh Processing Book (http://www.pmp-book.org/)
Global illumination
Rendering without global illumination. Areas that lie outside of the ceiling lamp's direct light lack definition. For
example, the lamp's housing appears completely uniform. Without the ambient light added into the render, it would
appear uniformly black.
48
Global illumination
Rendering with global illumination. Light is reflected by surfaces, and colored light transfers from one surface to
another. Notice how color from the red wall and green wall (not visible) reflects onto other surfaces in the scene.
Also notable is the caustic projected onto the red wall from light passing through the glass sphere.
Global illumination is a general name for a group of algorithms used in 3D computer graphics that are meant to add
more realistic lighting to 3D scenes. Such algorithms take into account not only the light which comes directly from
a light source (direct illumination), but also subsequent cases in which light rays from the same source are reflected
by other surfaces in the scene, whether reflective or not (indirect illumination).
Theoretically reflections, refractions, and shadows are all examples of global illumination, because when simulating
them, one object affects the rendering of another object (as opposed to an object being affected only by a direct
light). In practice, however, only the simulation of diffuse inter-reflection or caustics is called global illumination.
Images rendered using global illumination algorithms often appear more photorealistic than images rendered using
only direct illumination algorithms. However, such images are computationally more expensive and consequently
much slower to generate. One common approach is to compute the global illumination of a scene and store that
information with the geometry, e.g., radiosity. That stored data can then be used to generate images from different
viewpoints for generating walkthroughs of a scene without having to go through expensive lighting calculations
repeatedly.
Radiosity, ray tracing, beam tracing, cone tracing, path tracing, Metropolis light transport, ambient occlusion, photon
mapping, and image based lighting are examples of algorithms used in global illumination, some of which may be
used together to yield results that are not fast, but accurate.
These algorithms model diffuse inter-reflection which is a very important part of global illumination; however most
of these (excluding radiosity) also model specular reflection, which makes them more accurate algorithms to solve
the lighting equation and provide a more realistically illuminated scene.
The algorithms used to calculate the distribution of light energy between surfaces of a scene are closely related to
heat transfer simulations performed using finite-element methods in engineering design.
In real-time 3D graphics, the diffuse inter-reflection component of global illumination is sometimes approximated by
an "ambient" term in the lighting equation, which is also called "ambient lighting" or "ambient color" in 3D software
packages. Though this method of approximation (also known as a "cheat" because it's not really a global illumination
method) is easy to perform computationally, when used alone it does not provide an adequately realistic effect.
Ambient lighting is known to "flatten" shadows in 3D scenes, making the overall visual effect more bland. However,
used properly, ambient lighting can be an efficient way to make up for a lack of processing power.
49
Global illumination
50
Procedure
More and more specialized algorithms are used in 3D programs that can effectively simulate the global illumination.
These algorithms are numerical approximations to the rendering equation. Well known algorithms for computing
global illumination include path tracing, photon mapping and radiosity. The following approaches can be
distinguished here:
Inversion:
is not applied in practice
Expansion:
bi-directional approach: Photon mapping + Distributed ray tracing, Bi-directional path tracing, Metropolis light
transport
Iteration:
Radiosity
In Light path notation global lighting the paths of the type L (D | S) corresponds * E.
A full treatment can be found in
Image-based lighting
Another way to simulate real global illumination is the use of High dynamic range images (HDRIs), also known as
environment maps, which encircle and illuminate the scene. This process is known as image-based lighting.
List of methods
Method
Description/Notes
Ray tracing
Several enhanced variants exist for solving problems related to sampling, aliasing, soft shadows: Distributed ray
tracing, Cone tracing, Beam tracing.
Path tracing
Photon mapping
Consistent, biased; enhanced variants: Progressive Photon Mapping, Stochastic Progressive Photon Mapping
[1]
(unbiased variant )
Lightcuts
Radiosity
Spherical harmonic
lighting
Ambient occlusion
Not a physically correct method, but gives good results in general. Good for precomputation.
[2][3]
Global illumination
51
References
[1] http:/ / www. luxrender. net/ wiki/ SPPM
[2] http:/ / graphics. pixar. com/ library/ PointBasedGlobalIlluminationForMovieProduction/ paper. pdf
[3] http:/ / www. karstendaemen. com/ thesis/ files/ intro_pbgi. pdf
External links
SSRT (http://www.nirenstein.com/e107/page.php?11) C++ source code for a Monte-carlo pathtracer
(supporting GI) - written with ease of understanding in mind.
Video demonstrating global illumination and the ambient color effect (http://www.archive.org/details/
MarcC_AoI-Global_Illumination)
Real-time GI demos (http://realtimeradiosity.com/demos) survey of practical real-time GI techniques as a list
of executable demos
kuleuven (http://www.cs.kuleuven.be/~phil/GI/) - This page contains the Global Illumination Compendium,
an effort to bring together most of the useful formulas and equations for global illumination algorithms in
computer graphics.
GI Tutorial (http://www.youtube.com/watch?v=K5a-FqHz3o0) - Video tutorial on faking global illumination
within 3D Studio Max by Jason Donati
Gouraud shading
Gouraud shading, named after Henri
Gouraud, is an interpolation method used in
computer graphics to produce continuous
shading of surfaces represented by polygon
meshes. In practice, Gouraud shading is
most often used to achieve continuous
lighting on triangle surfaces by computing
the lighting at the corners of each triangle
and linearly interpolating the resulting
colours for each pixel covered by the
triangle. Gouraud first published the
technique in 1971.
Description
Gouraud shading works as follows: An estimate to the surface normal of each vertex in a polygonal 3D model is
either specified for each vertex or found by averaging the surface normals of the polygons that meet at each vertex.
Using these estimates, lighting computations based on a reflection model, e.g. the Phong reflection model, are then
performed to produce colour intensities at the vertices. For each screen pixel that is covered by the polygonal mesh,
colour intensities can then be interpolated from the colour values calculated at the vertices.
Gouraud shading
52
Gouraud shading
References
Graphics pipeline
Graphics pipeline or rendering pipeline refers to the sequence of steps used to create a 2D raster representation of
a 3D scene. Plainly speaking, once you have created a 3D model, for instance, in a video game, or any other 3d
computer animation, the graphics pipeline is the process of turning that 3D model into what the computer displays.
In the early history of 3D computer graphics fixed purpose hardware was used to speed up the steps of the pipeline,
but the hardware evolved, becoming more general purpose, allowing greater flexibility in graphics rendering, as well
as more generalized hardware, allowing the same generalized hardware to perform not only different steps of the
pipeline, unlike fixed purpose hardware, but even limited forms of general purpose computing. As the hardware
evolved, so did the graphics pipelines, the OpenGL, and DirectX pipelines, but the general concept of the pipeline
remains the same.
Concept
The 3d pipeline usually refers to the most common form of computer 3d rendering, 3d polygon rendering, distinct
from raytracing, and raycasting. In particular, 3d polygon rendering is similar to raycasting. In raycasting, a ray
originates at the point where the camera resides, if that ray hits a surface, then the color and lighting of the point on
the surface where the ray hit is calculated. In 3d polygon rendering the reverse happens, the area that is in view of the
camera is calculated, and then rays are created from every part of every surface in view of the camera and traced
back to the camera.[1]
Camera transformation
Transform the 3d world coordinate system into the 3d camera coordinate system, with the camera as the origin.
Lighting
Illuminate according to lighting and reflectance. If the teapot is a brilliant white color, but in a totally black room,
then the camera sees it as black. In this step the effect of lighting and reflections are calculated.
Projection transformation
Transform the 3d world coordinates into the 2d view of the camera, for instance the object the camera is centered on
would be in the center of the 2d view of the camera. In the case of a Perspective projection, objects which are distant
from the camera are made smaller. This is achieved by dividing the X and Y coordinates of each vertex of each
primitive by its Z coordinate(which represents its distance from the camera). In an orthographic projection, objects
53
Graphics pipeline
retain their original size regardless of distance from the camera.
Clipping
Geometric primitives that now fall completely outside of the viewing frustum will not be visible and are discarded at
this stage.
References
1. ^ Graphics pipeline. (n.d.). Computer Desktop Encyclopedia. Retrieved December 13, 2005, from Answers.com:
[2]
2. ^ Raster Graphics and Color [3] 2004 by Greg Humphreys at the University of Virginia
[1] http:/ / www. cs. virginia. edu/ ~gfx/ Courses/ 2012/ IntroGraphics/ lectures/ 13-Pipeline. pdf
[2] http:/ / www. answers. com/ topic/ graphics-pipeline
[3] http:/ / www. cs. virginia. edu/ ~gfx/ Courses/ 2004/ Intro. Fall. 04/ handouts/ 01-raster. pdf
External links
MIT OpenCourseWare Computer Graphics, Fall 2003 (http://ocw.mit.edu/courses/
electrical-engineering-and-computer-science/6-837-computer-graphics-fall-2003/)
ExtremeTech 3D Pipeline Tutorial (http://www.extremetech.com/computing/
49076-extremetech-3d-pipeline-tutorial)
http://developer.nvidia.com/
http://www.atitech.com/developer/
54
55
Algorithms
A commonly used algorithm to implement it is Arthur Appel's
algorithm.[1] This algorithm works by propagating the visibility from a
segment with a known visibility to a segment whose visibility is yet to
be determined. Certain pathological cases exist that can make this
algorithm difficult to implement. Those cases are:
1. Vertices on edges;
2. Edges on vertices;
3. Edges on edges.
This algorithm is unstable because an error in visibility will be propagated to subsequent nodes (although there are
ways to compensate for this problem).[2]
References
[1] (Appel, A., "The Notion of Quantitative Invisibility and the Machine Rendering of Solids", Proceedings ACM National Conference,
Thompson Books, Washington, DC, 1967, pp. 387-393.)
[2] James Blinn, "Fractional Invisibility", IEEE Computer Graphics and Applications, Nov. 1988, pp. 77-84.
External links
Patrick-Gilles Maillot's Thesis (https://sites.google.com/site/patrickmaillot/english) an extension of the
Bresenham line drawing algorithm to perform 3D hidden lines removal; also published in MICAD '87
proceedings on CAD/CAM and Computer Graphics, page 591 - ISBN 2-86601-084-1.
Vector Hidden Line Removal (http://wheger.tripod.com/vhl/vhl.htm) An article by Walter Heger with a
further description (of the pathological cases) and more citations.
Background
Hidden surface determination is a process by which surfaces which should not be visible to the user (for example,
because they lie behind opaque objects such as walls) are prevented from being rendered. Despite advances in
hardware capability there is still a need for advanced rendering algorithms. The responsibility of a rendering engine
is to allow for large world spaces and as the worlds size approaches infinity the engine should not slow down but
remain at constant speed. Optimising this process relies on being able to ensure the diversion of as few resources as
possible towards the rendering of surfaces that will not end up being rendered to the user.
There are many techniques for hidden surface determination. They are fundamentally an exercise in sorting, and
usually vary in the order in which the sort is performed and how the problem is subdivided. Sorting large quantities
of graphics primitives is usually done by divide and conquer.
56
Backface culling
Since meshes are hollow shells, not solid objects, the back side of some faces, or polygons, in the mesh will never
face the camera. Typically, there is no reason to draw such faces. This is responsible for the effect often seen in
computer and video games in which, if the camera happens to be inside a mesh, rather than seeing the "inside"
surfaces of the mesh, it mostly disappears. (Some game engines continue to render any forward-facing or
double-sided polygons, resulting in stray shapes appearing without the rest of the penetrated mesh.)
Contribution culling
Often, objects are so far away that they do not contribute significantly to the final image. These objects are thrown
away if their screen projection is too small. See Clipping plane.
Occlusion culling
Objects that are entirely behind other opaque objects may be culled. This is a very popular mechanism to speed up
the rendering of large scenes that have a moderate to high depth complexity. There are several types of occlusion
culling approaches:
Potentially visible set or PVS rendering, divides a scene into regions and pre-computes visibility for them. These
visibility sets are then indexed at run-time to obtain high quality visibility sets (accounting for complex occluder
interactions) quickly.
57
Sources
http://www.cs.washington.edu/education/courses/cse557/07wi/lectures/hidden-surfaces.pdf
http://design.osu.edu/carlson/history/PDFs/ten-hidden-surface.pdf
References
[1] http:/ / www. cs. unc. edu/ ~zhangh/ hom. html
58
History
The use of high-dynamic-range imaging (HDRI) in computer graphics was introduced by Greg Ward in 1985 with
his open-source Radiance rendering and lighting simulation software which created the first file format to retain a
high-dynamic-range image. HDRI languished for more than a decade, held back by limited computing power,
storage, and capture methods. Not until recently has the technology to put HDRI into practical use been developed.
In 1990, Nakame, et al., presented a lighting model for driving simulators that highlighted the need for
high-dynamic-range processing in realistic simulations.
In 1995, Greg Spencer presented Physically-based glare effects for digital images at SIGGRAPH, providing a
quantitative model for flare and blooming in the human eye.
In 1997 Paul Debevec presented Recovering high dynamic range radiance maps from photographs at SIGGRAPH
and the following year presented Rendering synthetic objects into real scenes. These two papers laid the framework
for creating HDR light probes of a location and then using this probe to light a rendered scene.
HDRI and HDRL (high-dynamic-range image-based lighting) have, ever since, been used in many situations in 3D
scenes in which inserting a 3D object into a real environment requires the lightprobe data to provide realistic lighting
solutions.
In gaming applications, Riven: The Sequel to Myst in 1997 used an HDRI postprocessing shader directly based on
Spencer's paper. After E 2003, Valve Software released a demo movie of their Source engine rendering a cityscape
in a high dynamic range. The term was not commonly used again until E 2004, where it gained much more attention
when Valve Software announced Half-Life 2: Lost Coast and Epic Games showcased Unreal Engine 3, coupled with
open-source engines such as OGRE 3D and open-source games like Nexuiz.
Examples
One of the primary advantages of HDR rendering is that details in a scene with a large contrast ratio are preserved.
Without HDR, areas that are too dark are clipped to black and areas that are too bright are clipped to white. These are
represented by the hardware as a floating point value of 0.0 and 1.0 for pure black and pure white, respectively.
Another aspect of HDR rendering is the addition of perceptual cues which increase apparent brightness. HDR
rendering also affects how light is preserved in optical phenomena such as reflections and refractions, as well as
transparent materials such as glass. In LDR rendering, very bright light sources in a scene (such as the sun) are
capped at 1.0. When this light is reflected the result must then be less than or equal to 1.0. However, in HDR
rendering, very bright light sources can exceed the 1.0 brightness to simulate their actual values. This allows
reflections off surfaces to maintain realistic brightness for bright light sources.
59
Output to displays
Although many manufacturers claim very high numbers, plasma displays, LCD displays, and CRT displays can only
deliver a fraction of the contrast ratio found in the real world, and these are usually measured under ideal conditions.
The simultaneous contrast of real content under normal viewing conditions is significantly lower.
Some increase in dynamic range in LCD monitors can be achieved by automatically reducing the backlight for dark
scenes (LG calls it DigitalFineContrast [1], Samsung are quoting "dynamic contrast ratio"), or having an array of
brighter and darker LED backlights (BrightSide Technologies now part of Dolby [2], and Samsung in development
[3]
).
Light bloom
Light blooming is the result of scattering in the human lens, which our brain interprets as a bright spot in a scene. For
example, a bright light in the background will appear to bleed over onto objects in the foreground. This can be used
to create an illusion to make the bright spot appear to be brighter than it really is.
Flare
Flare is the diffraction of light in the human lens, resulting in "rays" of light emanating from small light sources, and
can also result in some chromatic effects. It is most visible on point light sources because of their small visual angle.
Otherwise, HDR rendering systems have to map the full dynamic range to what the eye would see in the rendered
situation onto the capabilities of the device. This tone mapping is done relative to what the virtual scene camera sees,
combined with several full screen effects, e.g. to simulate dust in the air which is lit by direct sunlight in a dark
cavern, or the scattering in the eye.
Tone mapping and blooming shaders can be used together to help simulate these effects.
Tone mapping
Tone mapping, in the context of graphics rendering, is a technique used to map colors from high dynamic range (in
which lighting calculations are performed) to a lower dynamic range that matches the capabilities of the desired
display device. Typically, the mapping is non-linear it preserves enough range for dark colors and gradually limits
the dynamic range for bright colors. This technique often produces visually appealing images with good overall
detail and contrast. Various tone mapping operators exist, ranging from simple real-time methods used in computer
games to more sophisticated techniques that attempt to imitate the perceptual response of the human visual system.
60
61
R300 series: 9500, 9500 Pro, 9550, 9550 SE, 9600, 9600 SE, 9600 TX, 9600 AIW, 9600 Pro, 9600 XT, 9650, 9700, 9700
AIW, 9700 Pro, 9800, 9800 SE, 9800 AIW, 9800 Pro, 9800XT, X300, X300 SE, X550, X600 AIW, X600 Pro, X600 XT
R420 series: X700, X700 Pro, X700 XT, X800, X800SE, X800 GT, X800 GTO, X800 Pro, X800 AIW, X800 XL, X800 XT,
X800 XTPE, X850 Pro, X850 XT, X850 XTPE
Radeon RS690: X1200 mobility
From
NVIDIA
GeForce FX (includes PCX versions): 5100, 5200, 5200 SE/XT, 5200 Ultra, 5300, 5500, 5600, 5600 SE/XT, 5600 Ultra,
5700, 5700 VE, 5700 LE, 5700 Ultra, 5750, 5800, 5800 Ultra, 5900 5900 ZT, 5900 SE/XT, 5900 Ultra, 5950, 5950 Ultra
From S3
Graphics
Delta Chrome: S4, S4 Pro, S8, S8 Nitro, F1, F1 Pole Gamma Chrome: S18 Pro, S18 Ultra, S25, S27
From SiS
Xabre: Xabre II
From XGI
Volari: V3 XT, V5, V5, V8, V8 Ultra, Duo V5 Ultra, Duo V8 Ultra, 8300, 8600, 8600 XT
Shader Model 3.0 Compliant
From ATI
R520 series: X1300 HyperMemory Edition, X1300, X1300 Pro, X1600 Pro, X1600 XT, X1650 Pro, X1650 XT, X1800
GTO, X1800 XL AIW, X1800 XL, X1800 XT, X1900 AIW, X1900 GT, X1900 XT, X1900 XTX, X1950 Pro, X1950 XT,
X1950 XTX, Xenos (Xbox 360)
From
NVIDIA
GeForce 6: 6100, 6150, 6200 LE, 6200, 6200 TC, 6250, 6500, 6600, 6600 LE, 6600 DDR2, 6600 GT, 6610 XL, 6700 XL,
6800, 6800 LE, 6800 XT, 6800 GS, 6800 GTO, 6800 GT, 6800 Ultra, 6800 Ultra Extreme GeForce 7: 7300 LE, 7300 GS,
7300 GT, 7600 GS, 7600 GT, 7800 GS, 7800 GT, 7800 GTX, 7800 GTX 512MB, 7900 GS, 7900 GT, 7950 GT, 7900 GTO,
7900 GTX, 7900 GX2, 7950 GX2, 7950 GT, RSX (PlayStation 3)
Shader Model 4.0/4.1* Compliant
From ATI
R600 series: HD 2900 XT, HD 2900 Pro, HD 2900 GT, HD 2600 XT, HD 2600 Pro, HD 2400 XT, HD 2400 Pro, HD 2350,
HD 3870*, HD 3850*, HD 3650*, HD 3470*, HD 3450*, HD 3870 X2* R700 series: HD 4870 X2, HD 4890, HD 4870*,
HD4850*, HD 4670*, HD 4650*
From
NVIDIA
GeForce 8: 8800 Ultra, 8800 GTX, 8800 GT, 8800 GTS, 8800GTS 512MB, 8800GS, 8600 GTS, 8600 GT, 8600M GS,
8600M GT, 8500 GT, 8400 GS, 8300 GS, 8300 GT, 8300 GeForce 9 Series: 9800 GX2, 9800 GTX (+), 9800 GT, 9600 GT,
9600 GSO, 9500 GT, 9400 GT, 9300 GT, 9300 GS, 9200 GT
GeForce 200 Series: GTX 295, GTX 285, GTX 280, GTX 275, GTX 260, GTS 250, GTS240, GT240*, GT220*
Shader Model 5.0 Compliant
From ATI
R800 Series: HD 5750, HD 5770, HD 5850, HD 5870, HD 5870 X2, HD 5970* R900 Series: HD 6990, HD 6970, HD 6950,
HD 6870, HD 6850, HD 6770, HD 6750, HD 6670, HD 6570, HD 6450
From
NVIDIA
GeForce 400 Series: GTX 480, GTX 475, GTX 470, GTX 465, GTX 460 GeForce 500 Series: GTX 590, GTX 580, GTX
570, GTX 560 Ti, GTX 550 Ti
62
FireGL: Z1-128, T2-128, X1-128, X2-256, X2-256t, V3100, V3200, X3-256, V5000, V5100, V7100
From NVIDIA Quadro FX: 330, 500, 600, 700, 1000, 1100, 1300, 2000, 3000
Shader Model 3.0 Compliant
From ATI
From NVIDIA Quadro FX: 350, 540, 550, 560, 1400, 1500, 3400, 3450, 3500, 4000, 4400, 4500, 4500SDI, 4500 X2, 5500, 5500SDI
From 3Dlabs
Unreal Engine 3
Chrome Engine 3
Source
CryEngine, CryEngine 2, CryEngine 3
Dunia Engine
Gamebryo
Unity
id Tech 5
Lithtech
Unigine
Frostbite 2
Real Virtuality 2, Real Virtuality 3, Real Virtuality 4
HPL 3
References
[1] http:/ / www. lge. com/ about/ press_release/ detail/ PRO%7CNEWS%5EPRE%7CMENU_20075_PRE%7CMENU. jhtml
[2] http:/ / www. dolby. com/ promo/ hdr/ technology. html
[3] http:/ / www. engadget. com/ 2007/ 02/ 01/ samsungs-15-4-30-and-40-inch-led-backlit-lcds/
External links
NVIDIA's HDRR technical summary (http://download.nvidia.com/developer/presentations/2004/
6800_Leagues/6800_Leagues_HDR.pdf) (PDF)
A HDRR Implementation with OpenGL 2.0 (http://www.gsulinux.org/~plq)
OpenGL HDRR Implementation (http://www.smetz.fr/?page_id=83)
High Dynamic Range Rendering in OpenGL (http://transporter-game.googlecode.com/files/
HDRRenderingInOpenGL.pdf) (PDF)
High Dynamic Range Imaging environments for Image Based Lighting (http://www.hdrsource.com/)
Microsoft's technical brief on SM3.0 in comparison with SM2.0 (http://www.microsoft.com/whdc/winhec/
partners/shadermodel30_NVIDIA.mspx)
Tom's Hardware: New Graphics Card Features of 2006 (http://www.tomshardware.com/2006/01/13/
new_3d_graphics_card_features_in_2006/)
List of GPU's compiled by Chris Hare (http://users.erols.com/chare/video.htm)
techPowerUp! GPU Database (http://www.techpowerup.com/gpudb/)
Understanding Contrast Ratios in Video Display Devices (http://www.hometheaterhifi.com/volume_13_2/
feature-article-contrast-ratio-5-2006-part-1.html)
63
Image-based lighting
Image-based lighting (IBL) is a 3D rendering technique which involves capturing an omni-directional
representation of real-world light information as an image, typically using a specialised camera. This image is then
projected onto a dome or sphere analogously to environment mapping, and this is used to simulate the lighting for
the objects in the scene. This allows highly detailed real-world lighting to be used to light a scene, instead of trying
to accurately model illumination using an existing rendering technique.
Image-based lighting often uses high dynamic range imaging for greater realism, though this is not universal. Almost
all modern rendering software offers some type of image-based lighting, though the exact terminology used in the
system may vary.
Image-based lighting is also starting to show up in video games as video game consoles and personal computers start
to have the computational resources to render scenes in real time using this technique. This technique is used in
Forza Motorsport 4 and Crash Time 5: Undercover, by the Chameleon engine used in Need for Speed: Hot Pursuit,
and in the CryEngine 3 middleware.
References
Tutorial [1]
External links
Real-Time HDR Image-Based Lighting Demo [2]
References
[1] http:/ / ict. usc. edu/ pubs/ Image-Based%20Lighting. pdf
[2] http:/ / www. daionet. gr. jp/ ~masa/ rthdribl/
64
Image plane
Image plane
In 3D computer graphics, the image plane is that plane in the world which is identified with the plane of the
monitor. If one makes the analogy of taking a photograph to rendering a 3D image, the surface of the film is the
image plane. In this case, the viewing transformation is a projection that maps the world onto the image plane. A
rectangular region of this plane, called the viewing window or viewport, maps to the monitor. This establishes the
mapping between pixels on the monitor and points (or rather, rays) in the 3D world.
In optics, the image plane is the plane that contains the object's projected image, and lies beyond the back focal
plane.
Irregular Z-buffer
The irregular Z-buffer is an algorithm designed to solve the visibility problem in real-time 3-d computer graphics.
It is related to the classical Z-buffer in that it maintains a depth value for each image sample and uses these to
determine which geometric elements of a scene are visible. The key difference, however, between the classical
Z-buffer and the irregular Z-buffer is that the latter allows arbitrary placement of image samples in the image plane,
whereas the former requires samples to be arranged in a regular grid.
These depth samples are explicitly stored in a two-dimensional spatial data structure. During rasterization, triangles
are projected onto the image plane as usual, and the data structure is queried to determine which samples overlap
each projected triangle. Finally, for each overlapping sample, the standard Z-compare and (conditional) frame buffer
update are performed.
Implementation
The classical rasterization algorithm projects each polygon onto the image plane, and determines which sample
points from a regularly spaced set lie inside the projected polygon. Since the locations of these samples (i.e. pixels)
are implicit, this determination can be made by testing the edges against the implicit grid of sample points. If,
however the locations of the sample points are irregularly spaced and cannot be computed from a formula, then this
approach does not work. The irregular Z-buffer solves this problem by storing sample locations explicitly in a
two-dimensional spatial data structure, and later querying this structure to determine which samples lie within a
projected triangle. This latter step is referred to as "irregular rasterization".
Although the particular data structure used may vary from implementation to implementation, the two studied
approaches are the kd-tree, and a grid of linked lists. A balanced kd-tree implementation has the advantage that it
guarantees O(log(N)) access. Its chief disadvantage is that parallel construction of the kd-tree may be difficult, and
traversal requires expensive branch instructions. The grid of lists has the advantage that it can be implemented more
effectively on GPU hardware, which is designed primarily for the classical Z-buffer.
With the appearance of CUDA, the programmability of current graphics hardware has been drastically improved.
The Master Thesis, "Fast Triangle Rasterization using irregular Z-buffer on CUDA" (see External Links), provide a
complete description to an irregular Z-Buffer based shadow mapping software implementation on CUDA. The
rendering system is running completely on GPUs. It is capable of generating aliasing-free shadows at a throughput of
dozens of million triangles per second.
65
Irregular Z-buffer
Applications
The irregular Z-buffer can be used for any application which requires visibility calculations at arbitrary locations in
the image plane. It has been shown to be particularly adept at shadow mapping, an image space algorithm for
rendering hard shadows. In addition to shadow rendering, potential applications include adaptive anti-aliasing,
jittered sampling, and environment mapping.
External links
The Irregular Z-Buffer: Hardware Acceleration for Irregular Data Structures [1]
The Irregular Z-Buffer And Its Application to Shadow Mapping [2]
Alias-Free Shadow Maps [3]
Fast Triangle Rasterization using irregular Z-buffer on CUDA [4]
References
[1]
[2]
[3]
[4]
Isosurface
An isosurface is a three-dimensional analog of an isoline. It is a
surface that represents points of a constant value (e.g. pressure,
temperature, velocity, density) within a volume of space; in other
words, it is a level set of a continuous function whose domain is
3D-space.
Isosurfaces are normally displayed using computer graphics, and are
used as data visualization methods in computational fluid dynamics
(CFD), allowing engineers to study features of a fluid flow (gas or
liquid) around objects, such as aircraft wings. An isosurface may
represent an individual shock wave in supersonic flight, or several
Zirconocene with an isosurface showing areas of
isosurfaces may be generated showing a sequence of pressure values in
the molecule susceptible to electrophilic attack.
the air flowing around a wing. Isosurfaces tend to be a popular form of
visualization for volume datasets since they can be rendered by a simple polygonal model, which can be drawn on
the screen very quickly.
In medical imaging, isosurfaces may be used to represent regions of a particular density in a three-dimensional CT
scan, allowing the visualization of internal organs, bones, or other structures.
Numerous other disciplines that are interested in three-dimensional data often use isosurfaces to obtain information
about pharmacology, chemistry, geophysics and meteorology.
66
Isosurface
67
References
Charles D. Hansen; Chris R. Johnson (2004). Visualization
Handbook [1]. Academic Press. pp.711. ISBN978-0-12-387582-2.
External links
Isosurface Polygonization [2]
References
[1] http:/ / books. google. com/ books?id=ZFrlULckWdAC& pg=PA7
[2] http:/ / www2. imm. dtu. dk/ ~jab/ gallery/ polygonization. html
68
69
photons/(scm2sr),
which is the same as the normal observer.
and so
where
is the determinant of the Jacobian matrix for the unit sphere, and realizing that
[3]
per steradian.
is luminous flux
70
Uses
Lambert's cosine law in its reversed form (Lambertian reflection) implies that the apparent brightness of a
Lambertian surface is proportional to the cosine of the angle between the surface normal and the direction of the
incident light.
This phenomenon is, among others, used when creating mouldings, which are a means of applying light- and
dark-shaded stripes to a structure or object without having to change the material or apply pigment. The contrast of
dark and light areas gives definition to the object. Mouldings are strips of material with various cross-sections used
to cover transitions between surfaces or for decoration.
References
[1] RCA Electro-Optics Handbook, p.18 ff
[2] Modern Optical Engineering, Warren J. Smith, McGraw-Hill, p.228, 256
[3] Incropera and DeWitt, Fundamentals of Heat and Mass Transfer, 5th ed., p.710.
Lambertian reflectance
Lambertian reflectance is the property that defines an ideal diffusely reflecting surface. The apparent brightness of
such a surface to an observer is the same regardless of the observer's angle of view. More technically, the surface's
luminance is isotropic, and the luminous intensity obeys Lambert's cosine law. Lambertian reflectance is named after
Johann Heinrich Lambert, who introduced the concept of perfect diffusion in his 1760 book Photometria.
Examples
Unfinished wood exhibits roughly Lambertian reflectance, but wood finished with a glossy coat of polyurethane
does not, since the glossy coating creates specular highlights. Not all rough surfaces are Lambertian reflectors, but
this is often a good approximation when the characteristics of the surface are unknown.
Spectralon is a material which is designed to exhibit an almost perfect Lambertian reflectance.
is the intensity
Lambertian reflectance
71
Lambertian reflection from polished surfaces are typically accompanied by specular reflection (gloss), where the
surface luminance is highest when the observer is situated at the perfect reflection direction (i.e. where the direction
of the reflected light is a reflection of the direction of the incident light in the surface), and falls off sharply. This is
simulated in computer graphics with various specular reflection models such as Phong, Cook-Torrance. etc.
Other waves
While Lambertian reflectance usually refers to the reflection of light by an object, it can be used to refer to the
reflection of any wave. For example, in ultrasound imaging, "rough" tissues are said to exhibit Lambertian
reflectance.
References
Level of detail
In computer graphics, accounting for level of detail involves decreasing the complexity of a 3D object representation
as it moves away from the viewer or according other metrics such as object importance, viewpoint-relative speed or
position. Level of detail techniques increases the efficiency of rendering by decreasing the workload on graphics
pipeline stages, usually vertex transformations. The reduced visual quality of the model is often unnoticed because of
the small effect on object appearance when distant or moving fast.
Although most of the time LOD is applied to geometry detail only, the basic concept can be generalized. Recently,
LOD techniques also included shader management to keep control of pixel complexity. A form of level of detail
management has been applied to textures for years, under the name of mipmapping, also providing higher rendering
quality.
It is commonplace to say that "an object has been LOD'd" when the object is simplified by the underlying LOD-ing
algorithm.
Historical reference
The origin[1] of all the LoD algorithms for 3D computer graphics can be traced back to an article by James H. Clark
in the October 1976 issue of Communications of the ACM. At the time, computers were monolithic and rare, and
graphics was being driven by researchers. The hardware itself was completely different, both architecturally and
performance-wise. As such, many differences could be observed with regard to today's algorithms but also many
common points.
The original algorithm presented a much more generic approach to what will be discussed here. After introducing
some available algorithms for geometry management, it is stated that most fruitful gains came from "...structuring
the environments being rendered", allowing to exploit faster transformations and clipping operations.
The same environment structuring is now proposed as a way to control varying detail thus avoiding unnecessary
computations, yet delivering adequate visual quality:
For example, a dodecahedron looks like a sphere from a sufficiently large distance and thus can be used to model it so long as it is viewed
from that or a greater distance. However, if it must ever be viewed more closely, it will look like a dodecahedron. One solution to this is
simply to define it with the most detail that will ever be necessary. However, then it might have far more detail than is needed to represent it at
large distances, and in a complex environment with many such objects, there would be too many polygons (or other geometric primitives) for
the visible surface algorithms to efficiently handle.
Level of detail
72
The proposed algorithm envisions a tree data structure which encodes in its arcs both transformations and transitions
to more detailed objects. In this way, each node encodes an object and according to a fast heuristic, the tree is
descended to the leafs which provide each object with more detail. When a leaf is reached, other methods could be
used when higher detail is needed, such as Catmull's recursive subdivision[2].
The significant point, however, is that in a complex environment, the amount of information presented about the various objects in the
environment varies according to the fraction of the field of view occupied by those objects.
The paper then introduces clipping (not to be confused with culling (computer graphics), although often similar),
various considerations on the graphical working set and its impact on performance, interactions between the
proposed algorithm and others to improve rendering speed. Interested readers are encouraged in checking the
references for further details on the topic.
Level of detail
73
are both graphically and topologically different from "object" meshes. Instead of computing an error and simplify the
mesh according to this, geomipmapping takes a fixed reduction method, evaluates the error introduced and computes
a distance at which the error is acceptable. Although straightforward, the algorithm provides decent performance.
Vertices ~5500
Notes
~2880
~1580
~670
Maximum
detail,
for closeups.
140
Minimum
detail,
very far objects.
To simulate a realistic transform bound scenario, we'll use an ad-hoc written application. We'll make sure we're not
CPU bound by using simple algorithms and minimum fragment operations. Each frame, the program will compute
each sphere's distance and choose a model from a pool according to this information. To easily show the concept, the
distance at which each model is used is hard coded in the source. A more involved method would compute adequate
models according to the usage distance chosen.
We use OpenGL for rendering because its high efficiency in managing small batches, storing each model in a display
list thus avoiding communication overheads. Additional vertex load is given by applying two directional light
sources ideally located infinitely far away.
The following table compares the performance of LoD aware rendering and a full detail (brute force) method.
DLOD
Comparison
Rendered
images
1.29 ms
21 reduction
Scene
vertices
(thousands)
109.44
21 reduction
2328.48
Level of detail
Hierarchical LOD
Because hardware is geared towards large amounts of detail, rendering low polygon objects may score sub-optimal
performances. HLOD avoids the problem by grouping different objects together[4]. This allows for higher efficiency
as well as taking advantage of proximity considerations.
References
1. ^ Communications of the ACM, October 1976 Volume 19 Number 10. Pages 547-554. Hierarchical Geometric
Models for Visible Surface Algorithms by James H. Clark, University of California at Santa Cruz. Digitalized scan
is freely available at http://accad.osu.edu/~waynec/history/PDFs/clark-vis-surface.pdf.
2. ^ Catmull E., A Subdivision Algorithm for Computer Display of Curved Surfaces. Tech. Rep. UTEC-CSc-74-133,
University of Utah, Salt Lake City, Utah, Dec. 1974.
3. ^ de Boer, W.H., Fast Terrain Rendering using Geometrical Mipmapping, in flipCode featured articles, October
2000. Available at http://www.flipcode.com/tutorials/tut_geomipmaps.shtml.
4. ^ Carl Erikson's paper at http://www.cs.unc.edu/Research/ProjectSummaries/hlods.pdf provides a quick, yet
effective overlook at HLOD mechanisms. A more involved description follows in his thesis, at https://wwwx.cs.
unc.edu/~geom/papers/documents/dissertations/erikson00.pdf.
References
[1]
[2]
[3]
[4]
Mipmap
In 3D computer graphics, mipmaps (also MIP maps) are pre-calculated, optimized collections of images that
accompany a main texture, intended to increase rendering speed and reduce aliasing artifacts. They are widely used
in 3D computer games, flight simulators and other 3D imaging systems for texture filtering. Their use is known as
mipmapping. The letters "MIP" in the name are an acronym of the Latin phrase multum in parvo, meaning "much in
little".[1] Since mipmaps cannot be calculated in real time, additional storage space is required to take advantage of
them. They also form the basis of wavelet compression.
Basic Use
Mipmaps are used for:
-Speeding up rendering times. (Smaller textures equate to less memory usage.)
-Improving the quality. Rendering large textures where only small subsets of points are used can easily produce
moir patterns.
-Reducing stress on GPU.
74
Mipmap
75
Origin
Mipmapping was invented by Lance Williams in 1983 and is described in his paper Pyramidal parametrics. From
the abstract: "This paper advances a 'pyramidal parametric' prefiltering and sampling geometry which minimizes
aliasing effects and assures continuity within and between target images." The "pyramid" can be imagined as the set
of mipmaps stacked on top of each other.
How it works
Each bitmap image of the mipmap set is a downsized duplicate of the
main texture, but at a certain reduced level of detail. Although the main
texture would still be used when the view is sufficient to render it in
full detail, the renderer will switch to a suitable mipmap image (or in
fact, interpolate between the two nearest, if trilinear filtering is
activated) when the texture is viewed from a distance or at a small size.
Rendering speed increases since the number of texture pixels ("texels")
being processed can be much lower with the simple textures. Artifacts
are reduced since the mipmap images are effectively already
anti-aliased, taking some of the burden off the real-time renderer.
Scaling down and up is made more efficient with mipmaps as well.
If the texture has a basic size of 256 by 256 pixels, then the associated mipmap set may contain a series of 8 images,
each one-fourth the total area of the previous one: 128128 pixels, 6464, 3232, 1616, 88, 44, 22, 11 (a
single pixel). If, for example, a scene is rendering this texture in a space of 4040 pixels, then either a scaled up
version of the 3232 (without trilinear interpolation) or an interpolation of the 6464 and the 3232 mipmaps (with
trilinear interpolation) would be used. The simplest way to generate these textures is by successive averaging;
however, more sophisticated algorithms (perhaps based on signal processing and Fourier transforms) can also be
used.
Anisotropic filtering
When a texture is seen at a steep angle, the filtering should not be uniform in each direction (it should be anisotropic
rather than isotropic), and a compromise resolution is used. If a higher resolution
Mipmap
76
is used, the cache coherence goes down, and the aliasing is increased in
one direction, but the image tends to be clearer. If a lower resolution is
used, the cache coherence is improved, but the image is overly blurry.
Nonuniform mipmaps (also known as rip-maps) can solve this
problem, although they have no direct support on modern graphics
hardware. With an 88 base texture map, the rip-map resolutions are
88, 84, 82, 81; 48, 44, 42, 41; 28, 24, 22, 21; 18,
14, 12 and 11. In general, for a
Summed-area tables
Summed-area tables can conserve memory and provide more
resolutions. However, they again hurt cache coherence, and need wider
types to store the partial sums than the base texture's word size. Thus,
modern graphics hardware does not support them either.
References
[1] http:/ / staff. cs. psu. ac. th/ iew/ cs344-481/ p1-williams. pdf
Newell's algorithm
Newell's Algorithm is a 3D computer graphics procedure for elimination of polygon cycles in the depth sorting
required in hidden surface removal. It was proposed in 1972 by brothers Martin Newell and Dick Newell, and Tom
Sancha, while all three were working at CADCentre.
In the depth sorting phase of hidden surface removal, if two polygons have no overlapping extents or extreme
minimum and maximum values in the x, y, and z directions, then they can be easily sorted. If two polygons, Q and P,
do have overlapping extents in the Z direction, then it is possible that cutting is necessary.
In that case Newell's algorithm tests the following:
1. Test for Z overlap; implied in the selection of the face Q from the sort list
2. The extreme coordinate values in X of the two faces do not overlap (minimax test in
X)
3. The extreme coordinate values in Y of the two faces do not overlap (minimax test in
Y)
4. All vertices of P lie deeper than the plane of Q
5. All vertices of Q lie closer to the viewpoint than the plane of P
6. The rasterisation of P and Q do not overlap
Note that the tests are given in order of increasing computational difficulty.
Note also that the polygons must be planar.
If the tests are all false, then the polygons must be split. Splitting is accomplished by selecting one polygon and
cutting it along the line of intersection with the other polygon. The above tests are again performed, and the
algorithm continues until all polygons pass the above tests.
Newell's algorithm
77
References
Sutherland, Ivan E.; Sproull, Robert F.; Schumacker, Robert A. (1974), "A characterization of ten hidden-surface
algorithms", Computing Surveys 6 (1): 155, doi:10.1145/356625.356626 [1].
Newell, M. E.; Newell, R. G.; Sancha, T. L. (1972), "A new approach to the shaded picture problem", Proc. ACM
National Conference, pp.443450.
References
[1] http:/ / dx. doi. org/ 10. 1145%2F356625. 356626
History
Development of NURBS began in the
1950s by engineers who were in need
of
a
mathematically
precise
representation of freeform surfaces like
those used for ship hulls, aerospace
exterior surfaces, and car bodies,
which could be exactly reproduced
whenever technically needed. Prior
representations of this kind of surface
only existed as a single physical model
created by a designer.
Three-dimensional NURBS surfaces can have complex, organic shapes. Control points
influence the directions the surface takes. The outermost square below delineates the X/Y
extents of the surface.
A NURBS curve.
Use
NURBS are commonly used in computer-aided design
(CAD), manufacturing (CAM), and engineering (CAE)
and are part of numerous industry wide standards, such
as IGES, STEP, ACIS, and PHIGS. NURBS tools are
also found in various 3D modelling and animation
software packages.
They can be efficiently handled by the computer
programs and yet allow for easy human interaction.
NURBS surfaces are functions of two parameters
mapping to a surface in three-dimensional space. The
Motoryacht design.
shape of the surface is determined by control points.
NURBS surfaces can represent simple geometrical
shapes in a compact form. T-splines and subdivision surfaces are more suitable for complex organic shapes because
they reduce the number of control points twofold in comparison with the NURBS surfaces.
In general, editing NURBS curves and surfaces is highly intuitive and predictable. Control points are always either
connected directly to the curve/surface, or act as if they were connected by a rubber band. Depending on the type of
user interface, editing can be realized via an elements control points, which are most obvious and common for
Bzier curves, or via higher level tools such as spline modeling or hierarchical editing.
A surface under construction, e.g. the hull of a motor yacht, is usually composed of several NURBS surfaces known
as patches. These patches should be fitted together in such a way that the boundaries are invisible. This is
mathematically expressed by the concept of geometric continuity.
Higher-level tools exist which benefit from the ability of NURBS to create and establish geometric continuity of
different levels:
Positional continuity (G0)
holds whenever the end positions of two curves or surfaces are coincidental. The curves or surfaces may still
meet at an angle, giving rise to a sharp corner or edge and causing broken highlights.
Tangential continuity (G1)
requires the end vectors of the curves or surfaces to be parallel and pointing the same way, ruling out sharp
edges. Because highlights falling on a tangentially continuous edge are always continuous and thus look
natural, this level of continuity can often be sufficient.
Curvature continuity (G2)
further requires the end vectors to be of the same length and rate of length change. Highlights falling on a
curvature-continuous edge do not display any change, causing the two surfaces to appear as one. This can be
visually recognized as perfectly smooth. This level of continuity is very useful in the creation of models that
require many bi-cubic patches composing one continuous surface.
Geometric continuity mainly refers to the shape of the resulting surface; since NURBS surfaces are functions, it is
also possible to discuss the derivatives of the surface with respect to the parameters. This is known as parametric
78
79
continuity. Parametric continuity of a given degree implies geometric continuity of that degree.
First- and second-level parametric continuity (C0 and C1) are for practical purposes identical to positional and
tangential (G0 and G1) continuity. Third-level parametric continuity (C2), however, differs from curvature
continuity in that its parameterization is also continuous. In practice, C2 continuity is easier to achieve if uniform
B-splines are used.
The definition of the continuity 'Cn' requires that the nth derivative of the curve/surface (
) are equal
[1]
at a joint. Note that the (partial) derivatives of curves and surfaces are vectors that have a direction and a
magnitude. Both should be equal.
Highlights and reflections can reveal the perfect smoothing, which is otherwise practically impossible to achieve
without NURBS surfaces that have at least G2 continuity. This same principle is used as one of the surface
evaluation methods whereby a ray-traced or reflection-mapped image of a surface with white stripes reflecting on it
will show even the smallest deviations on a surface or set of surfaces. This method is derived from car prototyping
wherein surface quality is inspected by checking the quality of reflections of a neon-light ceiling on the car surface.
This method is also known as "Zebra analysis".
Technical specifications
A NURBS curve is defined by its order, a set of weighted control points, and a knot vector . NURBS curves and
surfaces are generalizations of both B-splines and Bzier curves and surfaces, the primary difference being the
weighting of the control points which makes NURBS curves rational (non-rational B-splines are a special case of
rational B-splines). Whereas Bzier curves evolve into only one parametric direction, usually called s or u, NURBS
surfaces evolve into two parametric directions, called s and t or u and v.
By evaluating a Bzier or a NURBS
curve at various values of the
parameter, the curve can be
represented in Cartesian two- or
three-dimensional space. Likewise, by
evaluating a NURBS surface at various
values of the two parameters, the
surface can be represented in Cartesian
space.
NURBS curves and surfaces are useful
for a number of reasons:
They are invariant under affine
transformations:[2] operations like
rotations and translations can be
applied to NURBS curves and surfaces by applying them to their control points.
They offer one common mathematical form for both standard analytical shapes (e.g., conics) and free-form
shapes.
They provide the flexibility to design a large variety of shapes.
They reduce the memory consumption when storing shapes (compared to simpler methods).
They can be evaluated reasonably quick by numerically stable and accurate algorithms.
In the next sections, NURBS is discussed in one dimension (curves). It should be noted that all of it can be
generalized to two or even more dimensions.
Control points
The control points determine the shape of the curve.[3] Typically, each point of the curve is computed by taking a
weighted sum of a number of control points. The weight of each point varies according to the governing parameter.
For a curve of degree d, the weight of any control point is only nonzero in d+1 intervals of the parameter space.
Within those intervals, the weight changes according to a polynomial function (basis functions) of degree d. At the
boundaries of the intervals, the basis functions go smoothly to zero, the smoothness being determined by the degree
of the polynomial.
As an example, the basis function of degree one is a triangle function. It rises from zero to one, then falls to zero
again. While it rises, the basis function of the previous control point falls. In that way, the curve interpolates between
the two points, and the resulting curve is a polygon, which is continuous, but not differentiable at the interval
boundaries, or knots. Higher degree polynomials have correspondingly more continuous derivatives. Note that
within the interval the polynomial nature of the basis functions and the linearity of the construction make the curve
perfectly smooth, so it is only at the knots that discontinuity can arise.
The fact that a single control point only influences those intervals where it is active is a highly desirable property,
known as local support. In modeling, it allows the changing of one part of a surface while keeping other parts equal.
Adding more control points allows better approximation to a given curve, although only a certain class of curves can
be represented exactly with a finite number of control points. NURBS curves also feature a scalar weight for each
control point. This allows for more control over the shape of the curve without unduly raising the number of control
points. In particular, it adds conic sections like circles and ellipses to the set of curves that can be represented
exactly. The term rational in NURBS refers to these weights.
The control points can have any dimensionality. One-dimensional points just define a scalar function of the
parameter. These are typically used in image processing programs to tune the brightness and color curves.
Three-dimensional control points are used abundantly in 3D modeling, where they are used in the everyday meaning
of the word 'point', a location in 3D space. Multi-dimensional points might be used to control sets of time-driven
values, e.g. the different positional and rotational settings of a robot arm. NURBS surfaces are just an application of
this. Each control 'point' is actually a full vector of control points, defining a curve. These curves share their degree
and the number of control points, and span one dimension of the parameter space. By interpolating these control
vectors over the other dimension of the parameter space, a continuous set of curves is obtained, defining the surface.
Knot vector
The knot vector is a sequence of parameter values that determines where and how the control points affect the
NURBS curve. The number of knots is always equal to the number of control points plus curve degree plus one (i.e.
number of control points plus curve order). The knot vector divides the parametric space in the intervals mentioned
before, usually referred to as knot spans. Each time the parameter value enters a new knot span, a new control point
becomes active, while an old control point is discarded. It follows that the values in the knot vector should be in
nondecreasing order, so (0, 0, 1, 2, 3, 3) is valid while (0, 0, 2, 1, 3, 3) is not.
Consecutive knots can have the same value. This then defines a knot span of zero length, which implies that two
control points are activated at the same time (and of course two control points become deactivated). This has impact
on continuity of the resulting curve or its higher derivatives; for instance, it allows the creation of corners in an
otherwise smooth NURBS curve. A number of coinciding knots is sometimes referred to as a knot with a certain
multiplicity. Knots with multiplicity two or three are known as double or triple knots. The multiplicity of a knot is
limited to the degree of the curve; since a higher multiplicity would split the curve into disjoint parts and it would
leave control points unused. For first-degree NURBS, each knot is paired with a control point.
The knot vector usually starts with a knot that has multiplicity equal to the order. This makes sense, since this
activates the control points that have influence on the first knot span. Similarly, the knot vector usually ends with a
80
81
knot of that multiplicity. Curves with such knot vectors start and end in a control point.
The individual knot values are not meaningful by themselves; only the ratios of the difference between the knot
values matter. Hence, the knot vectors (0, 0, 1, 2, 3, 3) and (0, 0, 2, 4, 6, 6) produce the same curve. The positions of
the knot values influences the mapping of parameter space to curve space. Rendering a NURBS curve is usually
done by stepping with a fixed stride through the parameter range. By changing the knot span lengths, more sample
points can be used in regions where the curvature is high. Another use is in situations where the parameter value has
some physical significance, for instance if the parameter is time and the curve describes the motion of a robot arm.
The knot span lengths then translate into velocity and acceleration, which are essential to get right to prevent damage
to the robot arm or its environment. This flexibility in the mapping is what the phrase non uniform in NURBS refers
to.
Necessary only for internal calculations, knots are usually not helpful to the users of modeling software. Therefore,
many modeling applications do not make the knots editable or even visible. It's usually possible to establish
reasonable knot vectors by looking at the variation in the control points. More recent versions of NURBS software
(e.g., Autodesk Maya and Rhinoceros 3D) allow for interactive editing of knot positions, but this is significantly less
intuitive than the editing of control points.
Order
The order of a NURBS curve defines the number of nearby control points that influence any given point on the
curve. The curve is represented mathematically by a polynomial of degree one less than the order of the curve.
Hence, second-order curves (which are represented by linear polynomials) are called linear curves, third-order curves
are called quadratic curves, and fourth-order curves are called cubic curves. The number of control points must be
greater than or equal to the order of the curve.
In practice, cubic curves are the ones most commonly used. Fifth- and sixth-order curves are sometimes useful,
especially for obtaining continuous higher order derivatives, but curves of higher orders are practically never used
because they lead to internal numerical problems and tend to require disproportionately large calculation times.
The parameter
are piecewise constant functions. They are one on the corresponding knot span and
, in which
[4]
is a linear interpolation of
and
82
is
is a triangular
function, nonzero over two knot spans rising from zero to one on the
first, and falling to zero on the second knot span. Higher order basis
functions are non-zero over corresponding more knot spans and have
correspondingly higher degree. If is the parameter, and
is the
-th knot, we can write the functions
and
as
and
functions
and
The functions
and
order basis functions are non-zero. By induction on n it follows that the basis functions are non-negative for all
values of and . This makes the computation of the basis functions numerically stable.
Again by induction, it can be proved that the sum of the basis functions for a particular value of the parameter is
unity. This is known as the partition of unity property of the basis functions.
The figures show the linear and the quadratic basis functions for the
knots {..., 0, 1, 2, 3, 4, 4.1, 5.1, 6.1, 7.1, ...}
One knot span is considerably shorter than the others. On that knot
span, the peak in the quadratic basis function is more distinct, reaching
almost one. Conversely, the adjoining basis functions fall to zero more
quickly. In the geometrical interpretation, this means that the curve
approaches the corresponding control point closely. In case of a double
knot, the length of the knot span becomes zero and the peak reaches
one exactly. The basis function is no longer differentiable at that point.
The curve will have a sharp corner if the neighbour control points are not collinear.
[5]
form:
In this,
and
normalizing factor that evaluates to one if all weights are one. This can be seen from the partition of unity property
of the basis functions. It is customary to write this as
83
with
Knot insertion
As the term suggests, knot insertion inserts a knot into the knot vector. If the degree of the curve is
control points are replaced by
, then
A knot can be inserted multiple times, up to the maximum multiplicity of the knot. This is sometimes referred to as
knot refinement and can be achieved by an algorithm that is more efficient than repeated knot insertion.
Knot removal
Knot removal is the reverse of knot insertion. Its purpose is to remove knots and the associated control points in
order to get a more compact representation. Obviously, this is not always possible while retaining the exact shape of
the curve. In practice, a tolerance in the accuracy is used to determine whether a knot can be removed. The process is
used to clean up after an interactive session in which control points may have been added manually, or after
importing a curve from a different representation, where a straightforward conversion process leads to redundant
control points.
84
Degree elevation
A NURBS curve of a particular degree can always be represented by a NURBS curve of higher degree. This is
frequently used when combining separate NURBS curves, e.g. when creating a NURBS surface interpolating
between a set of NURBS curves or when unifying adjacent curves. In the process, the different curves should be
brought to the same degree, usually the maximum degree of the set of curves. The process is known as degree
elevation.
Curvature
The most important property in differential geometry is the curvature . It describes the local properties (edges,
corners, etc.) and relations between the first and second derivative, and thus, the precise curve shape. Having
determined the derivatives it is easy to compute
second derivate
Example: a circle
Non-rational splines or Bzier curves may approximate a circle, but they cannot represent it exactly. Rational splines
can represent any conic section, including the circle, exactly. This representation is not unique, but one possibility
appears below:
x
weight
1 1 0
0
1 0
1 0
The order is three, since a circle is a quadratic curve and the spline's order is one more than the degree of its
piecewise polynomial segments. The knot vector is
. The
circle is composed of four quarter circles, tied together with double knots. Although double knots in a third order
NURBS curve would normally result in loss of continuity in the first derivative, the control points are positioned in
such a way that the first derivative is continuous. In fact, the curve is infinitely differentiable everywhere, as it must
be if it exactly represents a circle.
The curve represents a circle exactly, but it is not exactly parametrized in the circle's arc length. This means, for
example, that the point at does not lie at
(except for the start, middle and end point of each
quarter circle, since the representation is symmetrical). This would be impossible, since the x coordinate of the circle
would provide an exact rational polynomial expression for
, which is impossible. The circle does make one
full revolution as its parameter
as multiples of
goes from 0 to
, but this is only because the knot vector was arbitrarily chosen
References
Les Piegl & Wayne Tiller: The NURBS Book, Springer-Verlag 19951997 (2nd ed.). The main reference for
Bzier, B-Spline and NURBS; chapters on mathematical representation and construction of curves and surfaces,
interpolation, shape modification, programming concepts.
Dr. Thomas Sederberg, BYU NURBS, http://cagd.cs.byu.edu/~557/text/ch6.pdf
Dr. Lyle Ramshaw. Blossoming: A connect-the-dots approach to splines, Research Report 19, Compaq Systems
Research Center, Palo Alto, CA, June 1987
David F. Rogers: An Introduction to NURBS with Historical Perspective, Morgan Kaufmann Publishers 2001.
Good elementary book for NURBS and related issues.
Gershenfeld, Neil A. The nature of mathematical modeling. Cambridge university press, 1999.
Notes
[1]
[2]
[3]
[4]
[5]
[6]
Foley, van Dam, Feiner & Hughes: Computer Graphics: Principles and Practice, section 11.2, Addison-Wesley 1996 (2nd ed.).
David F. Rogers: An Introduction to NURBS with Historical Perspective, section 7.1
Gershenfeld: The Nature of Mathematical Modeling, page 141, Cambridge-University-Press 1999
Les Piegl & Wayne Tiller: The NURBS Book, chapter 2, sec. 2
Les Piegl & Wayne Tiller: The NURBS Book, chapter 4, sec. 2
Les Piegl & Wayne Tiller: The NURBS Book, chapter 4, sec. 4
[7] Les Piegl & Wayne Tiller: The NURBS Book, chapter 5
[8] L. Piegl, Modifying the shape of rational B-splines. Part 1: curves, Computer-Aided Design, Volume 21, Issue 8, October 1989, Pages
509-518, ISSN 0010-4485, http:/ / dx. doi. org/ 10. 1016/ 0010-4485(89)90059-6.
External links
Clear explanation of NURBS for non-experts (http://www.rw-designer.com/NURBS)
Interactive NURBS demo (http://geometrie.foretnik.net/files/NURBS-en.swf)
About Nonuniform Rational B-Splines - NURBS (http://www.cs.wpi.edu/~matt/courses/cs563/talks/nurbs.
html)
An Interactive Introduction to Splines (http://ibiblio.org/e-notes/Splines/Intro.htm)
http://www.cs.bris.ac.uk/Teaching/Resources/COMS30115/all.pdf
http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/AV0405/DONAVANIK/bezier.html
http://mathcs.holycross.edu/~croyden/csci343/notes.html (Lecture 33: Bzier Curves, Splines)
http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/notes.html
A free software package for handling NURBS curves, surfaces and volumes (http://octave.sourceforge.net/
nurbs) in Octave and Matlab
85
Normal
86
Normal
In geometry, a normal is an object such as a line or vector that is
perpendicular to a given object. For example, in the two-dimensional
case, the normal line to a curve at a given point is the line
perpendicular to the tangent line to the curve at the point.
In the three-dimensional case a surface normal, or simply normal, to
a surface at a point P is a vector that is perpendicular to the tangent
plane to that surface at P. The word "normal" is also used as an
adjective: a line normal to a plane, the normal component of a force,
the normal vector, etc. The concept of normality generalizes to
orthogonality.
The concept has been generalized to differentiable manifolds of
arbitrary dimension embedded in a Euclidean space. The normal
vector space or normal space of a manifold at a point P is the set of
the vectors which are orthogonal to the tangent space at P. In the case
of differential curves, the curvature vector is a normal vector of special
interest.
, the
is a normal.
Normal
87
If a (possibly non-flat) surface S is parameterized by a system of curvilinear coordinates x(s, t), with s and t real
variables, then a normal is given by the cross product of the partial derivatives
satisfying
.
For a surface S given explicitly as a function
(e.g.,
), its normal can be found in at least two equivalent ways. The first
one is obtaining its implicit form
gradient
.
(Notice that the implicit form could be defined alternatively as
;
these two forms correspond to the interpretation of the surface being oriented upwards or downwards, respectively,
as a consequence of the difference in the sign of the partial derivative
.) The second way of obtaining the
normal follows directly from the gradient of the explicit form,
;
by inspection,
, where
Note that this is equal to
and
vectors.
If a surface does not have a tangent plane at a point, it does not have a normal at that point either. For example, a
cone does not have a normal at its tip nor does it have a normal along the edge of its base. However, the normal to
the cone is defined almost everywhere. In general, it is possible to define a normal almost everywhere for a surface
that is Lipschitz continuous.
Normal
88
Transforming normals
When applying a transform to a surface it is sometimes convenient to derive normals for the resulting surface from
the original normals. All points P on tangent plane are transformed to P. We want to find n perpendicular to P. Let
t be a vector on the tangent plane and Ml be the upper 3x3 matrix (translation part of transformation does not apply
to normal or tangent vectors).
So use the inverse transpose of the linear transformation (the upper 3x3 matrix) when transforming surface normals.
Also note that the inverse transpose is equal to the original matrix if the matrix is orthonormal, i.e. purely rotational
with no scaling or shearing.
-dimensional
-dimensional space. A hypersurface may be locally defined implicitly as the set of points
satisfying an equation
, where
is continuously
differentiable then the hypersurface is a differentiable manifold in the neighbourhood of the points where the
gradient is not null. At these points the normal vector space has dimension one and is generated by the gradient
The normal line at a point of the hypersurface is defined only if the gradient is not null. It is the line passing through
the point and having the gradient as direction.
The Jacobian matrix of the variety is the kn matrix whose i-th row is the gradient of fi. By implicit function
theorem, the variety is a manifold in the neighborhood of a point of it where the Jacobian matrix has rank k. At such
a point P, the normal vector space is the vector space generated by the values at P of the gradient vectors of the fi.
In other words, a variety is defined as the intersection of k hypersurfaces, and the normal vector space at a point is
the vector space generated by the normal vectors of the hypersurfaces at the point.
The normal (affine) space at a point P of the variety is the affine subspace passing through P and generated by the
normal vector space at P.
These definitions may be extended verbatim to the points where the variety is not a manifold.
Normal
89
Example
Let V be the variety defined in the 3-dimensional space by the equations
Uses
References
External links
An explanation of normal vectors (http://msdn.microsoft.com/
en-us/library/bb324491(VS.85).aspx) from Microsoft's MSDN
Clear pseudocode for calculating a surface normal (http://www.
opengl.org/wiki/Calculating_a_Surface_Normal) from either a
triangle or polygon.
Normal mapping
90
Normal mapping
In 3D computer graphics, normal
mapping, or "Dot3 bump mapping", is
a technique used for faking the lighting
of bumps and dents - an
implementation of Bump mapping. It
is used to add details without using
more polygons. A common use of this
technique is to greatly enhance the
appearance and details of a low
polygon model by generating a normal
map from a high polygon model or
height map.
History
The idea of taking geometric details from a high polygon model was introduced in "Fitting Smooth Surfaces to
Dense Polygon Meshes" by Krishnamurthy and Levoy, Proc. SIGGRAPH 1996,[1] where this approach was used for
creating displacement maps over nurbs. In 1998, two papers were presented with key ideas for transferring details
with normal maps from high to low polygon meshes: "Appearance Preserving Simplification", by Cohen et al.
SIGGRAPH 1998,[2] and "A general method for preserving attribute values on simplified meshes" by Cignoni et al.
IEEE Visualization '98.[3] The former introduced the idea of storing surface normals directly in a texture, rather than
displacements, though it required the low-detail model to be generated by a particular constrained simplification
algorithm. The latter presented a simpler approach that decouples the high and low polygonal mesh and allows the
recreation of any attributes of the high-detail model (color, texture coordinates, displacements, etc.) in a way that is
not dependent on how the low-detail model was created. The combination of storing normals in a texture, with the
more general creation process is still used by most currently available tools.
How it works
To calculate the Lambertian (diffuse)
lighting of a surface, the unit vector
from the shading point to the light
source is dotted with the unit vector
normal to that surface, and the result is
the intensity of the light on that
surface. Imagine a polygonal model of
a sphere - you can only approximate
Example of a normal map (center) with the scene it was calculated from (left) and the
result when applied to a flat surface (right).
the shape of the surface. By using a
3-channel bitmap textured across the
model, more detailed normal vector information can be encoded. Each channel in the bitmap corresponds to a spatial
Normal mapping
dimension (X, Y and Z). These spatial dimensions are relative to a constant coordinate system for object-space
normal maps, or to a smoothly varying coordinate system (based on the derivatives of position with respect to texture
coordinates) in the case of tangent-space normal maps. This adds much more detail to the surface of a model,
especially in conjunction with advanced lighting techniques.
Since a normal will be used in the dot product calculation for the diffuse lighting computation, we can see that the
{0, 0, 1} would be remapped to the {128, 128, 0} values, giving that kind of sky blue color seen in normal maps
(blue (z) coordinate is perspective (deepness) coordinate and RG-xy flat coordinates on screen). {0.3, 0.4, 0.866}
would be remapped to the ({0.3, 0.4, 0.866}/2+{0.5, 0.5, 0.5})*255={0.15+0.5, 0.2+0.5, -0.433+0.5}*255={0.65,
0.7, 0.067}*255={166, 179, 17} values (
). Coordinate z (blue) minus sign
flipped, because need match normal map normal vector with eye (viewpoint or camera) vector or light vector
(because sign "-" for z axis means vertex is in front of camera and not behind camera; when light vector and normal
vector match surface shined with maximum strength).
91
Normal mapping
References
[1] Krishnamurthy and Levoy, Fitting Smooth Surfaces to Dense Polygon Meshes (http:/ / www-graphics. stanford. edu/ papers/ surfacefitting/ ),
SIGGRAPH 1996
[2] Cohen et al., Appearance-Preserving Simplification (http:/ / www. cs. unc. edu/ ~geom/ APS/ APS. pdf), SIGGRAPH 1998 (PDF)
[3] Cignoni et al., A general method for preserving attribute values on simplified meshes (http:/ / vcg. isti. cnr. it/ publications/ papers/ rocchini.
pdf), IEEE Visualization 1998 (PDF)
[4] Mikkelsen, Simulation of Wrinkled Surfaces Revisited (http:/ / image. diku. dk/ projects/ media/ morten. mikkelsen. 08. pdf), 2008 (PDF)
[5] Heidrich and Seidel, Realistic, Hardware-accelerated Shading and Lighting (http:/ / www. cs. ubc. ca/ ~heidrich/ Papers/ Siggraph. 99. pdf),
SIGGRAPH 1999 (PDF)
External links
Introduction to Normal Mapping (http://www.game-artist.net/forums/vbarticles.php?do=article&
articleid=16)
Blender Normal Mapping (http://wiki.blender.org/index.php/Manual/Bump_and_Normal_Maps)
Normal Mapping with paletted textures (http://vcg.isti.cnr.it/activities/geometryegraphics/bumpmapping.
html) using old OpenGL extensions.
Normal Map Photography (http://zarria.net/nrmphoto/nrmphoto.html) Creating normal maps manually by
layering digital photographs
Normal Mapping Explained (http://www.3dkingdoms.com/tutorial.htm)
Simple Normal Mapper (http://sourceforge.net/projects/simplenormalmapper) Open Source normal map
generator
Introduction
Reflectance is a physical property of a material that
describes how it reflects incident light. The appearance
of various materials are determined to a large extent by
their reflectance properties. Most reflectance models
can be broadly classified into two categories: diffuse
and specular. In computer vision and computer
graphics, the diffuse component is often assumed to be
Lambertian. A surface that obeys Lambert's Law
appears equally bright from all viewing directions. This
model for diffuse reflection was proposed by Johann
Comparison of a matte vase with the rendering based on the
Heinrich Lambert in 1760 and has been perhaps the
Lambertian model. Illumination is from the viewing direction
most widely used reflectance model in computer vision
and graphics. For a large number of real-world surfaces, such as concrete, plaster, sand, etc., however, the
Lambertian model is an inadequate approximation of the diffuse component. This is primarily because the
Lambertian model does not take the roughness of the surface into account.
Rough surfaces can be modelled as a set of facets with different slopes, where each facet is a small planar patch.
Since photo receptors of the retina and pixels in a camera are both finite-area detectors, substantial macroscopic
92
93
(much larger than the wavelength of incident light) surface roughness is often projected onto a single detection
element, which in turn produces an aggregate brightness value over many facets. Whereas Lamberts law may hold
well when observing a single planar facet, a collection of such facets with different orientations is guaranteed to
violate Lamberts law. The primary reason for this is that the foreshortened facet areas will change for different
viewing directions, and thus the surface appearance will be view-dependent.
Analysis of this phenomenon has a long history and can
be traced back almost a century. Past work has resulted
in empirical models designed to fit experimental data as
well as theoretical results derived from first principles.
Much of this work was motivated by the
non-Lambertian reflectance of the moon.
The OrenNayar reflectance model, developed by
Michael Oren and Shree K. Nayar in 1993, predicts
reflectance from rough diffuse surfaces for the entire
hemisphere of source and sensor directions. The model
takes into account complex physical phenomena such
as masking, shadowing and interreflections between
points on the surface facets. It can be viewed as a
generalization of Lamberts law. Today, it is widely
used in computer graphics and animation for rendering
rough surfaces.[citation needed] It also has important
implications for human vision and computer vision
problems, such as shape from shading, photometric stereo, etc.
Formulation
The surface roughness model used in the
derivation of the Oren-Nayar model is the
microfacet model, proposed by Torrance
and Sparrow,[2] which assumes the surface
to be composed of long symmetric
V-cavities. Each cavity consists of two
planar facets. The roughness of the surface
is specified using a probability function for
the distribution of facet slopes. In particular,
the Gaussian distribution is often used, and
thus the variance of the Gaussian
distribution,
, is a measure of the
roughness of the surfaces. The standard
deviation of the facet slopes (gradient of the
surface elevation), ranges in
.
94
where
,
,
,
,
and
, and
Results
Here is a real image of a matte vase illuminated from the viewing direction, along with versions rendered using the
Lambertian and Oren-Nayar models. It shows that the Oren-Nayar model predicts the diffuse reflectance for rough
surfaces more accurately than the Lambertian model.
Here are rendered images of a sphere
using
the
Oren-Nayar
model,
corresponding to different surface
roughnesses (i.e. different values):
95
Torrance-Sparrow model
[3]
References
[1] M. Oren and S.K. Nayar, " Generalization of Lambert's Reflectance Model (http:/ / www1. cs. columbia. edu/ CAVE/ publications/ pdfs/
Oren_SIGGRAPH94. pdf)". SIGGRAPH. pp.239-246, Jul, 1994
[2] Torrance, K. E. and Sparrow, E. M. Theory for off-specular reflection from roughened surfaces (http:/ / www. graphics. cornell. edu/ ~westin/
pubs/ TorranceSparrowJOSA1967. pdf). J. Opt. Soc. Am.. 57, 9(Sep 1967) 1105-1114
[3] B. Walter, et al. " Microfacet Models for Refraction through Rough Surfaces (http:/ / www. cs. cornell. edu/ ~srm/ publications/
EGSR07-btdf. html)". EGSR 2007.
External links
The official project page for the Oren-Nayar model (http://www1.cs.columbia.edu/CAVE/projects/oren/) at
Shree Nayar's CAVE research group webpage (http://www.cs.columbia.edu/CAVE/)
Painter's algorithm
The painter's algorithm, also known as a priority fill, is one of the simplest solutions to the visibility problem in
3D computer graphics. When projecting a 3D scene onto a 2D plane, it is necessary at some point to decide which
polygons are visible, and which are hidden.
The name "painter's algorithm" refers to the technique employed by many painters of painting distant parts of a scene
before parts which are nearer thereby covering some areas of distant parts. The painter's algorithm sorts all the
polygons in a scene by their depth and then paints them in this order, farthest to closest. It will paint over the parts
that are normally not visible thus solving the visibility problem at the cost of having painted invisible areas of
distant objects.
The distant mountains are painted first, followed by the closer meadows; finally, the closest objects in this scene, the
trees, are painted.Wikipedia:Please clarify
Painter's algorithm
References
Foley, James; van Dam, Andries; Feiner, Steven K.; Hughes, John F. (1990). Computer Graphics: Principles and
Practice. Reading, MA, USA: Addison-Wesley. p.1174. ISBN0-201-12110-7.
96
Parallax mapping
Parallax mapping
Parallax mapping (also called offset mapping or virtual displacement mapping) is an enhancement of the bump
mapping or normal mapping techniques applied to textures in 3D rendering applications such as video games. To the
end user, this means that textures such as stone walls will have more apparent depth and thus greater realism with
less of an influence on the performance of the simulation. Parallax mapping was introduced by Tomomichi Kaneko
et al., in 2001.[1]
Parallax mapping is implemented by displacing the texture coordinates at a point on the rendered polygon by a
function of the view angle in tangent space (the angle relative to the surface normal) and the value of the height map
at that point. At steeper view-angles, the texture coordinates are displaced more, giving the illusion of depth due to
parallax effects as the view changes.
Parallax mapping described by Kaneko is a single step process that does not account for occlusion. Subsequent
enhancements have been made to the algorithm incorporating iterative approaches to allow for occlusion and
accurate silhouette rendering.[2]
References
[1] Kaneko, T., et al., 2001. Detailed Shape Representation with Parallax Mapping (http:/ / citeseerx. ist. psu. edu/ viewdoc/
download;jsessionid=4E89F25A3EF72D1AA25CEA9767873DE5?doi=10. 1. 1. 115. 1050& rep=rep1& type=pdf). In Proceedings of ICAT
2001, pp. 205-208.
[2] Tatarchuk, N., 2005. Practical Dynamic Parallax Occlusion Mapping (http:/ / ati. amd. com/ developer/ SIGGRAPH05/
Tatarchuk-ParallaxOcclusionMapping-Sketch-print. pdf) Siggraph presentation
External links
Comparison from the Irrlicht Engine: With Parallax mapping (http://www.irrlicht3d.org/images/
parallaxmapping.jpg) vs. Without Parallax mapping (http://www.irrlicht3d.org/images/noparallaxmapping.
jpg)
Parallax mapping implementation in DirectX, forum topic (http://www.gamedev.net/community/forums/
topic.asp?topic_id=387447)
Parallax Mapped Bullet Holes (http://cowboyprogramming.com/2007/01/05/parallax-mapped-bullet-holes/) Details the algorithm used for F.E.A.R. style bullet holes.
Interval Mapping (http://graphics.cs.ucf.edu/IntervalMapping/)
Parallax Mapping with Offset Limiting (http://jerome.jouvie.free.fr/OpenGl/Projects/Shaders.php)
Steep Parallax Mapping (http://graphics.cs.brown.edu/games/SteepParallax/index.html)
97
Particle system
98
Particle system
The term particle system refers to a computer graphics technique that
uses a large number of very small sprites or other graphic objects to
simulate certain kinds of "fuzzy" phenomena, which are otherwise very
hard to reproduce with conventional rendering techniques - usually
highly chaotic systems, natural phenomena, and/or processes caused by
chemical reactions.
Examples of such phenomena which are commonly replicated using
particle systems include fire, explosions, smoke, moving water (such
as a waterfall), sparks, falling leaves, clouds, fog, snow, dust, meteor
tails, stars and galaxies, or abstract visual effects like glowing trails,
magic spells, etc. - these use particles that fade out quickly and are then
re-emitted from the effect's source. Another technique can be used for
things that contain many strands - such as fur, hair, and grass involving rendering an entire particle's lifetime at once, which can then
be drawn and manipulated as a single strand of the material in
question.
Typical implementation
Typically a particle system's position and motion in 3D space are
Ad hoc particle system used to simulate a galaxy,
controlled by what is referred to as an emitter. The emitter acts as the
created in 3dengfx.
source of the particles, and its location in 3D space determines where
they are generated and whence they proceed. A regular 3D mesh
object, such as a cube or a plane, can be used as an emitter. The emitter
has attached to it a set of particle behavior parameters. These
parameters can include the spawning rate (how many particles are
generated per unit of time), the particles' initial velocity vector (the
direction they are emitted upon creation), particle lifetime (the length
of time each individual particle exists before disappearing), particle
color, and many more. It is common for all or most of these parameters
to be "fuzzy" instead of a precise numeric value, the artist specifies
a central value and the degree of randomness allowable on either side
A particle system used to simulate a bomb
of the center (i.e. the average particle's lifetime might be 50 frames
explosion, created in particleIllusion.
20%). When using a mesh object as an emitter, the initial velocity
vector is often set to be normal to the individual face(s) of the object, making the particles appear to "spray" directly
from each face.
A typical particle system's update loop (which is performed for each frame of animation) can be separated into two
distinct stages, the parameter update/simulation stage and the rendering stage.
Particle system
Simulation stage
During the simulation stage, the number of new particles that must be created is calculated based on spawning rates
and the interval between updates, and each of them is spawned in a specific position in 3D space based on the
emitter's position and the spawning area specified. Each of the particle's parameters (i.e. velocity, color, etc.) is
initialized according to the emitter's parameters. At each update, all existing particles are checked to see if they have
exceeded their lifetime, in which case they are removed from the simulation. Otherwise, the particles' position and
other characteristics are advanced based on a physical simulation, which can be as simple as translating their current
position, or as complicated as performing physically accurate trajectory calculations which take into account external
forces (gravity, friction, wind, etc.). It is common to perform collision detection between particles and specified 3D
objects in the scene to make the particles bounce off of or otherwise interact with obstacles in the environment.
Collisions between particles are rarely used, as they are computationally expensive and not visually relevant for most
simulations.
Rendering stage
After the update is complete, each particle is rendered, usually in the form of a textured billboarded quad (i.e. a
quadrilateral that is always facing the viewer). However, this is not necessary; a particle may be rendered as a single
pixel in small resolution/limited processing power environments. Particles can be rendered as Metaballs in off-line
rendering; isosurfaces computed from particle-metaballs make quite convincing liquids. Finally, 3D mesh objects
can "stand in" for the particles a snowstorm might consist of a single 3D snowflake mesh being duplicated and
rotated to match the positions of thousands or millions of particles.
99
Particle system
100
External links
Particle Systems: A Technique for Modeling a Class of Fuzzy Objects [1] William T. Reeves (ACM
Transactions on Graphics, April 1983)
The Particle Systems API [2] - David K. McAllister
The ocean spray in your face. [3] Jeff Lander (Graphic Content, July 1998)
Building an Advanced Particle System [4] John van der Burg (Gamasutra, June 2000)
Particle Engine Using Triangle Strips [5] Jeff Molofee (NeHe)
Designing an Extensible Particle System using C++ and Templates [6] Kent Lai (GameDev.net)
repository of public 3D particle scripts in LSL Second Life format [7] - Ferd Frederix
GPU-Particlesystems using WebGL [8] - Particle effects directly in the browser using WebGL for calculations.
Particle system
References
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
Path tracing
Path tracing is a computer graphics method of rendering images of three dimensional scenes such that the global
illumination is faithful to reality. Fundamentally, the algorithm is integrating over all the illuminance arriving to a
single point on the surface of an object. This illuminance is then reduced by a surface reflectance function to
determine how much of it will go towards the viewpoint camera. This integration procedure is repeated for every
pixel in the output image. When combined with physically accurate models of surfaces, accurate models of real light
sources (light bulbs), and optically-correct cameras, path tracing can produce still images that are indistinguishable
from photographs.
Path tracing naturally simulates many effects that have to be specifically added to other methods (conventional ray
tracing or scanline rendering), such as soft shadows, depth of field, motion blur, caustics, ambient occlusion, and
indirect lighting. Implementation of a renderer including these effects is correspondingly simpler.
Due to its accuracy and unbiased nature, path tracing is used to generate reference images when testing the quality of
other rendering algorithms. In order to get high quality images from path tracing, a large number of rays must be
traced to avoid visible noisy artifacts.
History
The rendering equation and its use in computer graphics was presented by James Kajiya in 1986.[1] Path Tracing
was introduced then as an algorithm to find a numerical solution to the integral of the rendering equation. A decade
later, Lafortune suggested many refinements, including bidirectional path tracing.[2]
Metropolis light transport, a method of perturbing previously found paths in order to increase performance for
difficult scenes, was introduced in 1997 by Eric Veach and Leonidas J. Guibas.
More recently, CPUs and GPUs have become powerful enough to render images more quickly, causing more
widespread interest in path tracing algorithms. Tim Purcell first presented a global illumination algorithm running on
a GPU in 2002.[3] In February 2009 Austin Robison of Nvidia demonstrated the first commercial implementation of
a path tracer running on a GPU [4], and other implementations have followed, such as that of Vladimir Koylazov in
August 2009. [5] This was aided by the maturing of GPGPU programming toolkits such as CUDA and OpenCL and
GPU ray tracing SDKs such as OptiX.
101
Path tracing
Description
Kajiya's rendering equation adheres to three particular principles of optics; the Principle of global illumination, the
Principle of Equivalence (reflected light is equivalent to emitted light), and the Principle of Direction (reflected light
and scattered light have a direction).
In the real world, objects and surfaces are visible due to the fact that they are reflecting light. This reflected light then
illuminates other objects in turn. From that simple observation, two principles follow.
I. For a given indoor scene, every object in the room must contribute illumination to every other object.
II. Second, there is no distinction to be made between illumination emitted from a light source and illumination
reflected from a surface.
Invented in 1984, a rather different method called radiosity was faithful to both principles. However, radiosity relates
the total illuminance falling on a surface with a uniform luminance that leaves the surface. This forced all surfaces to
be Lambertian, or "perfectly diffuse". While radiosity received a lot of attention at its invocation, perfectly diffuse
surfaces do not exist in the real world. The realization that scattering from a surface depends on both incoming and
outgoing directions is the key principle behind the Bidirectional Reflectance Distribution Function (BRDF). This
direction dependence was a focus of research throughout the 1990s, since accounting for direction always exacted a
price of steep increases in calculation times on desktop computers. Principle III follows.
III. The illumination coming from surfaces must scatter in a particular direction that is some function of the
incoming direction of the arriving illumination, and the outgoing direction being sampled.
Kajiya's equation is a complete summary of these three principles, and path tracing, which approximates a solution to
the equation, remains faithful to them in its implementation. There are other principles of optics which are not the
focus of Kajiya's equation, and therefore are often difficult or incorrectly simulated by the algorithm. Path Tracing is
confounded by optical phenomena not contained in the three principles. For example,
Bright, sharp caustics; radiance scales by the density of illuminance in space.
Subsurface scattering; a violation of principle III above.
Chromatic aberration. fluorescence. iridescence. Light is a spectrum of frequencies.
102
Path tracing
103
r.FindNearestObject();
if (r.hitSomething == false) {
return Black;
Material m = r.thingHit->material;
Color emittance = m.emittance;
All these samples must then be averaged to obtain the output color. Note this method of always sampling a random
ray in the normal's hemisphere only works well for perfectly diffuse surfaces. For other materials, one generally has
to use importance-sampling, i.e. probabilistically select a new ray according to the BRDF's distribution. For instance,
a perfectly specular (mirror) material would not work with the method above, as the probability of the new ray being
the correct reflected ray - which is the only ray through which any radiance will be reflected - is zero. In these
situations, one must divide the reflectance by the probability density function of the sampling scheme, as per
Monte-Carlo integration (in the naive case above, there is no particular sampling scheme, so the PDF turns out to be
1).
There are other considerations to take into account to ensure conservation of energy. In particular, in the naive case,
the reflectance of a diffuse BRDF must not exceed
however depends on the sampling scheme used, and can be difficult to get right).
Path tracing
104
Performance
A path tracer continuously samples pixels of an image. The image starts to become recognisable after only a few
samples per pixel, perhaps 100. However, for the image to "converge" and reduce noise to acceptable levels usually
takes around 5000 samples for most images, and many more for pathological cases. Noise is particularly a problem
for animations, giving them a normally-unwanted "film-grain" quality of random speckling.
The central performance bottleneck in Path Tracing is the complex geometrical calculation of casting a ray.
Importance Sampling is a technique which is motivated to cast less rays through the scene while still converging
correctly to outgoing luminance on the surface point. This is done by casting more rays in directions in which the
luminance would have been greater anyway. If the density of rays cast in certain directions matches the strength of
contributions in those directions, the result is identical, but far fewer rays were actually cast. Importance Sampling is
used to match ray density to Lambert's Cosine law, and also used to match BRDFs.
Metropolis light transport can result in a lower-noise image with fewer samples. This algorithm was created in order
to get faster convergence in scenes in which the light must pass through odd corridors or small holes in order to
reach the part of the scene that the camera is viewing. It is also shown promise on correctly rendering pathological
situations with caustics. Instead of generating random paths, new sampling paths are created as slight mutations of
existing ones. In this sense, the algorithm "remembers" the successful paths from light sources to the camera.
In real time
An example of advanced path-tracing engine capable of real-time
graphic is Brigade [6] by Jacco Bikker. The first version of this
highly-optimized game-oriented engine was released on January 26th,
2012. It's the successor of the Arauna real-time ray-tracing engine,
made by the same author, and it requires the CUDA architecture (by
Nvidia) to run.
Notes
[1]
[2]
[3]
[4]
[5]
[6]
1. ^ Kajiya, J. T. (1986). "The rendering equation". Proceedings of the 13th annual conference on Computer
graphics and interactive techniques. ACM. CiteSeerX: 10.1.1.63.1402 (http://citeseerx.ist.psu.edu/viewdoc/
summary?doi=10.1.1.63.1402).
2. ^ Lafortune, E, Mathematical Models and Monte Carlo Algorithms for Physically Based Rendering (http://
www.graphics.cornell.edu/~eric/thesis/index.html), (PhD thesis), 1996.
Path tracing
3. ^ Purcell, T J; Buck, I; Mark, W; and Hanrahan, P, "Ray Tracing on Programmable Graphics Hardware", Proc.
SIGGRAPH 2002, 703 - 712. See also Purcell, T, Ray tracing on a stream processor (http://graphics.stanford.
edu/papers/tpurcell_thesis/) (PhD thesis), 2004.
4. ^ Robison, Austin, "Interactive Ray Tracing on the GPU and NVIRT Overview" (http://realtimerendering.com/
downloads/NVIRT-Overview.pdf), slide 37, I3D 2009.
5. ^ Vray demo (http://www.youtube.com/watch?v=eRoSFNRQETg); Other examples include Octane Render,
Arion, and Luxrender.
6. ^ Veach, E., and Guibas, L. J. Metropolis light transport (http://graphics.stanford.edu/papers/metro/metro.
pdf). In SIGGRAPH97 (August 1997), pp.6576.
7. This "Introduction to Global Illumination" (http://www.thepolygoners.com/tutorials/GIIntro/GIIntro.htm)
has some good example images, demonstrating the image noise, caustics and indirect lighting properties of
images rendered with path tracing methods. It also discusses possible performance improvements in some detail.
8. SmallPt (http://www.kevinbeason.com/smallpt/) is an educational path tracer by Kevin Beason. It uses 99
lines of C++ (including scene description). This page has a good set of examples of noise resulting from this
technique.
Per-pixel lighting
In computer graphics, per-pixel lighting refers to any technique for lighting an image or scene that calculates
illumination for each pixel on a rendered image. This is in contrast to other popular methods of lighting such as
vertex lighting, which calculates illumination at each vertex of a 3D model and then interpolates the resulting values
over the model's faces to calculate the final per-pixel color values.
Per-pixel lighting is commonly used with techniques like normal mapping, bump mapping, specularity, and shadow
volumes. Each of these techniques provides some additional data about the surface being lit or the scene and light
sources that contributes to the final look and feel of the surface.
Most modern video game engines implement lighting using per-pixel techniques instead of vertex lighting to achieve
increased detail and realism. The id Tech 4 engine, used to develop such games as Brink and Doom 3, was one of the
first game engines to implement a completely per-pixel shading engine. All versions of the CryENGINE, Frostbite
Engine, and Unreal Engine, among others, also implement per-pixel shading techniques.
Deferred shading is a recent development in per-pixel lighting notable for its use in the Frostbite Engine and
Battlefield 3. Deferred shading techniques are capable of rendering potentially large numbers of small lights
inexpensively (other per-pixel lighting approaches require full-screen calculations for each light in a scene,
regardless of size).
History
While only recently have personal computers and video hardware become powerful enough to perform full per-pixel
shading in real-time applications such as games, many of the core concepts used in per-pixel lighting models have
existed for decades.
Frank Crow published a paper describing the theory of shadow volumes in 1977.[1] This technique uses the stencil
buffer to specify areas of the screen that correspond to surfaces that lie in a "shadow volume", or a shape
representing a volume of space eclipsed from a light source by some object. These shadowed areas are typically
shaded after the scene is rendered to buffers by storing shadowed areas with the stencil buffer.
Jim Blinn first introduced the idea of normal mapping in a 1978 SIGGRAPH paper.[2] Blinn pointed out that the
earlier idea of unlit texture mapping proposed by Edwin Catmull was unrealistic for simulating rough surfaces.
Instead of mapping a texture onto an object to simulate roughness, Blinn proposed a method of calculating the
105
Per-pixel lighting
degree of lighting a point on a surface should receive based on an established "perturbation" of the normals across
the surface.
Implementations
Hardware Rendering
Real-time applications, such as computer games, usually implement per-pixel lighting through the use of pixel
shaders, allowing the GPU hardware to process the effect. The scene to be rendered is first rasterized onto a number
of buffers storing different types of data to be used in rendering the scene, such as depth, normal direction, and
diffuse color. Then, the data is passed into a shader and used to compute the final appearance of the scene,
pixel-by-pixel.
Deferred shading is a per-pixel shading technique that has recently become feasible for games.[3] With deferred
shading, a "g-buffer" is used to store all terms needed to shade a final scene on the pixel level. The format of this
data varies from application to application depending on the desired effect, and can include normal data, positional
data, specular data, diffuse data, emissive maps and albedo, among others. Using multiple render targets, all of this
data can be rendered to the g-buffer with a single pass, and a shader can calculate the final color of each pixel based
on the data from the g-buffer in a final "deferred pass".
Software Rendering
Per-pixel lighting is also performed in software on many high-end commercial rendering applications which
typically do not render at interactive framerates. This is called offline rendering or software rendering. NVidia's
mental ray rendering software, which is integrated with such suites as Autodesk's Softimage is a well-known
example.
Notes
[1] Crow, Franklin C: "Shadow Algorithms for Computer Graphics", Computer Graphics (SIGGRAPH '77 Proceedings), vol. 11, no. 2, 242-248.
[2] Blinn, James F. "Simulation of Wrinkled Surfaces", Computer Graphics (SIGGRAPH '78 Proceedings, vol. 12, no. 3, 286-292.
[3] Hargreaves, Shawn and Mark Harris: "6800 Leagues Under the Sea: Deferred Shading". NVidia Developer Assets.
106
107
History
The Phong reflection model was developed by Bui Tuong Phong at the University of Utah, who published it in his
1973 Ph.D. dissertation.[1][2] It was published in conjunction with a method for interpolating the calculation for each
individual pixel that is rasterized from a polygonal surface model; the interpolation technique is known as Phong
shading, even when it is used with a reflection model other than Phong's. Phong's methods were considered radical at
the time of their introduction, but have evolved into a baseline shading method for many rendering applications.
Phong's methods have proven popular due to their generally efficient use of computation time per rendered pixel.
Description
Phong reflection is an empirical model of local illumination. It describes the way a surface reflects light as a
combination of the diffuse reflection of rough surfaces with the specular reflection of shiny surfaces. It is based on
Bui Tuong Phong's informal observation that shiny surfaces have small intense specular highlights, while dull
surfaces have large highlights that fall off more gradually. The model also includes an ambient term to account for
the small amount of light that is scattered about the entire scene.
Visual illustration of the Phong equation: here the light is white, the ambient and diffuse colors are both blue, and the specular color is white,
reflecting a small part of the light hitting the surface, but only in very narrow highlights. The intensity of the diffuse component varies with the
direction of the surface, and the ambient component is uniform (independent of direction).
and
specular and diffuse components of the light sources respectively. A single term
108
, which is a shininess constant for this material, which is larger for surfaces that are smoother and more
mirror-like. When this constant is large the specular highlight is small.
Furthermore, we have
, which is the set of all light sources,
, which is the direction vector from the point on the surface toward each light source (
specifies the
light source),
, which is the normal at this point on the surface,
, which is the direction that a perfectly reflected ray of light would take from this point on the surface,
and
, which is the direction pointing towards the viewer (such as a virtual camera).
Then the Phong reflection model provides an equation for computing the illumination of each surface point
using:
and the hats indicate that the vectors are normalized. The diffuse term is not affected by the viewer direction (
The specular term is large only when the viewer direction (
alignment is measured by the
normalized vectors
and
).
. Their
power of the cosine of the angle between them. The cosine of the angle between the
is equal to their dot product. When is large, in the case of a nearly mirror-like
reflection, the specular highlight will be small, because any viewpoint not aligned with the reflection will have a
cosine less than one which rapidly approaches zero when raised to a high power.
Although the above formulation is the common way of presenting the Phong reflection model, each term should only
be included if the term's dot product is positive. (Additionally, the specular term should only be included if the dot
product of the diffuse term is positive.)
When the color is represented as RGB values, as often is the case in computer graphics, this equation is typically
modeled separately for R, G and B intensities, allowing different reflections constants
and
for the
different color channels.
for
real
(not
necessarily
an
integer).
The
can
be
further
and
approximated
is a
as
109
where
on
a line on the object. We assume only one light, no specular reflection, and uniform known (approximated) reflection
parameters. We can then simplify the Phong equation to:
With
unknowns.
Because of the powers of two in the equation there are two possible solutions for the normal direction. Thus some
prior information of the geometry is needed to define the correct normal direction. The normals are directly related to
angles of inclination of the line on the object surface. Thus the normals allow the calculation of the relative surface
heights of the line on the object using a line integral, if we assume a continuous surface.
If the object is not cylindrical, we have three unknown normal values
still allow the normal to rotate around the view vector, thus additional constraints are needed from prior geometric
information. For instance in face recognition those geometric constraints can be obtained using principal component
analysis (PCA) on a database of depth-maps of faces, allowing only surface normals solutions which are found in a
normal population.
110
Applications
As already implied, the Phong reflection model is often used together with Phong shading to shade surfaces in 3D
computer graphics software. Apart from this, it may also be used for other purposes. For example, it has been used to
model the reflection of thermal radiation from the Pioneer probes in an attempt to explain the Pioneer anomaly.
External links
Phong reflection model in Matlab [3]
References
[1] Bui Tuong Phong, Illumination for computer generated pictures (http:/ / www. cs. northwestern. edu/ ~ago820/ cs395/ Papers/ Phong_1975.
pdf), Communications of ACM 18 (1975), no. 6, 311317.
[2] University of Utah School of Computing, http:/ / www. cs. utah. edu/ school/ history/ #phong-ref
[3] http:/ / michal. is/ projects/ phong-reflection-model-matlab/
Phong shading
Phong shading refers to an interpolation technique for surface shading in 3D computer graphics. It is also called
Phong interpolation or normal-vector interpolation shading. Specifically, it interpolates surface normals across
rasterized polygons and computes pixel colors based on the interpolated normals and a reflection model. Phong
shading may also refer to the specific combination of Phong interpolation and the Phong reflection model.
History
Phong shading and the Phong reflection model were developed at the University of Utah by Bui Tuong Phong, who
published them in his 1973 Ph.D. dissertation.[1][2] Phong's methods were considered radical at the time of their
introduction, but have evolved into a baseline shading method for many rendering applications. Phong's methods
have proven popular due to their generally efficient use of computation time per rendered pixel.
Phong interpolation
Phong shading improves upon
Gouraud shading and provides a better
approximation of the shading of a
smooth surface. Phong shading
assumes a smoothly varying surface
normal vector. The Phong interpolation
method works better than Gouraud
shading when applied to a reflection
model that has small specular
highlights such as the Phong reflection
model.
The most serious problem with Gouraud shading occurs when specular highlights are found in the middle of a large
polygon. Since these specular highlights are absent from the polygon's vertices and Gouraud shading interpolates
based on the vertex colors, the specular highlight will be missing from the polygon's interior. This problem is fixed
by Phong shading.
Phong shading
Unlike Gouraud shading, which interpolates colors across polygons, in Phong shading a normal vector is linearly
interpolated across the surface of the polygon from the polygon's vertex normals. The surface normal is interpolated
and normalized at each pixel and then used in a reflection model, e.g. the Phong reflection model, to obtain the final
pixel color. Phong shading is more computationally expensive than Gouraud shading since the reflection model must
be computed at each pixel instead of at each vertex.
In modern graphics hardware, variants of this algorithm are implemented using pixel or fragment shaders.
Visual illustration of the Phong equation: here the light is white, the ambient and diffuse colors are both blue, and the specular color is white,
reflecting a small part of the light hitting the surface, but only in very narrow highlights. The intensity of the diffuse component varies with the
direction of the surface, and the ambient component is uniform (independent of direction).
References
[1] B. T. Phong, Illumination for computer generated pictures, Communications of ACM 18 (1975), no. 6, 311317.
[2] University of Utah School of Computing, http:/ / www. cs. utah. edu/ school/ history/ #phong-ref
111
Photon mapping
Photon mapping
In computer graphics, photon mapping is a two-pass global illumination algorithm developed by Henrik Wann
Jensen that approximately solves the rendering equation. Rays from the light source and rays from the camera are
traced independently until some termination criterion is met, then they are connected in a second step to produce a
radiance value. It is used to realistically simulate the interaction of light with different objects. Specifically, it is
capable of simulating the refraction of light through a transparent substance such as glass or water, diffuse
interreflection between illuminated objects, the subsurface scattering of light in translucent materials, and some of
the effects caused by particulate matter such as smoke or water vapor. It can also be extended to more accurate
simulations of light such as spectral rendering.
Unlike path tracing, bidirectional path tracing and Metropolis light transport, photon mapping is a "biased" rendering
algorithm, which means that averaging many renders using this method does not converge to a correct solution to the
rendering equation. However, since it is a consistent method, a correct solution can be achieved by increasing the
number of photons.
Effects
Caustics
Light refracted or reflected causes patterns called caustics, usually
visible as concentrated patches of light on nearby surfaces. For
example, as light rays pass through a wine glass sitting on a table, they
are refracted and patterns of light are visible on the table. Photon
mapping can trace the paths of individual photons to model where
these concentrated patches of light will appear.
Diffuse interreflection
A model of a wine glass ray traced with photon
Diffuse interreflection is apparent when light from one diffuse object is
mapping to show caustics.
reflected onto another. Photon mapping is particularly adept at
handling this effect because the algorithm reflects photons from one
surface to another based on that surface's bidirectional reflectance distribution function (BRDF), and thus light from
one object striking another is a natural result of the method. Diffuse interreflection was first modeled using radiosity
solutions. Photon mapping differs though in that it separates the light transport from the nature of the geometry in the
scene. Color bleed is an example of diffuse interreflection.
112
Photon mapping
Subsurface scattering
Subsurface scattering is the effect evident when light enters a material and is scattered before being absorbed or
reflected in a different direction. Subsurface scattering can accurately be modeled using photon mapping. This was
the original way Jensen implemented it; however, the method becomes slow for highly scattering materials, and
bidirectional surface scattering reflectance distribution functions (BSSRDFs) are more efficient in these situations.
Usage
Construction of the photon map (1st pass)
With photon mapping, light packets called photons are sent out into the scene from the light sources. Whenever a
photon intersects with a surface, the intersection point and incoming direction are stored in a cache called the photon
map. Typically, two photon maps are created for a scene: one especially for caustics and a global one for other light.
After intersecting the surface, a probability for either reflecting, absorbing, or transmitting/refracting is given by the
material. A Monte Carlo method called Russian roulette is used to choose one of these actions. If the photon is
absorbed, no new direction is given, and tracing for that photon ends. If the photon reflects, the surface's
bidirectional reflectance distribution function is used to determine the ratio of reflected radiance. Finally, if the
photon is transmitting, a function for its direction is given depending upon the nature of the transmission.
Once the photon map is constructed (or during construction), it is typically arranged in a manner that is optimal for
the k-nearest neighbor algorithm, as photon look-up time depends on the spatial distribution of the photons. Jensen
advocates the usage of kd-trees. The photon map is then stored on disk or in memory for later usage.
113
Photon mapping
Calculating radiance using the photon map
In order to calculate surface radiance at an intersection point, one of the cached photon maps is used. The steps are:
1. Gather the N nearest photons using the nearest neighbor search function on the photon map.
2. Let S be the sphere that contains these N photons.
3. For each photon, divide the amount of flux (real photons) that the photon represents by the area of S and multiply
by the BRDF applied to that photon.
4. The sum of those results for each photon represents total surface radiance returned by the surface intersection in
the direction of the ray that struck it.
Optimizations
To avoid emitting unneeded photons, the initial direction of the outgoing photons is often constrained. Instead of
simply sending out photons in random directions, they are sent in the direction of a known object that is a desired
photon manipulator to either focus or diffuse the light. There are many other refinements that can be made to the
algorithm: for example, choosing the number of photons to send, and where and in what pattern to send them. It
would seem that emitting more photons in a specific direction would cause a higher density of photons to be
stored in the photon map around the position where the photons hit, and thus measuring this density would give
an inaccurate value for irradiance. This is true; however, the algorithm used to compute radiance does not depend
on irradiance estimates.
For soft indirect illumination, if the surface is Lambertian, then a technique known as irradiance caching may be
used to interpolate values from previous calculations.
To avoid unnecessary collision testing in direct illumination, shadow photons can be used. During the photon
mapping process, when a photon strikes a surface, in addition to the usual operations performed, a shadow photon
is emitted in the same direction the original photon came from that goes all the way through the object. The next
object it collides with causes a shadow photon to be stored in the photon map. Then during the direct illumination
calculation, instead of sending out a ray from the surface to the light that tests collisions with objects, the photon
map is queried for shadow photons. If none are present, then the object has a clear line of sight to the light source
and additional calculations can be avoided.
To optimize image quality, particularly of caustics, Jensen recommends use of a cone filter. Essentially, the filter
gives weight to photons' contributions to radiance depending on how far they are from ray-surface intersections.
This can produce sharper images.
Image space photon mapping [1] achieves real-time performance by computing the first and last scattering using a
GPU rasterizer.
Variations
Although photon mapping was designed to work primarily with ray tracers, it can also be extended for use with
scanline renderers.
External links
114
Photon mapping
References
[1]
[2]
[3]
[4]
[5]
[6]
Polygon
Polygons are used in computer graphics to compose images that are three-dimensional in appearance. Usually (but
not always) triangular, polygons arise when an object's surface is modeled, vertices are selected, and the object is
rendered in a wire frame model. This is quicker to display than a shaded model; thus the polygons are a stage in
computer animation. The polygon count refers to the number of polygons being rendered per frame.
Floating Point
Fixed-Point
Polygon
because of rounding, every scanline has its own direction in space and may show its front or back side to the
viewer.
Fraction (mathematics)
Bresenham's line algorithm
Polygons have to be split into triangles
The whole triangle shows the same side to the viewer
The point numbers from the Transform and lighting stage have to converted to Fraction (mathematics)
Barycentric coordinates (mathematics)
Used in raytracing
115
Primary Problem
The primary problem in PVS computation then becomes: Compute the set of polygons that can be visible from
anywhere inside each region of a set of polyhedral regions.
There are various classifications of PVS algorithms with respect to the type of visibility set they compute.[1]
Conservative algorithms
These overestimate visibility consistently, such that no triangle that is visible may be omitted. The net result is that
no image error is possible, however, it is possible to greatly overestimate visibility, leading to inefficient rendering
(due to the rendering of invisible geometry). The focus on conservative algorithm research is maximizing occluder
fusion in order to reduce this overestimation. The list of publications on this type of algorithm is extensive - good
surveys on this topic include Cohen-Or et al. and Durand.[2]
116
Aggressive algorithms
These underestimate visibility consistently, such that no redundant (invisible) polygons exist in the PVS set,
although it may be possible to miss a polygon that is actually visible leading to image errors. The focus on
aggressive algorithm research is to reduce the potential error.[3]
Approximate algorithms
These can result in both redundancy and image error.
Exact algorithms
These provide optimal visibility sets, where there is no image error and no redundancy. They are, however, complex
to implement and typically run a lot slower than other PVS based visibility algorithms. Teller computed exact
visibility for a scene subdivided into cells and portals[4] (see also portal rendering).
The first general tractable 3D solutions were presented in 2002 by Nirenstein et al. and Bittner.[5] Haumont et al.
improve on the performance of these techniques significantly. Bittner et al. solve the problem for 2.5D urban scenes.
Although not quite related to PVS computation, the work on the 3D Visibility Complex and 3D Visibility Skeleton
by Durand provides an excellent theoretical background on analytic visibility.
Visibility in 3D is inherently a 4-Dimensional problem. To tackle this, solutions are often performed using Plcker
coordinates, which effectively linearize the problem in a 5D projective space. Ultimately, these problems are solved
with higher dimensional constructive solid geometry.
Secondary Problems
Some interesting secondary problems include:
Compute an optimal sub-division in order to maximize visibility culling.
Compress the visible set data in order to minimize storage overhead.
Implementation Variants
It is often undesirable or inefficient to simply compute triangle level visibility. Graphics hardware prefers objects
to be static and remain in video memory. Therefore, it is generally better to compute visibility on a per-object
basis and to sub-divide any objects that may be too large individually. This adds conservativity, but the benefit is
better hardware utilization and compression (since visibility data is now per-object, rather than per-triangle).
Computing cell or sector visibility is also advantageous, since by determining visible regions of space, rather than
visible objects, it is possible to not only cull out static objects in those regions, but dynamic objects as well.
References
[1] S. Nirenstein, E. Blake, and J. Gain. Exact from-region visibility culling (http:/ / citeseerx. ist. psu. edu/ viewdoc/ summary?doi=10. 1. 1. 131.
7204), In Proceedings of the 13th workshop on Rendering, pages 191202. Eurographics Association, June 2002.
[2] 3D Visibility: Analytical study and Applications (http:/ / people. csail. mit. edu/ fredo/ THESE/ ), Frdo Durand, PhD thesis, Universit
Joseph Fourier, Grenoble, France, July 1999. is strongly related to exact visibility computations.
[3] Shaun Nirenstein and Edwin Blake, Hardware Accelerated Visibility Preprocessing using Adaptive Sampling (http:/ / citeseerx. ist. psu. edu/
viewdoc/ summary?doi=10. 1. 1. 64. 3231), Rendering Techniques 2004: Proceedings of the 15th Eurographics Symposium on Rendering,
207- 216, Norrkping, Sweden, June 2004.
[4] Seth Teller, Visibility Computations in Densely Occluded Polyhedral Environments (http:/ / www. eecs. berkeley. edu/ Pubs/ TechRpts/ 1992/
CSD-92-708. pdf) (Ph.D. dissertation, Berkeley, 1992)
[5] Jiri Bittner. Hierarchical Techniques for Visibility Computations (http:/ / citeseerx. ist. psu. edu/ viewdoc/ summary?doi=10. 1. 1. 2. 9886),
PhD Dissertation. Department of Computer Science and Engineering. Czech Technical University in Prague. Submitted October 2002,
defended March 2003.
117
External links
Cited author's pages (including publications):
Other links:
Selected publications on visibility (http://artis.imag.fr/~Xavier.Decoret/bib/visibility/)
References
Peter-Pike Sloan, Jan Kautz, and John Snyder. "Precomputed Radiance Transfer for Real-time rendering in
Dynamic, Low-Frequency Lighting Environments". ACM Transactions on Graphics, Proceedings of the 29th
Annual Conference on Computer Graphics and Interactive Techniques (SIGGRAPH), pp. 527-536. New York,
NY: ACM Press, 2002. (http://www.mpi-inf.mpg.de/~jnkautz/projects/prt/prtSIG02.pdf)
NG, R., RAMAMOORTHI, R., AND HANRAHAN, P. 2003. All-Frequency Shadows Using Non-Linear
Wavelet Lighting Approximation. ACM Transactions on Graphics 22, 3, 376381. (http://graphics.stanford.
edu/papers/allfreq/allfreq.press.pdf)
118
Procedural generation
Procedural generation
Procedural generation is a widely used term in the production of media; it refers to content generated
algorithmically rather than manually. Often, this means creating content on the fly rather than prior to distribution.
This is often related to computer graphics applications and video game level design.
Overview
The term procedural refers to the process that computes a particular function. Fractals, an example of procedural
generation, dramatically express this concept, around which a whole body of mathematicsfractal geometryhas
evolved. Commonplace procedural content includes textures and meshes. Sound is often procedurally generated as
well and has applications in both speech synthesis as well as music. It has been used to create compositions in
various genres of electronic music by artists such as Brian Eno who popularized the term "generative music".
While software developers have applied procedural generation techniques for years, few products have employed
this approach extensively. Procedurally generated elements have appeared in earlier video games: The Elder Scrolls
II: Daggerfall takes place on a mostly procedurally generated world, giving a world roughly twice the actual size of
the British Isles. Soldier of Fortune from Raven Software uses simple routines to detail enemy models. Avalanche
Studios employed procedural generation to create a large and varied group of tropical islands in great detail for Just
Cause. See also "No Man's Sky," a game being developed by games studio Hello Games which is all based upon
Procedurally generated elements.
The modern demoscene uses procedural generation to package a great deal of audiovisual content into relatively
small programs. Farbrausch is a team famous for such achievements, although many similar techniques were already
implemented by The Black Lotus in the 1990s.
In recent years, there has been an increasing interest in procedural content generation within the academic game
research community, especially among researchers interested in applying artificial intelligence methods to the
problems of PCG. New methods and applications are presented annually in conferences such as the IEEE
Conference on Computational Intelligence and Games and Artificial Intelligence and Interactive Digital
Entertainment. In particular, progress has been made in using evolutionary computation and related techniques to
generate content such as levels and game rules, an approach called search-based procedural content generation (see
[Search-based procedural content generation: a taxonomy and survey [1]] for more information). In addition, the
Experience-driven Procedural Content Generation [2] framework couples player experience models and search for
the generation of personalised content for the player.
Contemporary application
Video games
The earliest computer games were severely limited by memory constraints. This forced content, such as maps, to be
generated algorithmically on the fly: there simply wasn't enough space to store a large amount of pre-made levels
and artwork. Pseudorandom number generators were often used with predefined seed values in order to create very
large game worlds that appeared premade. For example, The Sentinel supposedly had 10,000 different levels stored
in only 48 and 64 kilobytes. An extreme case was Elite, which was originally planned to contain a total of 248
(approximately 282 trillion) galaxies with 256 solar systems each. The publisher, however, was afraid that such a
gigantic universe would cause disbelief in players, and eight of these galaxies were chosen for the final version.
Other notable early examples include the 1985 game Rescue on Fractalus that used fractals to procedurally create in
real time the craggy mountains of an alien planet and River Raid, the 1982 Activision game that used a
pseudorandom number sequence generated by a linear feedback shift register in order to generate a scrolling maze of
119
Procedural generation
obstacles.
Today, most games include thousands of times as much data in terms of memory as algorithmic mechanics. For
example, all of the buildings in the large game worlds of the Grand Theft Auto games have been individually
designed and placed by artists. In a typical modern video game, game content such as textures and character and
environment models are created by artists beforehand, then rendered in the game engine. As the technical
capabilities of computers and video game consoles increases, the amount of work required by artists also greatly
increases. First, gaming PCs, previous-generation game consoles like the Xbox 360 and PlayStation 3, and
current-generation game consoles such as the Wii U, PlayStation 4, and Xbox One are capable of rendering scenes
containing many very detailed objects with high-resolution textures in high-definition. This means that artists must
invest a great deal more time in creating a single character, vehicle, building, or texture, since players will tend to
expect ever-increasingly detailed environments.
Furthermore, the number of unique objects displayed in a video game is increasing. In addition to highly detailed
models, players expect a variety of models that appear substantially different from one another. In older games, a
single character or object model might have been used over and over again throughout a game. With the increased
visual fidelity of modern games, however, it is very jarring (and threatens the suspension of disbelief) to see many
copies of a single object, while the real world contains far more variety. Again, artists would be required to complete
exponentially more work in order to create many different varieties of a particular object. The need to hire larger art
staffs is one of the reasons for the rapid increase in game development costs.
Some initial approaches to procedural synthesis attempted to solve these problems by shifting the burden of content
generation from the artists to programmers who can create code which automatically generates different meshes
according to input parameters. Although sometimes this still happens, what has been recognized is that applying a
purely procedural model is often hard at best, requiring huge amounts of time to evolve into a functional, usable and
realistic-looking method. Instead of writing a procedure that completely builds content procedurally, it has been
proven to be much cheaper and more effective to rely on artist created content for some details. For example,
SpeedTree is middleware used to generate a large variety of trees procedurally, yet its leaf textures can be fetched
from regular files, often representing digitally acquired real foliage. Other effective methods to generate hybrid
content are to procedurally merge different pre-made assets or to procedurally apply some distortions to them.
Supposing, however, a single algorithm can be envisioned to generate a realistic-looking tree, the algorithm could be
called to generate random trees, thus filling a whole forest at runtime, instead of storing all the vertices required by
the various models. This would save storage media space and reduce the burden on artists, while providing a richer
experience. The same method would require far more processing power. Since CPUs are constantly increasing in
speed, however, the latter is becoming less of a hurdle.
A different problem is that it is not easy to develop a good algorithm for a single tree, let alone for a variety of
species (compare sumac, birch, maple). An additional caveat is that assembling a realistic-looking forest could not be
done by simply assembling trees because in the real world there are interactions between the various trees which can
dramatically change their appearance and distribution.
In 2004, a PC first-person shooter called .kkrieger was released that made heavy use of procedural synthesis: while
quite short and very simple, the advanced video effects were packed into just 96 Kilobytes. In contrast, many modern
games have to be released on DVDs, often exceeding 2 gigabytes in size, more than 20,000 times larger. Naked
Sky's RoboBlitz used procedural generation to maximize content in a less than 50MB downloadable file for Xbox
Live Arcade. Will Wright's Spore also makes use of procedural synthesis.
In 2008, Valve Software released Left 4 Dead, a first-person shooter based on the Source engine that utilized
procedural generation as a major game mechanic. The game featured a built-in artificial intelligence structure,
dubbed the "Director," which analyzed player statistics and game states on the fly to provide dynamic experiences on
each and every playthrough. Based on different player variables, such as remaining health, ammo, and number of
players, the A.I. Director could potentially create or remove enemies and items so that any given match maintained
120
Procedural generation
an exciting and breakneck pace. Left 4 Dead 2, released in November 2009, expanded on this concept, introducing
even more advanced mechanics to the A.I. Director, such as the ability to generate new paths for players to follow
according to their individual statuses.
One indie game that makes extensive use of procedural generation is Minecraft. In the game the initial state of the
world is mostly random (with guidelines in order to generate Earth-like terrain), and new areas are generated
whenever the player moves towards the edges of the world. This has the benefit that every time a new game is made,
the world is completely different and will need a different method to be successful, adding replay value.
Another indie game that relies heavily on procedural generation is Dwarf Fortress. Before the player starts a game a
whole fantasy world is generated, complete with its terrain, history, notable characters, and monsters.
Film
As in video games, procedural generation is often used in film to rapidly create visually interesting and accurate
spaces. This comes in a wide variety of applications.
One application is known as an "imperfect factory," where artists can rapidly generate a large number of similar
objects. This accounts for the fact that, in real life, no two objects are ever exactly alike. For instance, an artist could
model a product for a grocery store shelf, and then create an imperfect factory that would generate a large number of
similar objects to populate the shelf.
Noise is extremely important to procedural workflow in film, the most prolific of which is Perlin noise. Noise refers
to an algorithm that generates a patterned sequence of pseudorandom numbers.
Software examples
Middleware
Acropora, a procedural 3D modeling software utilizing voxels to create organic objects and terrain.
Art of Illusion, an open source and free 3D modeler, has an internal node-based procedural texture editor.
CityEngine, a procedural 3D modeling software, specialized in city modeling.
Filter Forge, an Adobe Photoshop plugin for designing procedural textures using node-based editing.
Grome, popular terrain and outdoor scenes modeler for games and simulation software.
Houdini, a procedural 3D animation package. A free version of the software is available.
Softimage, a 3D computer graphics application that allows node-based procedural creation and deformation of
geometry.
SpeedTree, a middleware product for procedurally generating trees.
Terragen, a landscape generation software. Terragen 2 permits procedural generation of an entire world.
World Machine, a powerful node-based procedurally generated terrain software with a plugin system to write
new, complex nodes. Exports to Terragen, among other formats, for rendering, as well as having internal texture
generation tools.
121
Procedural generation
Racing games
Fuel (2009) - Generates an open world through procedural techniques
Gran Turismo 5 (2010) - Features randomly generated rally stages
GRID 2 (2013) - Features a system dubbed "LiveRoutes" that dynamically changes the track by changing the
corner layout on a given circuit lap-by-lap.
Role-playing games
Cube World - Often compared to Minecraft for procedurally generated voxel worlds explored by players,
containing randomly generateddungeons, including underground caverns and over-world castles, as well as
separatebiomessuch as grasslands, snowlands,deserts, and oceans.[5]
Captive (1990) - Generates (theoretically up to 65,535) game levels procedurally[6]
Virtual Hydlide (1995)
Shin Megami Tensei: Persona 3 (2006) - Features procedurally generated dungeons.
The Elder Scrolls II: Daggerfall (1996)
Diablo (1998) and Diablo II (2000) - Both use procedural generation for level design. [7]
Torchlight - A Diablo clone differing mostly by art style and feel.
DynGen Hunter - A mobile RPG with a procedurally generated, persistent world
Dwarf Fortress - Procedurally generates a large game world, including civilization structures, a large world
history, interactive geography including erosion and magma flows, ecosystems which react with each other and
the game world. The process of initially generating the world can take up to half an hour even on a modern PC,
and is then stored in text files reaching over 100MB to be reloaded whenever the game is played.
Dark Cloud and Dark Cloud 2 - Both generate game levels procedurally.
122
Procedural generation
Strategy games
Majesty:The Fantasy Kingdom Sim (2000) - Uses procedural generation for all levels and scenarios.
Seven Kingdoms (1997) - Uses procedural generation for levels.[citation needed]
Xconq, an open source strategy game and game engine.
Frozen Synapse - Levels in single player are mostly randomly generated, with bits and pieces that are constant in
every generation. Multiplayer maps are randomly generated. Skirmish maps are randomly generated, and allow
the player to change the algorithm used.
Atom Zombie Smasher - Levels are generated randomly.
Freeciv - Uses procedural generation for levels.
Third-person shooters
Inside a Star-Filled Sky - All levels are procedurally generated and unlimited in visual detail.
Sandbox games
Subversion (TBA) - Uses procedural generation to create cities on a given terrain.
Minecraft - The game world is procedurally generated as the player explores it, with the full size possible
stretching out to be nearly eight times the surface area of the Earth before running into technical limits.[8]
Sir, You Are Being Hunted - As of August 22nd 2013, the game currently has three biomes: rural, mountain, and
fens.
Starbound - The game's procedural generation will allow players to explore over four hundred quadrillion unique
planets, as well as find procedurally generated weapons and armor.[9]
Terraria - Worlds are procedurally generated, so that each world is different from another one.
Almost entirely procedural games
SCP Containment Breach Map is divided into three zones each with their own sets of procedural generated
rooms.
Noctis (2000)
.kkrieger (2004)
Synth (video game) (2009) - 100% procedural graphics and levels
Games with miscellaneous procedural effects
ToeJam & Earl (1991) - The random levels were procedurally generated.
The Elder Scrolls III: Morrowind (2002) - Water effects are generated on the fly with procedural animation by the
technique demonstrated in NVIDIA's "Water Interaction" demo.
RoboBlitz (2006) for XBox360 live arcade and PC
Spore (2008)
Left 4 Dead (2008) - Certain events, item locations, and number of enemies are procedurally generated according
to player statistics.
Left 4 Dead 2 (2009) - Certain areas of maps are randomly generated and weather effects are dynamically altered
based on current situation.
123
Procedural generation
Borderlands (2009) - The weapons, items and some levels are procedurally generated based on individual players'
current level.
Star Trek Online (2010) - Star Trek Online procedurally generates new races, new objects, star systems and
planets for exploration. The player can save the coordinates of a system they find, so that they can return or let
other players find the system.
Galactic Arms Race (2010) - Evolves unique particle system weapons based on past player choices using a
custom version of the NEAT evolutionary algorithm.[10]
Terraria (2011) - Terraria procedurally generates a 2D landscape for the player to explore.
Black Mesa (2012) - A common use of procedural generation in video games is to make a few basic character
models, then run them through procedural generation software to make diverse character models, thus enabling
every character to have his, her, or its own model without the development team having to expend too many
resources. An example of a game that does this is the Half-Life 1 total conversion modification Black Mesa,
which has a built-in "Face Creation System" exclusively for that purpose.
References
[1] http:/ / julian. togelius. com/ Togelius2011Searchbased. pdf
[2] https:/ / www. itu. dk/ ~yannakakis/ EDPCG. pdf
[3] Ian Bell's Text Elite Page (http:/ / www. iancgbell. clara. net/ elite/ text/ index. htm)
[4] The Frontier Galaxy (http:/ / www. jongware. com/ galaxy1. html)
[5] Hernandez, Patricia (July 18, 2013)."I Can't Stop Playing Cube World".Kotaku. Retrieved July 19, 2013
[6] http:/ / captive. atari. org/ Technical/ MapGen/ Introduction. php
[7] http:/ / diablo. gamepedia. com/ Procedural_Generation
[8] http:/ / notch. tumblr. com/ post/ 458869117/ how-saving-and-loading-will-work-once-infinite-is-in
[9] http:/ / community. playstarbound. com/ index. php?threads/ a-little-perspective-on-the-size-of-starbound. 27178/ #post-1063769
[10] "Galactic Arms Race : Evolving the Shooter", Game Developer Magazine, April 2010.
External links
The Future Of Content (http://www.gamasutra.com/php-bin/news_index.php?story=5570) - Will Wright
keynote on Spore & procedural generation at the Game Developers Conference 2005. (registration required to
view video).
Procedural Graphics - an introduction by in4k (http://in4k.untergrund.net/index.
php?title=Procedural_Graphics_-_an_introduction)
Texturing & Modeling: A Procedural Approach (http://cobweb.ecn.purdue.edu/~ebertd/book2e.html)
Ken Perlin's Discussion of Perlin Noise (http://www.noisemachine.com/talk1/)
Procedural Content Generation Wiki (http://pcg.wikidot.com/): a community dedicated to documenting,
analyzing, and discussing all forms of procedural content generation.
Procedural Trees and Procedural Fire in a Virtual World (http://software.intel.com/en-us/articles/
procedural-trees-and-procedural-fire-in-a-virtual-world/): A white paper on creating procedural trees and
procedural fire using the Intel Smoke framework
A Real-Time Procedural Universe (http://www.gamasutra.com/view/feature/3098/
a_realtime_procedural_universe_.php) a tutorial on generating procedural planets in real-time
[Search-based procedural content generation: a taxonomy and survey (http://julian.togelius.com/
Togelius2011Searchbased.pdf)]
[PCG Google Group (https://groups.google.com/forum/#!forum/proceduralcontent)]
124
Procedural texture
Procedural texture
A procedural texture is a computer-generated image
created using an algorithm intended to create a realistic
representation of natural elements such as wood, marble,
granite, metal, stone, and others.
Usually, the natural look of the rendered result is achieved by
the usage of fractal noise and turbulence functions. These
functions are used as a numerical representation of the
randomness found in nature.
Solid texturing
Solid texturing is a process where the texture generating
function is evaluated over
at each visible surface point of
the model. Traditionally these functions use Perlin noise as
A procedural floor grate texture generated with the texture
their basis function, but some simple functions may use more
[1]
editor Genetica .
trivial methods such as the sum of sinusoidal functions for
instance. Solid textures are an alternative to the traditional
2D texture images which are applied to the surfaces of a model. It is a difficult and tedious task to get multiple 2D
textures to form a consistent visual appearance on a model without it looking obviously tiled. Solid textures were
created to specifically solve this problem.
Instead of editing images to fit a model, a function is used to evaluate the colour of the point being textured. Points
are evaluated based on their 3D position, not their 2D surface position. Consequently, solid textures are unaffected
by distortions of the surface parameter space, such as you might see near the poles of a sphere. Also, continuity
between the surface parameterization of adjacent patches isnt a concern either. Solid textures will remain consistent
and have features of constant size regardless of distortions in the surface coordinate systems. [2]
Cellular texturing
Cellular texturing differs from the majority of other procedural texture generating techniques as it does not depend
on noise functions as its basis, although it is often used to complement the technique. Cellular textures are based on
feature points which are scattered over a three dimensional space. These points are then used to split up the space
into small, randomly tiled regions called cells. These cells often look like lizard scales, pebbles, or flagstones.
Even though these regions are discrete, the cellular basis function itself is continuous and can be evaluated anywhere
in space. [3]
Genetic textures
Genetic texture generation is highly experimental approach for generating textures. It is a highly automated process
that uses a human to completely moderate the eventual outcome. The flow of control usually has a computer
generate a set of texture candidates. From these, a user picks a selection. The computer then generates another set of
textures by mutating and crossing over elements of the user selected textures.[4] For more information on exactly
how this mutation and cross over generation method is achieved, see Genetic algorithm. The process continues until
a suitable texture for the user is generated. This isn't a commonly used method of generating textures as its very
difficult to control and direct the eventual outcome. Because of this, it is typically used for experimentation or
abstract textures only.
125
Procedural texture
126
Self-organizing textures
Starting from a simple white noise, self-organization processes lead to structured patterns - still with a part of
randomness. Reaction-diffusion systems are a good example to generate such kind of textures.
color
Ks
= .4,
Kd
= .6,
Ka
= .1,
roughness = .1,
txtscale = 1;
specularcolor = 1)
{
point
float
point
point
float
PP;
/*
csp;
/*
Nf;
/*
V;
/*
pixelsize, twice,
Procedural texture
for (scale = 1; scale > twice; scale /= 2)
turbulence += scale * noise(PP/scale);
/* Gradual fade out of highest-frequency component near limit */
if (scale > pixelsize) {
weight = (scale / pixelsize) - 1;
weight = clamp(weight, 0, 1);
turbulence += weight * scale * noise(PP/scale);
}
/*
* Magnify the upper part of the turbulence range 0.75:1
* to fill the range 0:1 and use it as the parameter of
* a color spline through various shades of blue.
*/
csp = clamp(4 * turbulence - 3, 0, 1);
Ci = color spline(csp,
color (0.25, 0.25, 0.35),
/* pale blue
*/
color (0.25, 0.25, 0.35), /* pale blue
*/
color (0.20, 0.20, 0.30), /* medium blue
*/
color (0.20, 0.20, 0.30), /* medium blue
*/
color (0.20, 0.20, 0.30), /* medium blue
*/
color (0.25, 0.25, 0.35), /* pale blue
*/
color (0.25, 0.25, 0.35), /* pale blue
*/
color (0.15, 0.15, 0.26), /* medium dark blue */
color (0.15, 0.15, 0.26), /* medium dark blue */
color (0.10, 0.10, 0.20), /* dark blue
*/
color (0.10, 0.10, 0.20), /* dark blue
*/
color (0.25, 0.25, 0.35), /* pale blue
*/
color (0.10, 0.10, 0.20)
/* dark blue
*/
);
/* Multiply this color by the diffusely reflected light. */
Ci *= Ka*ambient() + Kd*diffuse(Nf);
/* Adjust for opacity. */
Oi = Os;
Ci = Ci * Oi;
/* Add in specular highlights. */
Ci += specularcolor * Ks * specular(Nf,V,roughness);
}
This article was taken from The Photoshop Roadmap [5] with written authorization
127
Procedural texture
128
References
[1]
[2]
[3]
[4]
[5]
3D projection
Part of a series on
Graphical
projection
v
t
e [1]
3D projection is any method of mapping three-dimensional points to a two-dimensional plane. As most current
methods for displaying graphical data are based on planar two-dimensional media, the use of this type of projection
is widespread, especially in computer graphics, engineering and drafting.
Orthographic projection
When the human eye looks at a scene, objects in the distance appear smaller than objects close by. Orthographic
projection ignores this effect to allow the creation of to-scale drawings for construction and engineering.
Orthographic projections are a small set of transforms often used to show profile, detail or precise measurements of a
three dimensional object. Common names for orthographic projections include plane, cross-section, bird's-eye, and
elevation.
If the normal of the viewing plane (the camera direction) is parallel to one of the primary axes (which is the x, y, or z
axis), the mathematical transformation is as follows; To project the 3D point
,
,
onto the 2D point
,
using an orthographic projection parallel to the y axis (profile view), the following equations can be used:
3D projection
129
where the vector s is an arbitrary scale factor, and c is an arbitrary offset. These constants are optional, and can be
used to properly align the viewport. Using matrix multiplication, the equations become:
.
While orthographically projected images represent the three dimensional nature of the object projected, they do not
represent the object as it would be recorded photographically or perceived by a viewer observing it directly. In
particular, parallel lengths at all points in an orthographically projected image are of the same scale regardless of
whether they are far away or near to the virtual viewer. As a result, lengths near to the viewer are not foreshortened
as they would be in a perspective projection.
Perspective projection
When the human eye views a scene, objects in the distance appear smaller than objects close by - this is known as
perspective. While orthographic projection ignores this effect to allow accurate measurements, perspective definition
shows distant objects as smaller to provide additional realism.
The perspective projection requires a more involved definition as compared to orthographic projections. A
conceptual aid to understanding the mechanics of this projection is to imagine the 2D projection as though the
object(s) are being viewed through a camera viewfinder. The camera's position, orientation, and field of view control
the behavior of the projection transformation. The following variables are defined to describe this transformation:
- the 2D projection of
When
Otherwise, to compute
and
.
the 3D vector
called a camera transform, and can be expressed as follows, expressing the rotation in terms of rotations about the
3D projection
130
x, y, and z axes (these calculations assume that the axes are ordered as a left-handed system of axes):
This representation corresponds to rotating by three Euler angles (more properly, TaitBryan angles), using the xyz
convention, which can be interpreted either as "rotate about the extrinsic axes (axes of the scene) in the order z, y, x
(reading right-to-left)" or "rotate about the intrinsic axes (axes of the camera) in the order x, y, z (reading
left-to-right)". Note that if the camera is not rotated (
), then the matrices drop out (as
identities), and this reduces to simply a shift:
Alternatively, without using matrices (let's replace (ax-cx) with x and so on, and abbreviate cos to c and sin to s):
This transformed point can then be projected onto the 2D plane using the formula (here, x/y is used as the projection
plane; literature also may use x/z):
in conjunction with an argument using similar triangles, leads to division by the homogeneous coordinate, giving
In which
3D projection
131
Diagram
where
is the screen x coordinate
is the model x coordinate
is the focal lengththe axial distance from the camera center to the image plane
is the subject distance.
Because the camera is in 3D, the same works for the screen y-coordinate, substituting y for x in the above diagram
and equation.
References
[1] http:/ / en. wikipedia. org/ w/ index. php?title=Template:Views& action=edit
External links
A case study in camera projection (http://nccasymposium.bmth.ac.uk/2007/muhittin_bilginer/index.html)
Creating 3D Environments from Digital Photographs (http://nccasymposium.bmth.ac.uk/2009/
McLaughlin_Chris/McLaughlin_C_WebBasedNotes.pdf)
Further reading
Kenneth C. Finney (2004). 3D Game Programming All in One (http://books.google.com/
?id=cknGqaHwPFkC&pg=PA93&dq="3D+projection"). Thomson Course. p.93. ISBN978-1-59200-136-1.
Koehler; Dr. Ralph. 2D/3D Graphics and Splines with Source Code. ISBN0759611874.
132
The rotation is clockwise if our line of sight points in the same direction as u.
It can be shown that this rotation can be applied to an ordinary vector
in
3-dimensional space, considered as a quaternion with a real coordinate equal to zero, by evaluating the conjugation
ofp byq:
using the Hamilton product, where p = (px, py, pz) is the new position vector of the point after the rotation.
In this instance, q is a unit quaternion and
It follows that conjugation by the product of two quaternions is the composition of conjugations by these
quaternions. If p and q are unit quaternions, then rotation (conjugation) bypq is
,
which is the same as rotating (conjugating) byq and then byp. The scalar component of the result is necessarily
zero.
The quaternion inverse of a rotation is the opposite rotation, since
. The square of a
n
quaternion rotation is a rotation by twice the angle around the same axis. More generally q is a rotation byn times
the angle around the same axis as q. This can be extended to arbitrary real n, allowing for smooth interpolation
between spatial orientations; see Slerp.
Two rotation quaternions can be combined into one equivalent quaternion by the relation:
133
in which q corresponds to the rotation q1 followed by the rotation q2. (Note that quaternion multiplication is not
commutative.) Thus, an arbitrary number of rotations can be composed together and then applied as a single rotation.
Example
The conjugation operation
Conjugating p by q refers to the operation p q p
q1.
Consider the rotation f around the axis
, with a rotation angle of 120, or 2/3radians.
The length of v is 3, the half angle is /3 (60) with cosine 1/2, (cos
60 = 0.5) and sine 3/2, (sin 60 0.866). We are therefore dealing
with a conjugation by the unit quaternion
It can be proved that the inverse of a unit quaternion is obtained simply by changing the sign of its imaginary
components. As a consequence,
and
This can be simplified, using the ordinary rules for quaternion arithmetic, to
As expected, the rotation corresponds to keeping a cube held fixed at one point, and rotating it 120 about the long
diagonal through the fixed point (observe how the three axes are permuted cyclically).
Quaternion arithmetic in practice
Let's show how we reached the previous result. Let's develop the expression of f (in two stages), and apply the rules
It gives us:
which is the expected result. As we can see, such computations are relatively long and tedious if done manually;
however, in a computer program, this amounts to calling the quaternion multiplication routine twice.
134
135
where s and c are shorthand for sin and cos , respectively. Although care should be taken (due to degeneracy as
the quaternion approaches the identity quaternion(1) or the sine of the angle approaches zero) the axis and angle can
be extracted via:
Note that the equality holds only when the square root of the sum of the squared imaginary terms takes the same
sign as qr.
As with other schemes to apply rotations, the centre of rotation must be translated to the origin before the rotation is
applied and translated back to its original position afterwards.
Explanation
Quaternions briefly
The complex numbers can be defined by introducing an abstract symbol i which satisfies the usual rules of algebra
and additionally the rule i2 = 1. This is sufficient to reproduce all of the rules of complex number arithmetic: for
example:
.
In the same way the quaternions can be defined by introducing abstract symbols i, j, k which satisfy the rules i2 = j2
= k2 = i j k = 1 and the usual algebraic rules except the commutative law of multiplication (a familiar example of
such a noncommutative multiplication is matrix multiplication). From this all of the rules of quaternion arithmetic
follow: for example, one can show that:
.
The imaginary part
space, and the real part a behaves like a scalar in R. When quaternions are used in geometry, it is more convenient to
define them as a scalar plus a vector:
.
Those who have studied vectors at school might find it strange to add a number to a vector, as they are objects of
very different natures, or to multiply two vectors together, as this operation is usually undefined. However, if one
remembers that it is a mere notation for the real and imaginary parts of a quaternion, it becomes more legitimate. In
other words, the correct reasoning is the addition of two quaternions, one with zero vector/imaginary part, and
another one with zero scalar/real part:
.
We can express quaternion multiplication in the modern language of vector cross and dot products (which were
actually inspired by the quaternions in the first place [citation needed]). In place of the rules i2 = j2 = k2 = ijk = 1 we
136
where:
Quaternion multiplication is noncommutative (because of the cross product, which anti-commutes), while
scalarscalar and scalarvector multiplications commute. From these rules it follows immediately that (see details):
.
The (left and right) multiplicative inverse or reciprocal of a nonzero quaternion is given by the conjugate-to-norm
ratio (see details):
,
as can be verified by direct calculation.
where
and
rotated by an angle
are the components of v perpendicular and parallel to u respectively. This is the formula of a
137
138
Orientation
The vector cross product, used to define the axisangle representation, does confer an orientation ("handedness") to
space: in a three-dimensional vector space, the three vectors in the equation a b = c will always form a
right-handed set (or a left-handed set, depending on how the cross product is defined), thus fixing an orientation in
the vector space. Alternatively, the dependence on orientation is expressed in referring to such u that specifies a
rotation as to axial vectors. In quaternionic formalism the choice of an orientation of the space corresponds to order
of multiplication: ij = k but ji = k. If one reverses the orientation, then the formula above becomes p q1 p q,
i.e. a unit q is replaced with the conjugate quaternion the same behaviour as of axial vectors.
139
140
and find the eigenvector (x, y, z, w) corresponding to the largest eigenvalue (that value will be 1 if and only if Q is a
pure rotation). The quaternion so obtained will correspond to the rotation closest to the original matrix Q
Wikipedia:Disputed statement
Performance comparisons
This section discusses the performance implications of using quaternions versus other methods (axis/angle or
rotation matrices) to perform rotations in 3D.
Results
Storage requirements
Method
Storage
Rotation matrix 9
Quaternion
Angle/axis
3*
* Note: angle/axis can be stored as 3 elements by multiplying the unit rotation axis by half of the rotation angle,
forming the logarithm of the quaternion, at the cost of additional calculations.
141
Rotation matrices 27
18
45
Quaternions
12
28
16
Rotation matrix 9
15
Quaternions
15
15
30
Angle/axis
23
16
41
Used methods
There are three basic approaches to rotating a vectorv:
1. Compute the matrix product of a 3 3 rotation matrixR and the original 3 1 column matrix representing v.
This requires 3 (3multiplications+ 2additions)= 9multiplications and 6additions, the most efficient method
for rotating a vector.
2. A rotation can be represented by a unit-length quaternion q = (w, r) with scalar (real) partw and vector
(imaginary) partr. The rotation can be applied to a 3D vector v via the formula
. This requires only 15 multiplications and 15 additions to evaluate (or 18
muls and 12 adds if the factor of 2 is done via multiplication.) This yields the same result as the less efficient but
more compact formula
.
3. Use the angle/axis formula to convert an angle/axis to a rotation matrixR then multiplying with a vector.
Converting the angle/axis to R using common subexpression elimination costs 14multiplies, 2function calls (sin,
cos), and 10add/subtracts; from item1, rotating using R adds an additional 9 multiplications and 6 additions for a
total of 23multiplies, 16add/subtracts, and 2 function calls (sin, cos).
It is straightforward to check that for each matrix: M MT= I, that is, that each matrix (and hence both matrices
together) represents a rotation. Note that since
, the two matrices must commute. Therefore,
there are two commuting subgroups of the set of four dimensional rotations. Arbitrary four dimensional rotations
have 6degrees of freedom, each matrix represents 3 of those 6degrees of freedom.
Since an infinitesimal four-dimensional rotation can be represented by a pair of quaternions (as follows), all
(non-infinitesimal) four-dimensional rotations can also be represented.
References
[1] Amnon Katz (1996) Computational Rigid Vehicle Dynamics, Krieger Publishing Co. ISBN 978-1575240169
[2] J. B. Kuipers (1999) Quaternions and rotation Sequences: a Primer with Applications to Orbits, Aerospace, and Virtual Reality, Princeton
University Press ISBN 978-0-691-10298-6
[3] Simon L. Altman (1986) Rotations, Quaternions, and Double Groups, Dover Publications (see especially Ch. 12).
E. P. Battey-Pratt & T. J. Racey (1980) Geometric Model for Fundamental Particles International Journal of
Theoretical Physics. Vol 19, No. 6
142
Radiosity
Radiosity
Radiosity is a global illumination algorithm
used in 3D computer graphics rendering.
Radiosity is an application of the finite
element method to solving the rendering
equation for scenes with surfaces that reflect
light diffusely. Unlike rendering methods
that use Monte Carlo algorithms (such as
path tracing), which handle all types of light
paths, typical radiosity methods only
account for paths which leave a light source
and are reflected diffusely some number of
times (possibly zero) before hitting the eye;
such paths are represented by the code
"LD*E". Radiosity is a global illumination
Screenshot of scene rendered with RRV (simple implementation of radiosity
algorithm in the sense that the illumination
renderer based on OpenGL) 79th iteration.
arriving at the eye comes not just from the
light sources, but all the scene surfaces
interacting with each other as well. Radiosity calculations are viewpoint independent which increases the
computations involved, but makes them useful for all viewpoints.
Radiosity methods were first developed in about 1950 in the engineering field of heat transfer. They were later
refined specifically for application to the problem of rendering computer graphics in 1984 by researchers at Cornell
University.[1]
Notable commercial radiosity engines are Enlighten by Geomerics, used for games including Battlefield 3 and Need
for Speed: The Run, 3D Studio Max, formZ, LightWave 3D and the Electric Image Animation System.
Visual characteristics
The inclusion of radiosity calculations
in the rendering process often lends an
added element of realism to the
finished scene, because of the way it
mimics
real-world
phenomena.
Consider a simple room scene.
The image on the left was rendered
with a typical direct illumination
renderer. There are three types of
lighting in this scene which have been
specifically chosen and placed by the
Difference between standard direct illumination without shadow umbra, and radiosity
with shadow umbra
artist in an attempt to create realistic
lighting: spot lighting with shadows
(placed outside the window to create the light shining on the floor), ambient lighting (without which any part of the
room not lit directly by a light source would be totally dark), and omnidirectional lighting without shadows (to
reduce the flatness of the ambient lighting).
143
Radiosity
The image on the right was rendered using a radiosity algorithm. There is only one source of light: an image of the
sky placed outside the window. The difference is marked. The room glows with light. Soft shadows are visible on
the floor, and subtle lighting effects are noticeable around the room. Furthermore, the red color from the carpet has
bled onto the grey walls, giving them a slightly warm appearance. None of these effects were specifically chosen or
designed by the artist.
Mathematical formulation
The basic radiosity method has its basis in the theory of thermal radiation, since radiosity relies on computing the
amount of light energy transferred among surfaces. In order to simplify computations, the method assumes that all
scattering is perfectly diffuse. Surfaces are typically discretized into quadrilateral or triangular elements over which a
piecewise polynomial function is defined.
After this breakdown, the amount of light energy transfer can be computed by using the known reflectivity of the
reflecting patch, combined with the view factor of the two patches. This dimensionless quantity is computed from
the geometric orientation of two patches, and can be thought of as the fraction of the total possible emitting area of
the first patch which is covered by the second patch.
More correctly, radiosity B is the energy per unit area leaving the patch surface per discrete time interval and is the
combination of emitted and reflected energy:
where:
144
Radiosity
145
B(x)i dAi is the total energy leaving a small area dAi around a point x.
E(x)i dAi is the emitted energy.
(x) is the reflectivity of the point, giving reflected energy per unit area by multiplying by the incident energy per
unit area (the total energy which arrives from other patches).
S denotes that the integration variable x' runs over all the surfaces in the scene
r is the distance between x and x'
x and x' are the angles between the line joining x and x' and vectors normal to the surface at x and x'
respectively.
Vis(x,x' ) is a visibility function, defined to be 1 if the two points x and x' are visible from each other, and 0 if they
are not.
If the surfaces are approximated by a finite number of planar patches,
each of which is taken to have a constant radiosity Bi and reflectivity
i, the above equation gives the discrete radiosity equation,
where Fij is the geometrical view factor for the radiation leaving j and
hitting patch i.
This equation can then be applied to each patch. The equation is
monochromatic, so color radiosity rendering requires calculation for
each of the required colors.
Solution methods
The equation can formally be solved as matrix equation, to give the
vector solution:
This gives the full "infinite bounce" solution for B directly. However
the number of calculations to compute the matrix solution scales according to n3, where n is the number of patches.
This becomes prohibitive for realistically large values of n.
Instead, the equation can more readily be solved iteratively, by repeatedly applying the single-bounce update formula
above. Formally, this is a solution of the matrix equation by Jacobi iteration. Because the reflectivities i are less
than 1, this scheme converges quickly, typically requiring only a handful of iterations to produce a reasonable
solution. Other standard iterative methods for matrix equation solutions can also be used, for example the
GaussSeidel method, where updated values for each patch are used in the calculation as soon as they are computed,
rather than all being updated synchronously at the end of each sweep. The solution can also be tweaked to iterate
over each of the sending elements in turn in its main outermost loop for each update, rather than each of the
receiving patches. This is known as the shooting variant of the algorithm, as opposed to the gathering variant. Using
the view factor reciprocity, Ai Fij = Aj Fji, the update equation can also be re-written in terms of the view factor Fji
seen by each sending patch Aj:
This is sometimes known as the "power" formulation, since it is now the total transmitted power of each element that
is being updated, rather than its radiosity.
The view factor Fij itself can be calculated in a number of ways. Early methods used a hemicube (an imaginary cube
centered upon the first surface to which the second surface was projected, devised by Cohen and Greenberg in 1985).
Radiosity
The surface of the hemicube was divided into pixel-like squares, for each of which a view factor can be readily
calculated analytically. The full form factor could then be approximated by adding up the contribution from each of
the pixel-like squares. The projection onto the hemicube, which could be adapted from standard methods for
determining the visibility of polygons, also solved the problem of intervening patches partially obscuring those
behind.
However all this was quite computationally expensive, because ideally form factors must be derived for every
possible pair of patches, leading to a quadratic increase in computation as the number of patches increased. This can
be reduced somewhat by using a binary space partitioning tree to reduce the amount of time spent determining which
patches are completely hidden from others in complex scenes; but even so, the time spent to determine the form
factor still typically scales as n log n. New methods include adaptive integration[2]
Sampling approaches
The form factors Fij themselves are not in fact explicitly needed in either of the update equations; neither to estimate
the total intensity j Fij Bj gathered from the whole view, nor to estimate how the power Aj Bj being radiated is
distributed. Instead, these updates can be estimated by sampling methods, without ever having to calculate form
factors explicitly. Since the mid 1990s such sampling approaches have been the methods most predominantly used
for practical radiosity calculations.
The gathered intensity can be estimated by generating a set of samples in the unit circle, lifting these onto the
hemisphere, and then seeing what was the radiosity of the element that a ray incoming in that direction would have
originated on. The estimate for the total gathered intensity is then just the average of the radiosities discovered by
each ray. Similarly, in the power formulation, power can be distributed by generating a set of rays from the radiating
element in the same way, and spreading the power to be distributed equally between each element a ray hits.
This is essentially the same distribution that a path-tracing program would sample in tracing back one diffuse
reflection step; or that a bidirectional ray tracing program would sample to achieve one forward diffuse reflection
step when light source mapping forwards. The sampling approach therefore to some extent represents a convergence
between the two techniques, the key difference remaining that the radiosity technique aims to build up a sufficiently
accurate map of the radiance of all the surfaces in the scene, rather than just a representation of the current view.
146
Radiosity
147
Advantages
One of the advantages of the Radiosity algorithm is that it is relatively
simple to explain and implement. This makes it a useful algorithm for
teaching students about global illumination algorithms. A typical direct
illumination renderer already contains nearly all of the algorithms
(perspective transformations, texture mapping, hidden surface
removal) required to implement radiosity. A strong grasp of
mathematics is not required to understand or implement this
algorithm[citation needed].
Limitations
Typical radiosity methods only account for light paths of the form
LD*E, i.e., paths which start at a light source and make multiple diffuse bounces before reaching the eye. Although
there are several approaches to integrating other illumination effects such as specular[3] and glossy [4] reflections,
radiosity-based methods are generally not used to solve the complete rendering equation.
Basic radiosity also has trouble resolving sudden changes in visibility (e.g., hard-edged shadows) because coarse,
regular discretization into piecewise constant elements corresponds to a low-pass box filter of the spatial domain.
Discontinuity meshing [5] uses knowledge of visibility events to generate a more intelligent discretization.
References
[1] "Cindy Goral, Kenneth E. Torrance, Donald P. Greenberg and B. Battaile, Modeling the interaction of light between diffuse surfaces (http:/ /
www. cs. rpi. edu/ ~cutler/ classes/ advancedgraphics/ S07/ lectures/ goral. pdf)",, Computer Graphics, Vol. 18, No. 3.
[2] G Walton, Calculation of Obstructed View Factors by Adaptive Integration, NIST Report NISTIR-6925 (http:/ / www. bfrl. nist. gov/
IAQanalysis/ docs/ NISTIR-6925. pdf), see also http:/ / view3d. sourceforge. net/
[3] http:/ / portal. acm. org/ citation. cfm?id=37438& coll=portal& dl=ACM
[4] http:/ / www. cs. huji. ac. il/ labs/ cglab/ papers/ clustering/
[5] http:/ / www. cs. cmu. edu/ ~ph/ discon. ps. gz
Radiosity
Further reading
Radiosity Overview, from HyperGraph of SIGGRAPH (http://www.siggraph.org/education/materials/
HyperGraph/radiosity/overview_1.htm) (provides full matrix radiosity algorithm and progressive radiosity
algorithm)
Radiosity, by Hugo Elias (http://freespace.virgin.net/hugo.elias/radiosity/radiosity.htm) (also provides a
general overview of lighting algorithms, along with programming examples)
Radiosity, by Allen Martin (http://web.cs.wpi.edu/~matt/courses/cs563/talks/radiosity.html) (a slightly
more mathematical explanation of radiosity)
ROVER, by Tralvex Yeap (http://www.tralvex.com/pub/rover/abs-mnu.htm) (Radiosity Abstracts &
Bibliography Library)
Radiosity: Basic Implementations (https://www.academia.edu/738011/
The_Radiosity_Algorithm_Basic_Implementations) (Basic radiosity survey)
External links
RADical, by Parag Chaudhuri (http://www.cse.iitd.ernet.in/~parag/projects/CG2/asign2/report/RADical.
shtml) (an implementation of shooting & sorting variant of progressive radiosity algorithm with OpenGL
acceleration, extending from GLUTRAD by Colbeck)
Radiosity Renderer and Visualizer (http://dudka.cz/rrv) (simple implementation of radiosity renderer based on
OpenGL)
Enlighten (http://www.geomerics.com) (Licensed software code that provides realtime radiosity for computer
game applications. Developed by the UK company Geomerics)
Ray casting
Ray casting is the use of ray-surface intersection tests to solve a variety of problems in computer graphics. The term
was first used in computer graphics in a 1982 paper by Scott Roth to describe a method for rendering CSG models.
Usage
Ray casting can refer to:
the general problem of determining the first object intersected by a ray,
a technique for hidden surface removal based on finding the first intersection of a ray cast from the eye through
each pixel of an image,
a non-recursive ray tracing rendering algorithm that only casts primary rays, or
a direct volume rendering method, also called volume ray casting.
Although "ray casting" and "ray tracing" were often used interchangeably in early computer graphics literature, more
recent usage tries to distinguish the two. The distinction is that ray casting is a rendering algorithm that never
recursively traces secondary rays, whereas other ray tracing-based rendering algorithms may.
Concept
Ray casting is the most basic of many computer graphics rendering algorithms that use the geometric algorithm of
ray tracing. Ray tracing-based rendering algorithms operate in image order to render three dimensional scenes to two
dimensional images. Geometric rays are traced from the eye of the observer to sample the light (radiance) travelling
toward the observer from the ray direction. The speed and simplicity of ray casting comes from computing the color
of the light without recursively tracing additional rays that sample the radiance incident on the point that the ray hit.
148
Ray casting
This eliminates the possibility of accurately rendering reflections, refractions, or the natural falloff of shadows;
however all of these elements can be faked to a degree, by creative use of texture maps or other methods. The high
speed of calculation made ray casting a handy rendering method in early real-time 3D video games.
In nature, a light source emits a ray of light that travels, eventually, to a surface that interrupts its progress. One can
think of this "ray" as a stream of photons travelling along the same path. At this point, any combination of three
things might happen with this light ray: absorption, reflection, and refraction. The surface may reflect all or part of
the light ray, in one or more directions. It might also absorb part of the light ray, resulting in a loss of intensity of the
reflected and/or refracted light. If the surface has any transparent or translucent properties, it refracts a portion of the
light beam into itself in a different direction while absorbing some (or all) of the spectrum (and possibly altering the
color). Between absorption, reflection, and refraction, all of the incoming light must be accounted for, and no more.
A surface cannot, for instance, reflect 66% of an incoming light ray, and refract 50%, since the two would add up to
be 116%. From here, the reflected and/or refracted rays may strike other surfaces, where their absorptive, refractive,
and reflective properties are again calculated based on the incoming rays. Some of these rays travel in such a way
that they hit our eye, causing us to see the scene and so contribute to the final rendered image. Attempting to
simulate this real-world process of tracing light rays using a computer can be considered extremely wasteful, as only
a minuscule fraction of the rays in a scene would actually reach the eye.
The first ray casting algorithm used for rendering was presented by Arthur Appel in 1968.[1] The idea behind ray
casting is to trace rays from the eye, one per pixel, and find the closest object blocking the path of that ray - think of
an image as a screen-door, with each square in the screen being a pixel. This is then the object the eye sees through
that pixel. Using the material properties and the effect of the lights in the scene, this algorithm can determine the
shading of this object. The simplifying assumption is made that if a surface faces a light, the light will reach that
surface and not be blocked or in shadow. The shading of the surface is computed using traditional 3D computer
graphics shading models. One important advantage ray casting offered over older scanline algorithms was its ability
to easily deal with non-planar surfaces and solids, such as cones and spheres. If a mathematical surface can be
intersected by a ray, it can be rendered using ray casting. Elaborate objects can be created by using solid modelling
techniques and easily rendered.
An early use of Appel's ray casting rendering algorithm was by Mathematical Applications Group, Inc., (MAGI) of
Elmsford, New York.[2]
149
Ray casting
Comanche series
The so-called "Voxel Space" engine developed by NovaLogic for the Comanche games traces a ray through each
column of screen pixels and tests each ray against points in a heightmap. Then it transforms each element of the
heightmap into a column of pixels, determines which are visible (that is, have not been occluded by pixels that have
been drawn in front), and draws them with the corresponding color from the texture map.[4]
References
[1] "Ray-tracing and other Rendering Approaches" (http:/ / nccastaff. bournemouth. ac. uk/ jmacey/ CGF/ slides/ RayTracing4up. pdf) (PDF),
lecture notes, MSc Computer Animation and Visual Effects, Jon Macey, University of Bournemouth
[2] Goldstein, R. A., and R. Nagel. 3-D visual simulation. Simulation 16(1), pp. 2531, 1971.
[3] Wolfenstein-style ray casting tutorial (http:/ / www. permadi. com/ tutorial/ raycast/ ) by F. Permadi
[4] Andre LaMothe. Black Art of 3D Game Programming. 1995, ISBN 1-57169-004-2, pp. 14, 398, 935-936, 941-943.
[5] "Ray shooting, depth orders and hidden surface removal", by Mark de Berg, Springer-Verlag, 1993, ISBN 3-540-57020-9, 201 pp.
External links
Raycasting planes in WebGL with source code (http://adrianboeing.blogspot.com/2011/01/
raycasting-two-planes-in-webgl.html)
Raycasting (http://leftech.com/raycaster.htm)
Interactive raycaster for the Commodore 64 in 254 bytes (with source code) (http://pouet.net/prod.
php?which=61298)
150
Ray tracing
151
Ray tracing
In computer graphics, ray tracing is a technique for
generating an image by tracing the path of light through
pixels in an image plane and simulating the effects of
its encounters with virtual objects. The technique is
capable of producing a very high degree of visual
realism, usually higher than that of typical scanline
rendering methods, but at a greater computational cost.
This makes ray tracing best suited for applications
where the image can be rendered slowly ahead of time,
such as in still images and film and television visual
effects, and more poorly suited for real-time
applications like video games where speed is critical.
Ray tracing is capable of simulating a wide variety of
optical effects, such as reflection and refraction,
scattering, and dispersion phenomena (such as
chromatic aberration).
Algorithm overview
Optical ray tracing describes a method for
producing visual images constructed in 3D
computer graphics environments, with more
photorealism than either ray casting or
scanline rendering techniques. It works by
tracing a path from an imaginary eye
through each pixel in a virtual screen, and
calculating the color of the object visible
through it.
Scenes in ray tracing are described
mathematically by a programmer or by a
visual artist (typically using intermediary
tools). Scenes may also incorporate data
from images and models captured by means
such as digital photography.
The ray tracing algorithm builds an image by extending rays into a scene
Typically, each ray must be tested for intersection with some subset of all the objects in the scene. Once the nearest
object has been identified, the algorithm will estimate the incoming light at the point of intersection, examine the
material properties of the object, and combine this information to calculate the final color of the pixel. Certain
illumination algorithms and reflective or translucent materials may require more rays to be re-cast into the scene.
It may at first seem counterintuitive or "backwards" to send rays away from the camera, rather than into it (as actual
light does in reality), but doing so is many orders of magnitude more efficient. Since the overwhelming majority of
light rays from a given light source do not make it directly into the viewer's eye, a "forward" simulation could
Ray tracing
potentially waste a tremendous amount of computation on light paths that are never recorded.
Therefore, the shortcut taken in raytracing is to presuppose that a given ray intersects the view frame. After either a
maximum number of reflections or a ray traveling a certain distance without intersection, the ray ceases to travel and
the pixel's value is updated.
152
Ray tracing
153
Disadvantages
A serious disadvantage of ray tracing is performance. Scanline algorithms and other algorithms use data coherence to
share computations between pixels, while ray tracing normally starts the process anew,
Ray tracing
154
The number of reflections a ray can take and how it is affected each time it
encounters a surface is all controlled via software settings during ray tracing. Here,
each ray was allowed to reflect up to 16 times. Multiple reflections of reflections
can thus be seen. Created with Cobalt
The number of refractions a ray can take and how it is affected each time it
encounters a surface is all controlled via software settings during ray tracing. Here,
each ray was allowed to refract and reflect up to 9 times. Fresnel reflections were
used. Also note the caustics. Created with Vray
Ray tracing
155
Photon mapping is another method that uses both light-based and eye-based ray tracing; in an initial pass, energetic
photons are traced along rays from the light source so as to compute an estimate of radiant flux as a function of
3-dimensional space (the eponymous photon map itself). In a subsequent pass, rays are traced from the eye into the
scene to determine the visible surfaces, and the photon map is used to estimate the illumination at the visible surface
points.[5][6] The advantage of photon mapping versus bidirectional path tracing is the ability to achieve significant
reuse of photons, reducing computation, at the cost of statistical bias.
An additional problem occurs when light must pass through a very narrow aperture to illuminate the scene (consider
a darkened room, with a door slightly ajar leading to a brightly lit room), or a scene in which most points do not have
direct line-of-sight to any light source (such as with ceiling-directed light fixtures or torchieres). In such cases, only a
very small subset of paths will transport energy; Metropolis light transport is a method which begins with a random
search of the path space, and when energetic paths are found, reuses this information by exploring the nearby space
of rays.[7]
To the right is an image showing a simple example of a path of rays
recursively generated from the camera (or eye) to the light source using
the above algorithm. A diffuse surface reflects light in all directions.
First, a ray is created at an eyepoint and traced through a pixel and into
the scene, where it hits a diffuse surface. From that surface the
algorithm recursively generates a reflection ray, which is traced
through the scene, where it hits another diffuse surface. Finally,
another reflection ray is generated and traced through the scene, where
it hits the light source and is absorbed. The color of the pixel now
depends on the colors of the first and second diffuse surface and the color of the light emitted from the light source.
For example if the light source emitted white light and the two diffuse surfaces were blue, then the resulting color of
the pixel is blue.
Example
As a demonstration of the principles involved in raytracing, let us consider how one would find the intersection
between a ray and a sphere. In vector notation, the equation of a sphere with center and radius is
with direction
(here
Let
Ray tracing
156
found by solving this equation are the two ones such that
where
with respect to
is the intersection point found before. The reflection direction can be found by a reflection of
, that is
Now we only need to compute the intersection of the latter ray with our field of view, to get the pixel which our
reflected light ray will hit. Lastly, this pixel is set to an appropriate color, taking into account how the color of the
original light source and the one of the sphere are combined by the reflection.
This is merely the math behind the linesphere intersection and the subsequent determination of the colour of the
pixel being calculated. There is, of course, far more to the general process of raytracing, but this demonstrates an
example of the algorithms used.
Ray tracing
Bounding volumes
We enclose groups of objects in sets of hierarchical bounding volumes and first test for intersection with the
bounding volume, and then only if there is an intersection, against the objects enclosed by the volume.
Bounding volumes should be easy to test for intersection, for example a sphere or box (slab). The best bounding
volume will be determined by the shape of the underlying object or objects. For example, if the objects are long and
thin then a sphere will enclose mainly empty space and a box is much better. Boxes are also easier for hierarchical
bounding volumes.
Note that using a hierarchical system like this (assuming it is done carefully) changes the intersection computational
time from a linear dependence on the number of objects to something between linear and a logarithmic dependence.
This is because, for a perfect case, each intersection test would divide the possibilities by two, and we would have a
binary tree type structure. Spatial subdivision methods, discussed below, try to achieve this.
Kay & Kajiya give a list of desired properties for hierarchical bounding volumes:
Subtrees should contain objects that are near each other and the further down the tree the closer should be the
objects.
The volume of each node should be minimal.
The sum of the volumes of all bounding volumes should be minimal.
Greater attention should be placed on the nodes near the root since pruning a branch near the root will remove
more potential objects than one farther down the tree.
The time spent constructing the hierarchy should be much less than the time saved by using it.
In real time
The first implementation of a "real-time" ray-tracer was credited at the 2005 SIGGRAPH computer graphics
conference as the REMRT/RT tools developed in 1986 by Mike Muuss for the BRL-CAD solid modeling system.
Initially published in 1987 at USENIX, the BRL-CAD ray-tracer is the first known implementation of a parallel
network distributed ray-tracing system that achieved several frames per second in rendering performance.[8] This
performance was attained by means of the highly optimized yet platform independent LIBRT ray-tracing engine in
BRL-CAD and by using solid implicit CSG geometry on several shared memory parallel machines over a
commodity network. BRL-CAD's ray-tracer, including REMRT/RT tools, continue to be available and developed
today as Open source software.
Since then, there have been considerable efforts and research towards implementing ray tracing in real time speeds
for a variety of purposes on stand-alone desktop configurations. These purposes include interactive 3D graphics
applications such as demoscene productions, computer and video games, and image rendering. Some real-time
software 3D engines based on ray tracing have been developed by hobbyist demo programmers since the late 1990s.
The OpenRT project includes a highly optimized software core for ray tracing along with an OpenGL-like API in
order to offer an alternative to the current rasterisation based approach for interactive 3D graphics. Ray tracing
hardware, such as the experimental Ray Processing Unit developed at the Saarland University, has been designed to
accelerate some of the computationally intensive operations of ray tracing. On March 16, 2007, the University of
Saarland revealed an implementation of a high-performance ray tracing engine that allowed computer games to be
rendered via ray tracing without intensive resource usage.
On June 12, 2008 Intel demonstrated a special version of Enemy Territory: Quake Wars, titled Quake Wars: Ray
Traced, using ray tracing for rendering, running in basic HD (720p) resolution. ETQW operated at 14-29 frames per
second. The demonstration ran on a 16-core (4 socket, 4 core) Xeon Tigerton system running at 2.93GHz.
At SIGGRAPH 2009, Nvidia announced OptiX, a free API for real-time ray tracing on Nvidia GPUs. The API
exposes seven programmable entry points within the ray tracing pipeline, allowing for custom cameras, ray-primitive
intersections, shaders, shadowing, etc. This flexibility enables bidirectional path tracing, Metropolis light transport,
157
Ray tracing
and many other rendering algorithms that cannot be implemented with tail recursion. Nvidia has shipped over
350,000,000 OptiX capable GPUs as of April 2013. OptiX-based renderers are used in Adobe AfterEffects,
Bunkspeed Shot, Autodesk Maya, 3ds max, and many other renderers.
Imagination Technologies offers a free API called OpenRL which accelerates tail recursive ray tracing-based
rendering algorithms and, together with their proprietary ray tracing hardware, works with Autodesk Maya to
provide what 3D World calls "real-time raytracing to the everyday artist".[9]
References
[1] Appel A. (1968) Some techniques for shading machine renderings of solids (http:/ / graphics. stanford. edu/ courses/ Appel. pdf). AFIPS
Conference Proc. 32 pp.37-45
[2] Whitted T. (1979) An improved illumination model for shaded display (http:/ / citeseerx. ist. psu. edu/ viewdoc/ summary?doi=10. 1. 1. 156.
1534). Proceedings of the 6th annual conference on Computer graphics and interactive techniques
[3] A. Chalmers, T. Davis, and E. Reinhard. Practical parallel rendering, ISBN 1-56881-179-9. AK Peters, Ltd., 2002.
[4] GPU Gems 2, Chapter 38. High-Quality Global Illumination Rendering Using Rasterization, Addison-Wesley (http:/ / http. developer. nvidia.
com/ GPUGems2/ gpugems2_chapter38. html)
[5] Global Illumination using Photon Maps (http:/ / graphics. ucsd. edu/ ~henrik/ papers/ photon_map/
global_illumination_using_photon_maps_egwr96. pdf)
[6] Photon Mapping - Zack Waters (http:/ / web. cs. wpi. edu/ ~emmanuel/ courses/ cs563/ write_ups/ zackw/ photon_mapping/ PhotonMapping.
html)
[7] http:/ / graphics. stanford. edu/ papers/ metro/ metro. pdf
[8] See Proceedings of 4th Computer Graphics Workshop, Cambridge, MA, USA, October 1987. Usenix Association, 1987. pp 8698.
[9] 3D World, April 2013
External links
What is ray tracing ? (http://www.codermind.com/articles/Raytracer-in-C++
-Introduction-What-is-ray-tracing.html)
Ray Tracing and Gaming - Quake 4: Ray Traced Project (http://www.pcper.com/reviews/Graphics-Cards/
Ray-Tracing-and-Gaming-Quake-4-Ray-Traced-Project)
Ray tracing and Gaming - One Year Later (http://www.pcper.com/reviews/Processors/
Ray-Tracing-and-Gaming-One-Year-Later)
Interactive Ray Tracing: The replacement of rasterization? (http://www.few.vu.nl/~kielmann/theses/
avdploeg.pdf)
A series of tutorials on implementing a raytracer using C++ (http://devmaster.net/posts/2836/
raytracing-theory-implementation-part-1-introduction)
Tutorial on implementing a raytracer in PHP (http://quaxio.com/raytracer/)
The Compleat Angler (1978) (http://www.youtube.com/watch?v=WV4qXzM641o)
Writing a Simple Ray Tracer (scratchapixel) (http://scratchapixel.com/lessons/3d-basic-lessons/
lesson-1-writing-a-simple-raytracer/)
158
Reflection
159
Reflection
Reflection in computer graphics is used to emulate reflective objects
like mirrors and shiny surfaces.
Reflection is accomplished in a ray trace renderer by following a ray
from the eye to the mirror and then calculating where it bounces from,
and continuing the process until no surface is found, or a non-reflective
surface is found. Reflection on a shiny surface like wood or tile can
add to the photorealistic effects of a 3D rendering.
Polished - A Polished Reflection is an undisturbed reflection, like a
mirror or chrome.
Blurry - A Blurry Reflection means that tiny random bumps on the
surface of the material cause the reflection to be blurry.
Metallic - A reflection is Metallic if the highlights and reflections
retain the color of the reflective object.
Glossy - This term can be misused. Sometimes it is a setting which
Ray traced model demonstrating specular
reflection.
is the opposite of Blurry. (When "Glossiness" has a low value, the
reflection is blurry.) However, some people use the term "Glossy
Reflection" as a synonym for "Blurred Reflection." Glossy used in this context means that the reflection is
actually blurred.
Examples
Polished or Mirror reflection
Mirrors are usually almost 100% reflective.
Reflection
160
Metallic Reflection
Normal, (nonmetallic), objects reflect
light and colors in the original color of
the object being reflected.
Metallic objects reflect lights and
colors altered by the color of the
metallic object itself.
The large sphere on the left is blue with its reflection marked as metallic. The large sphere
on the right is the same color but does not have the metallic property selected.
Blurry Reflection
Many
materials
are
imperfect
reflectors, where the reflections are
blurred to various degrees due to
surface roughness that scatters the rays
of the reflections.
The large sphere on the left has sharpness set to 100%. The sphere on the right has
sharpness set to 50% which creates a blurry reflection.
Reflection
161
Glossy Reflection
Fully
glossy
reflection,
shows
highlights from light sources, but does
not show a clear reflection from
objects.
The sphere on the left has normal, metallic reflection. The sphere on the right has the
same parameters, except that the reflection is marked as "glossy".
Reflection mapping
In computer graphics, environment mapping, or reflection mapping,
is an efficient image-based lighting technique for approximating the
appearance of a reflective surface by means of a precomputed texture
image. The texture is used to store the image of the distant
environment surrounding the rendered object.
Several ways of storing the surrounding environment are employed.
The first technique was sphere mapping, in which a single texture
contains the image of the surroundings as reflected on a mirror ball. It
has been almost entirely surpassed by cube mapping, in which the
An example of reflection mapping.
environment is projected onto the six faces of a cube and stored as six
square textures or unfolded into six square regions of a single texture.
Other projections that have some superior mathematical or computational properties include the paraboloid mapping,
the pyramid mapping, the octahedron mapping, and the HEALPix mapping.
The reflection mapping approach is more efficient than the classical ray tracing approach of computing the exact
reflection by tracing a ray and following its optical path. The reflection color used in the shading computation at a
pixel is determined by calculating the reflection vector at the point on the object and mapping it to the texel in the
environment map. This technique often produces results that are superficially similar to those generated by
raytracing, but is less computationally expensive since the radiance value of the reflection comes from calculating
the angles of incidence and reflection, followed by a texture lookup, rather than followed by tracing a ray against the
scene geometry and computing the radiance of the ray, simplifying the GPU workload.
However in most circumstances a mapped reflection is only an approximation of the real reflection. Environment
mapping relies on two assumptions that are seldom satisfied:
Reflection mapping
1) All radiance incident upon the object being shaded comes from an infinite distance. When this is not the case the
reflection of nearby geometry appears in the wrong place on the reflected object. When this is the case, no parallax is
seen in the reflection.
2) The object being shaded is convex, such that it contains no self-interreflections. When this is not the case the
object does not appear in the reflection; only the environment does.
Reflection mapping is also a traditional image-based lighting technique for creating reflections of real-world
backgrounds on synthetic objects.
Environment mapping is generally the fastest method of rendering a reflective surface. To further increase the speed
of rendering, the renderer may calculate the position of the reflected ray at each vertex. Then, the position is
interpolated across polygons to which the vertex is attached. This eliminates the need for recalculating every pixel's
reflection direction.
If normal mapping is used, each polygon has many face normals (the direction a given point on a polygon is facing),
which can be used in tandem with an environment map to produce a more realistic reflection. In this case, the angle
of reflection at a given point on a polygon will take the normal map into consideration. This technique is used to
make an otherwise flat surface appear textured, for example corrugated metal, or brushed aluminium.
162
Reflection mapping
163
Cube mapping
Cube mapping and other polyhedron mappings address the severe
distortion of sphere maps. If cube maps are made and filtered correctly,
they have no visible seams, and can be used independent of the
viewpoint of the often-virtual camera acquiring the map. Cube and
other polyhedron maps have since superseded sphere maps in most
computer graphics applications, with the exception of acquiring
image-based lighting.
Generally, cube mapping uses the same skybox that is used in outdoor
renderings. Cube mapped reflection is done by determining the vector
that the object is being viewed at. This camera ray is reflected about
the surface normal of where the camera vector intersects the object.
This results in the reflected ray which is then passed to the cube map to
get the texel which provides the radiance value used in the lighting
calculation. This creates the effect that the object is reflective.
HEALPix mapping
HEALPix environment mapping is similar to the other polyhedron
mappings, but can be hierarchical, thus providing a unified framework
for generating polyhedra that better approximate the sphere. This
allows lower distortion at the cost of increased computation.[1]
History
Precursor work in texture mapping had been established by Edwin
Catmull, with refinements for curved surfaces by James Blinn, in 1974.
[2] Blinn went on to further refine his work, developing environment
mapping by 1976. [3]
Gene Miller experimented with spherical environment mapping in
1982 at MAGI Synthavision.
Reflection mapping
References
[1] Tien-Tsin Wong, Liang Wan, Chi-Sing Leung, and Ping-Man Lam. Real-time Environment Mapping with Equal Solid-Angle Spherical
Quad-Map (http:/ / appsrv. cse. cuhk. edu. hk/ ~lwan/ paper/ sphquadmap/ sphquadmap. htm), Shader X4: Lighting & Rendering, Charles
River Media, 2006
[2] http:/ / www. comphist. org/ computing_history/ new_page_6. htm
[3] http:/ / www. debevec. org/ ReflectionMapping/
[4] Heidrich, W., and H.-P. Seidel. "View-Independent Environment Maps." Eurographics Workshop on Graphics Hardware 1998, pp. 3945.
[5] Emil Praun and Hugues Hoppe. "Spherical parametrization and remeshing." ACM Transactions on Graphics,22(3):340349, 2003.
[6] Mauro Steigleder. "Pencil Light Transport." A thesis presented to the University of Waterloo, 2005.
External links
The Story of Reflection mapping (http://www.pauldebevec.com/ReflectionMapping/) by Paul Debevec
NVIDIA's paper (http://developer.nvidia.com/attach/6595)Wikipedia:Link rot about sphere & cube env.
mapping
Relief mapping
In computer graphics, relief mapping is a texture mapping technique used to render the surface details of three
dimensional objects accurately and efficiently. It can produce accurate depictions of self-occlusion, self-shadowing,
and parallax. It is a form of short-distance raytrace done on a pixel shader.[citation needed] Relief mapping is highly
comparable in both function and approach to another displacement texture mapping technique, Parallax occlusion
mapping, considering that they both rely on raytraces, though the two are not to be confused with each other, as
parallax occlusion mapping uses reverse heightmap tracing.
References
External links
Manuel's Relief texture mapping (http://www.inf.ufrgs.br/~oliveira/RTM.html)
164
165
Rendering
Rendering is the process of generating an image from a model (or models in what
collectively could be called a scene file), by means of computer programs. Also, the
results of such a model can be called a rendering. A scene file contains objects in a
strictly defined language or data structure; it would contain geometry, viewpoint,
texture, lighting, and shading information as a description of the virtual scene. The
data contained in the scene file is then passed to a rendering program to be
processed and output to a digital image or raster graphics image file. The term
"rendering" may be by analogy with an "artist's rendering" of a scene. Though the
technical details of rendering methods vary, the general challenges to overcome in
producing a 2D image from a 3D representation stored in a scene file are outlined as
the graphics pipeline along a rendering device, such as a GPU. A GPU is a
purpose-built device able to assist a CPU in performing complex rendering
calculations. If a scene is to look relatively realistic and predictable under virtual
lighting, the rendering software should solve the rendering equation. The rendering
equation doesn't account for all lighting phenomena, but is a general lighting model
for computer-generated imagery. 'Rendering' is also used to describe the process of
calculating effects in a video editing program to produce final video output.
Rendering is one of the major sub-topics of 3D computer graphics, and in practice is
always connected to the others. In the graphics pipeline, it is the last major step,
giving the final appearance to the models and animation. With the increasing
sophistication of computer graphics since the 1970s, it has become a more distinct
subject.
A variety of rendering techniques
applied to a single 3D scene
Rendering
166
Usage
When the pre-image (a wireframe sketch usually) is complete, rendering is used, which adds in bitmap textures or
procedural textures, lights, bump mapping and relative position to other objects. The result is a completed image the
consumer or intended viewer sees.
For movie animations, several images (frames) must be rendered, and stitched together in a program capable of
making an animation of this sort. Most 3D image editing programs can do this.
Features
A rendered image can be understood in terms of a number of visible
features. Rendering research and development has been largely
motivated by finding ways to simulate these efficiently. Some relate
directly to particular algorithms and techniques, while others are
produced together.
shading how the color and brightness of a surface varies with
lighting
texture-mapping a method of applying detail to surfaces
bump-mapping a method of simulating small-scale bumpiness on
surfaces
fogging/participating medium how light dims when passing
through non-clear atmosphere or air
shadows the effect of obstructing light
soft shadows varying darkness caused by partially obscured light
sources
reflection mirror-like or highly glossy reflection
transparency (optics), transparency (graphic) or opacity sharp
transmission of light through solid objects
translucency highly scattered transmission of light through solid
objects
Rendering
indirect illumination surfaces illuminated by light reflected off other surfaces, rather than directly from a light
source (also known as global illumination)
caustics (a form of indirect illumination) reflection of light off a shiny object, or focusing of light through a
transparent object, to produce bright highlights on another object
depth of field objects appear blurry or out of focus when too far in front of or behind the object in focus
motion blur objects appear blurry due to high-speed motion, or the motion of the camera
non-photorealistic rendering rendering of scenes in an artistic style, intended to look like a painting or drawing
Techniques
Many rendering algorithms have been researched, and software used for rendering may employ a number of different
techniques to obtain a final image.
Tracing every particle of light in a scene is nearly always completely impractical and would take a stupendous
amount of time. Even tracing a portion large enough to produce an image takes an inordinate amount of time if the
sampling is not intelligently restricted.
Therefore, a few loose families of more-efficient light transport modelling techniques have emerged:
rasterization, including scanline rendering, geometrically projects objects in the scene to an image plane, without
advanced optical effects;
ray casting considers the scene as observed from a specific point-of-view, calculating the observed image based
only on geometry and very basic optical laws of reflection intensity, and perhaps using Monte Carlo techniques to
reduce artifacts;
ray tracing is similar to ray casting, but employs more advanced optical simulation, and usually uses Monte Carlo
techniques to obtain more realistic results at a speed that is often orders of magnitude slower.
The fourth type of light transport technique, radiosity is not usually implemented as a rendering technique, but
instead calculates the passage of light as it leaves the light source and illuminates surfaces. These surfaces are
usually rendered to the display using one of the other three techniques.
Most advanced software combines two or more of the techniques to obtain good-enough results at reasonable cost.
Another distinction is between image order algorithms, which iterate over pixels of the image plane, and object order
algorithms, which iterate over objects in the scene. Generally object order is more efficient, as there are usually
fewer objects in a scene than pixels.
167
Rendering
occupied by a single primitive tend to be contiguous in the image. For these reasons, rasterization is usually the
approach of choice when interactive rendering is required; however, the pixel-by-pixel approach can often produce
higher-quality images and is more versatile because it does not depend on as many assumptions about the image as
rasterization.
The older form of rasterization is characterized by rendering an entire face (primitive) as a single color.
Alternatively, rasterization can be done in a more complicated manner by first rendering the vertices of a face and
then rendering the pixels of that face as a blending of the vertex colors. This version of rasterization has overtaken
the old method as it allows the graphics to flow without complicated textures (a rasterized image when used face by
face tends to have a very block-like effect if not covered in complex textures; the faces are not smooth because there
is no gradual color change from one primitive to the next). This newer method of rasterization utilizes the graphics
card's more taxing shading functions and still achieves better performance because the simpler textures stored in
memory use less space. Sometimes designers will use one rasterization method on some faces and the other method
on others based on the angle at which that face meets other joined faces, thus increasing speed and not hurting the
overall effect.
Ray casting
In ray casting the geometry which has been modeled is parsed pixel by pixel, line by line, from the point of view
outward, as if casting rays out from the point of view. Where an object is intersected, the color value at the point may
be evaluated using several methods. In the simplest, the color value of the object at the point of intersection becomes
the value of that pixel. The color may be determined from a texture-map. A more sophisticated method is to modify
the colour value by an illumination factor, but without calculating the relationship to a simulated light source. To
reduce artifacts, a number of rays in slightly different directions may be averaged.
Rough simulations of optical properties may be additionally employed: a simple calculation of the ray from the
object to the point of view is made. Another calculation is made of the angle of incidence of light rays from the light
source(s), and from these as well as the specified intensities of the light sources, the value of the pixel is calculated.
Another simulation uses illumination plotted from a radiosity algorithm, or a combination of these two.
Raycasting is primarily used for realtime simulations, such as those used in 3D computer games and cartoon
animations, where detail is not important, or where it is more efficient to manually fake the details in order to obtain
better performance in the computational stage. This is usually the case when a large number of frames need to be
animated. The resulting surfaces have a characteristic 'flat' appearance when no additional tricks are used, as if
objects in the scene were all painted with matte finish.
168
Rendering
169
Ray tracing
Ray tracing aims to simulate the natural flow of light,
interpreted as particles. Often, ray tracing methods are
utilized to approximate the solution to the rendering
equation by applying Monte Carlo methods to it. Some
of the most used methods are path tracing, bidirectional
path tracing, or Metropolis light transport, but also semi
realistic methods are in use, like Whitted Style Ray
Tracing, or hybrids. While most implementations let
light propagate on straight lines, applications exist to
simulate relativistic spacetime effects.
In a final, production quality rendering of a ray traced
work, multiple rays are generally shot for each pixel,
and traced not just to the first object of intersection, but
rather, through a number of sequential 'bounces', using
the known laws of optics such as "angle of incidence
equals angle of reflection" and more advanced laws that
deal with refraction and surface roughness.
Radiosity
Radiosity is a method which attempts to simulate the way in which directly illuminated surfaces act as indirect light
sources that illuminate other surfaces. This produces more realistic shading and seems to better capture the
'ambience' of an indoor scene. A classic example is the way that shadows 'hug' the corners of rooms.
The optical basis of the simulation is that some diffused light from a given point on a given surface is reflected in a
large spectrum of directions and illuminates the area around it.
The simulation technique may vary in complexity. Many renderings have a very rough estimate of radiosity, simply
illuminating an entire scene very slightly with a factor known as ambiance. However, when advanced radiosity
estimation is coupled with a high quality ray tracing algorithim, images may exhibit convincing realism, particularly
for indoor scenes.
Rendering
In advanced radiosity simulation, recursive, finite-element algorithms 'bounce' light back and forth between surfaces
in the model, until some recursion limit is reached. The colouring of one surface in this way influences the colouring
of a neighbouring surface, and vice versa. The resulting values of illumination throughout the model (sometimes
including for empty spaces) are stored and used as additional inputs when performing calculations in a ray-casting or
ray-tracing model.
Due to the iterative/recursive nature of the technique, complex objects are particularly slow to emulate. Prior to the
standardization of rapid radiosity calculation, some graphic artists used a technique referred to loosely as false
radiosity by darkening areas of texture maps corresponding to corners, joints and recesses, and applying them via
self-illumination or diffuse mapping for scanline rendering. Even now, advanced radiosity calculations may be
reserved for calculating the ambiance of the room, from the light reflecting off walls, floor and ceiling, without
examining the contribution that complex objects make to the radiosityor complex objects may be replaced in the
radiosity calculation with simpler objects of similar size and texture.
Radiosity calculations are viewpoint independent which increases the computations involved, but makes them useful
for all viewpoints. If there is little rearrangement of radiosity objects in the scene, the same radiosity data may be
reused for a number of frames, making radiosity an effective way to improve on the flatness of ray casting, without
seriously impacting the overall rendering time-per-frame.
Because of this, radiosity is a prime component of leading real-time rendering methods, and has been used from
beginning-to-end to create a large number of well-known recent feature-length animated 3D-cartoon films.
Optimization
Optimizations used by an artist when a scene is being developed
Due to the large number of calculations, a work in progress is usually only rendered in detail appropriate to the
portion of the work being developed at a given time, so in the initial stages of modeling, wireframe and ray casting
may be used, even where the target output is ray tracing with radiosity. It is also common to render only parts of the
scene at high detail, and to remove objects that are not important to what is currently being developed.
170
Rendering
Academic core
The implementation of a realistic renderer always has some basic element of physical simulation or emulation
some computation which resembles or abstracts a real physical process.
The term "physically based" indicates the use of physical models and approximations that are more general and
widely accepted outside rendering. A particular set of related techniques have gradually become established in the
rendering community.
The basic concepts are moderately straightforward, but intractable to calculate; and a single elegant algorithm or
approach has been elusive for more general purpose renderers. In order to meet demands of robustness, accuracy and
practicality, an implementation will be a complex combination of different techniques.
Rendering research is concerned with both the adaptation of scientific models and their efficient application.
Meaning: at a particular position and direction, the outgoing light (Lo) is the sum of the emitted light (Le) and the
reflected light. The reflected light being the sum of the incoming light (Li) from all directions, multiplied by the
surface reflection and incoming angle. By connecting outward light to inward light, via an interaction point, this
equation stands for the whole 'light transport' all the movement of light in a scene.
Light interaction is often approximated by the even simpler models: diffuse reflection and specular reflection,
although both can ALSO be BRDFs.
Geometric optics
Rendering is practically exclusively concerned with the particle aspect of light physics known as geometric
optics. Treating light, at its basic level, as particles bouncing around is a simplification, but appropriate: the wave
aspects of light are negligible in most scenes, and are significantly more difficult to simulate. Notable wave aspect
phenomena include diffraction (as seen in the colours of CDs and DVDs) and polarisation (as seen in LCDs). Both
types of effect, if needed, are made by appearance-oriented adjustment of the reflection model.
Visual perception
Though it receives less attention, an understanding of human visual perception is valuable to rendering. This is
mainly because image displays and human perception have restricted ranges. A renderer can simulate an almost
infinite range of light brightness and color, but current displays movie screen, computer monitor, etc. cannot
handle so much, and something must be discarded or compressed. Human perception also has limits, and so does not
need to be given large-range images to create realism. This can help solve the problem of fitting images into
displays, and, furthermore, suggest what short-cuts could be used in the rendering simulation, since certain subtleties
171
Rendering
172
Rendering
References
[1] A brief introduction to RenderMan (http:/ / portal. acm. org/ citation. cfm?id=1185817& jmp=abstract& coll=GUIDE& dl=GUIDE)
Further reading
Pharr, Matt; Humphreys, Greg (2004). Physically based rendering from theory to implementation. Amsterdam:
Elsevier/Morgan Kaufmann. ISBN0-12-553180-X.
Shirley, Peter; Morley, R. Keith (2003). Realistic ray tracing (2 ed.). Natick, Mass.: AK Peters.
ISBN1-56881-198-5.
Dutr, Philip; Bekaert, Philippe; Bala, Kavita (2003). Advanced global illumination ([Online-Ausg.] ed.). Natick,
Mass.: A K Peters. ISBN1-56881-177-2.
Akenine-Mller, Tomas; Haines, Eric (2004). Real-time rendering (2 ed.). Natick, Mass.: AK Peters.
ISBN1-56881-182-9.
Strothotte, Thomas; Schlechtweg, Stefan (2002). Non-photorealistic computer graphics modeling, rendering, and
animation (2 ed.). San Francisco, CA: Morgan Kaufmann. ISBN1-55860-787-0.
Gooch, Bruce; Gooch, Amy (2001). Non-photorealistic rendering. Natick, Mass.: A K Peters.
ISBN1-56881-133-0.
Jensen, Henrik Wann (2001). Realistic image synthesis using photon mapping ([Nachdr.] ed.). Natick, Mass.: AK
Peters. ISBN1-56881-147-0.
Blinn, Jim (1996). Jim Blinn's corner : a trip down the graphics pipeline. San Francisco, Calif.: Morgan
Kaufmann Publishers. ISBN1-55860-387-5.
Glassner, Andrew S. (2004). Principles of digital image synthesis (2 ed.). San Francisco, Calif.: Kaufmann.
ISBN1-55860-276-3.
Cohen, Michael F.; Wallace, John R. (1998). Radiosity and realistic image synthesis (3 ed.). Boston, Mass. [u.a.]:
Academic Press Professional. ISBN0-12-178270-0.
Foley, James D.; Van Dam; Feiner; Hughes (1990). Computer graphics : principles and practice (2 ed.). Reading,
Mass.: Addison-Wesley. ISBN0-201-12110-7.
Andrew S. Glassner, ed. (1989). An introduction to ray tracing (3 ed.). London [u.a.]: Acad. Press.
ISBN0-12-286160-4.
Description of the 'Radiance' system (http://radsite.lbl.gov/radiance/papers/sg94.1/)
External links
SIGGRAPH (http://www.siggraph.org/) The ACMs special interest group in graphics the largest academic
and professional association and conference.
http://www.cs.brown.edu/~tor/List of links to (recent) siggraph papers (and some others) on the web.
173
Retained mode
Retained mode
In computing, retained mode rendering is a style for application programming interfaces of graphics libraries, in
which the libraries retain a complete model of the objects to be rendered.[1]
Overview
By using a "retained mode" approach, client calls do not directly cause actual rendering, but instead update an
internal model (typically a list of objects) which is maintained within the library's data space. This allows the library
to optimize when actual rendering takes place along with the processing of related objects.
Some techniques to optimize rendering include:[citation needed]
managing double buffering
performing occlusion culling
only transferring data that has changed from one frame to the next from the application to the library
Immediate mode is an alternative approach; the two styles can coexist in the same library and are not necessarily
exclusionary in practice. For example, OpenGL has immediate mode functions that can use previously defined server
side objects (textures, vertex and index buffers, shaders, etc.) without resending unchanged data.[citation needed]
References
[1] Retained Mode Versus Immediate Mode (http:/ / msdn. microsoft. com/ en-us/ library/ windows/ desktop/ ff684178(v=vs. 85). aspx)
Scanline rendering
Scanline rendering is an algorithm for visible surface determination, in 3D computer graphics, that works on a
row-by-row basis rather than a polygon-by-polygon or pixel-by-pixel basis. All of the polygons to be rendered are
first sorted by the top y coordinate at which they first appear, then each row or scan line of the image is computed
using the intersection of a scan line with the polygons on the front of the sorted list, while the sorted list is updated to
discard no-longer-visible polygons as the active scan line is advanced down the picture.
The main advantage of this method is that sorting vertices along the normal of the scanning plane reduces the
number of comparisons between edges. Another advantage is that it is not necessary to translate the coordinates of
all vertices from the main memory into the working memoryonly vertices defining edges that intersect the current
scan line need to be in active memory, and each vertex is read in only once. The main memory is often very slow
compared to the link between the central processing unit and cache memory, and thus avoiding re-accessing vertices
in main memory can provide a substantial speedup.
This kind of algorithm can be easily integrated with many other graphics techniques, such as the Phong reflection
model or the Z-buffer algorithm.
Algorithm
The usual method starts with edges of projected polygons inserted into buckets, one per scanline; the rasterizer
maintains an active edge table(AET). Entries maintain sort links, X coordinates, gradients, and references to the
polygons they bound. To rasterize the next scanline, the edges no longer relevant are removed; new edges from the
current scanlines' Y-bucket are added, inserted sorted by X coordinate. The active edge table entries have X and
other parameter information incremented. Active edge table entries are maintained in an X-sorted list by bubble sort,
effecting a change when 2 edges cross. After updating edges, the active edge table is traversed in X order to emit
174
Scanline rendering
only the visible spans, maintaining a Z-sorted active Span table, inserting and deleting the surfaces when edges are
crossed.
Variants
A hybrid between this and Z-buffering does away with the active edge table sorting, and instead rasterizes one
scanline at a time into a Z-buffer, maintaining active polygon spans from one scanline to the next.
In another variant, an ID buffer is rasterized in an intermediate step, allowing deferred shading of the resulting
visible pixels.
History
The first publication of the scanline rendering technique was probably by Wylie, Romney, Evans, and Erdahl in
1967.[1]
Other early developments of the scanline rendering method were by Bouknight in 1969,[2] and Newell, Newell, and
Sancha in 1972.[3] Much of the early work on these methods was done in Ivan Sutherland's graphics group at the
University of Utah, and at the Evans & Sutherland company in Salt Lake City.
Similar techniques
A similar principle is employed in tiled rendering (most famously the PowerVR 3D chip); that is, primitives are
sorted into screen space, then rendered in fast on-chip memory, one tile at a time. The Dreamcast provided a mode
for rasterizing one row of tiles at a time for direct raster scanout, saving the need for a complete framebuffer,
somewhat in the spirit of hardware scanline rendering.
Some software rasterizers use 'span buffering' (or 'coverage buffering'), in which a list of sorted, clipped spans are
stored in scanline buckets. Primitives would be successively added to this datastructure, before rasterizing only the
visible pixels in a final stage.
175
Scanline rendering
References
[1] Wylie, C, Romney, G W, Evans, D C, and Erdahl, A, "Halftone Perspective Drawings by Computer," Proc. AFIPS FJCC 1967, Vol. 31, 49
[2] Bouknight W.J, "An Improved Procedure for Generation of Half-tone Computer Graphics Representation," UI, Coordinated Science
Laboratory, Sept 1969
[3] Newell, M E, Newell R. G, and Sancha, T.L, "A New Approach to the Shaded Picture Problem," Proc ACM National Conf. 1972
External links
University of Utah Graphics Group History (http://www.cs.utah.edu/about/history/)
176
Schlick's approximation
177
Schlick's approximation
In 3D computer graphics, Schlick's approximation is a formula for approximating the contribution of the Fresnel
term in the specular reflection of light from a non-conducting interface (surface) between two media.
According to Schlick's model, the specular reflection coefficient R can be approximated by:
where
is the angle between the viewing direction and the half-angle direction, which is halfway between the
. And
References
Schlick, C. (1994). "An Inexpensive BRDF Model for Physically-based Rendering". Computer Graphics Forum
13 (3): 233. doi:10.1111/1467-8659.1330233 [1].
References
[1] http:/ / dx. doi. org/ 10. 1111%2F1467-8659. 1330233
Implementation
The algorithm is implemented as a pixel shader,
analyzing the scene depth buffer which is stored in a
texture. For every pixel on the screen, the pixel shader
samples the depth values around the current pixel and
tries to compute the amount of occlusion from each of
the sampled points. In its simplest implementation, the
occlusion factor depends only on the depth difference
between sampled point and current point.
Without additional smart solutions, such a brute force
method would require about 200 texture reads per pixel
for good visual quality. This is not acceptable for
real-time rendering on current graphics hardware. In
order to get high quality results with far fewer reads, sampling is performed using a randomly rotated kernel. The
kernel orientation is repeated every N screen pixels in order to have only high-frequency noise in the final picture. In
178
the end this high frequency noise is greatly removed by a NxN post-process blurring step taking into account depth
discontinuities (using methods such as comparing adjacent normals and depths). Such a solution allows a reduction
in the number of depth samples per pixel to about 16 or fewer while maintaining a high quality result, and allows the
use of SSAO in soft real-time applications like computer games.
Compared to other ambient occlusion solutions, SSAO has the following advantages:
In video games
Title
Year
Platform(s)
7554
Alan Wake
Notes
[2]
Assassin's Creed:
Brotherhood
Batman: Arkham
Asylum
2009 Microsoft Windows, PlayStation 3, Xbox 360, OS Windows and Xbox 360 versions only.
X
Batman: Arkham
Origins
Battlefield 3
[3]
Battlefield: Bad
[4]
Company 2
BattleForge
Binary Domain
Bionic Commando
179
Borderlands
Borderlands 2
Chivalry: Medieval
Warfare
City of Heroes
Costume Quest
Crysis
Crysis 2
Crysis 3
Crysis Warhead
Darksiders II
[7]
Dead Island
Dead Space 3
Dead to Rights:
Retribution
[9]
Dragon Age II
Eve Online
F.E.A.R. 2: Project
[10]
Origin
F.E.A.R. 3
Far Cry 3
Fight Night
[11]
Champion
Gears of War 2
Halo: Reach
Hitman: Absolution
Infamous 2
2011 PlayStation 3
Infestation: Survivor
Stories
180
James Bond 007: Blood 2010 Microsoft Windows, PlayStation 3, Xbox 360
[14]
Stone
[15]
Just Cause 2
L.A. Noire
[16][17]
Mafia II
Max Payne 3
[18]
Metro 2033
Napoleon: Total
[19]
War
NecroVision
Overgrowth
Quake Live
Red Faction:
[20]
Guerrilla
Risen
S.T.A.L.K.E.R.: Call of
[21]
Pripyat
S.T.A.L.K.E.R.: Clear
Sky
[22]
Shattered Horizon
Sleeping Dogs
[24]
The Cave
The Witcher 2:
[25]
Assassins of Kings
Tomb Raider
181
Uncharted 2: Among
Thieves
2009 PlayStation 3
Vox
War Thunder
World of Tanks
World of Warcraft
References
[1] http:/ / geekmontage. com/ texts/ game-fixes-amnesia-the-dark-descent-crashing-lag-black-screen-freezing-sound-fixes/
[2] http:/ / www. bit-tech. net/ gaming/ pc/ 2010/ 10/ 25/ arcania-gothic-4-review/ 1
[3] http:/ / publications. dice. se/ attachments/ BF3_NFS_WhiteBarreBrisebois_Siggraph2011. pdf
[4] http:/ / www. guru3d. com/ news/ battlefield-bad-company-2-directx-11-details-/
[5] http:/ / community. callofduty. com/ thread/ 4682
[6] http:/ / crytek. com/ sites/ default/ files/ Crysis%202%20Key%20Rendering%20Features. pdf
[7] http:/ / www. eurogamer. net/ articles/ digitalfoundry-dead-island-face-off
[8] http:/ / www. eurogamer. net/ articles/ deus-ex-human-revolution-face-off
[9] http:/ / www. techspot. com/ review/ 374-dragon-age-2-performance-test/
[10] http:/ / www. pcgameshardware. com/ aid,675766/ Fear-2-Project-Origin-GPU-and-CPU-benchmarks-plus-graphics-settings-compared/
Reviews/
[11] http:/ / imagequalitymatters. blogspot. com/ 2011/ 03/ tech-analysis-fight-night-champion-360_12. html
[12] http:/ / store. steampowered. com/ news/ 5321/ ?l=russian
[13] http:/ / imagequalitymatters. blogspot. com/ 2010/ 07/ tech-analsis-infamous-2-early-screens. html
[14] http:/ / www. lensoftruth. com/ head2head-blood-stone-007-hd-screenshot-comparison/
[15] http:/ / ve3d. ign. com/ articles/ features/ 53469/ Just-Cause-2-PC-Interview
[16] http:/ / imagequalitymatters. blogspot. com/ 2010/ 08/ tech-analysis-mafia-ii-demo-ps3-vs-360. html
[17] http:/ / www. eurogamer. net/ articles/ digitalfoundry-mafia-ii-demo-showdown
[18]
[19]
[20]
[21]
[22]
[23]
[24]
[25]
[26]
External links
Finding Next Gen CryEngine 2 (http://delivery.acm.org/10.1145/1290000/1281671/p97-mittring.
pdf?key1=1281671&key2=9942678811&coll=ACM&dl=ACM&CFID=15151515&CFTOKEN=6184618)
Video showing SSAO in action (http://www.youtube.com/watch?v=ifdAILHTcZk)
Image Enhancement by Unsharp Masking the Depth Buffer (http://graphics.uni-konstanz.de/publikationen/
2006/unsharp_masking/Luft et al.-- Image Enhancement by Unsharp Masking the Depth Buffer.pdf)
Hardware Accelerated Ambient Occlusion Techniques on GPUs (http://perumaal.googlepages.com/)
Overview on Screen Space Ambient Occlusion Techniques (http://meshula.net/wordpress/?p=145) (as of
March 1, 2012)
182
Self-shadowing
Self-Shadowing is a computer graphics lighting effect, used in 3D rendering applications such as computer
animation and video games. Self-shadowing allows non-static objects in the environment, such as game characters
and interactive objects (buckets, chairs, etc.), to cast shadows on themselves and each other. For example, without
self-shadowing, if a character puts his or her right arm over the left, the right arm will not cast a shadow over the left
arm. If that same character places a hand over a ball, that hand will cast a shadow over the ball.
Shadow mapping
Shadow mapping or projective shadowing is a process by which
shadows are added to 3D computer graphics. This concept was
introduced by Lance Williams in 1978, in a paper entitled "Casting
curved shadows on curved surfaces". Since then, it has been used both
in pre-rendered scenes and realtime scenes in many console and PC
games.
Shadows are created by testing whether a pixel is visible from the light
source, by comparing it to a z-buffer or depth image of the light
source's view, stored in the form of a texture.
Scene with shadow mapping
Shadow mapping
183
This technique is less accurate than shadow volumes, but the shadow
map can be a faster alternative depending on how much fill time is
required for either technique in a particular application and therefore
may be more suitable to real time applications. In addition, shadow
maps do not require the use of an additional stencil buffer, and can be
modified to produce shadows with a soft edge. Unlike shadow
volumes, however, the accuracy of a shadow map is limited by its
resolution.
Scene with no shadows
Algorithm overview
Rendering a shadowed scene involves two major drawing steps. The first produces the shadow map itself, and the
second applies it to the scene. Depending on the implementation (and number of lights), this may require two or
more drawing passes.
This depth map must be updated any time there are changes to either the light
or the objects in the scene, but can be reused in other situations, such as those
where only the viewing camera moves. (If there are multiple lights, a separate
depth map must be used for each light.)
In many implementations it is practical to render only a subset of the objects
in the scene to the shadow map in order to save some of the time it takes to
redraw the map. Also, a depth offset which shifts the objects away from the
light may be applied to the shadow map rendering in an attempt to resolve
stitching problems where the depth map value is close to the depth of a
Scene from the light view, depth map.
surface being drawn (i.e., the shadow casting surface) in the next step.
Alternatively, culling front faces and only rendering the back of objects to the shadow map is sometimes used for a
similar result.
Shadow mapping
184
If done with a shader, or other graphics hardware extension, this transformation is usually applied at the vertex level,
and the generated value is interpolated between other vertices, and passed to the fragment level.
Depth map test
Once the light-space coordinates are found, the x and y values usually
correspond to a location in the depth map texture, and the z value corresponds
to its associated depth, which can now be tested against the depth map.
If the z value is greater than the value stored in the depth map at the
appropriate (x,y) location, the object is considered to be behind an occluding
object, and should be marked as a failure, to be drawn in shadow by the
drawing process. Otherwise it should be drawn lit.
If the (x,y) location falls outside the depth map, the programmer must either
decide that the surface should be lit or shadowed by default (usually lit).
In a shader implementation, this test would be done at the fragment level. Also, care needs to be taken when
selecting the type of texture map storage to be used by the hardware: if interpolation cannot be done, the shadow will
appear to have a sharp jagged edge (an effect that can be reduced with greater shadow map resolution).
Shadow mapping
185
It is possible to modify the depth map test to produce shadows with a soft edge by using a range of values (based on
the proximity to the edge of the shadow) rather than simply pass or fail.
The shadow mapping technique can also be modified to draw a texture onto the lit regions, simulating the effect of a
projector. The picture above, captioned "visualization of the depth map projected onto the scene" is an example of
such a process.
Drawing the scene
Drawing the scene with shadows can be done in several different ways. If
programmable shaders are available, the depth map test may be performed by
a fragment shader which simply draws the object in shadow or lighted
depending on the result, drawing the scene in a single pass (after an initial
earlier pass to generate the shadow map).
If shaders are not available, performing the depth map test must usually be
implemented by some hardware extension (such as GL_ARB_shadow [1]),
which usually do not allow a choice between two lighting models (lit and
shadowed), and necessitate more rendering passes:
1. Render the entire scene in shadow. For the most common lighting models (see Phong reflection model) this
should technically be done using only the ambient component of the light, but this is usually adjusted to also
include a dim diffuse light to prevent curved surfaces from appearing flat in shadow.
2. Enable the depth map test, and render the scene lit. Areas where the depth map test fails will not be overwritten,
and remain shadowed.
3. An additional pass may be used for each additional light, using additive blending to combine their effect with the
lights already drawn. (Each of these passes requires an additional previous pass to generate the associated shadow
map.)
The example pictures in this article used the OpenGL extension GL_ARB_shadow_ambient
shadow map process in two passes.
[2]
to accomplish the
Shadow mapping
Splitting
PSSM "Parallel Split" http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html [3]
CSM "Cascaded" http://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/
doc/cascaded_shadow_maps.pdf [4]
Warping
LiSPSM "Light Space Perspective" http://www.cg.tuwien.ac.at/~scherzer/files/papers/LispSM_survey.pdf
[5]
Smoothing
PCF "Percentage Closer Filtering" http://http.developer.nvidia.com/GPUGems/gpugems_ch11.html [9]
Filtering
ESM "Exponential" http://www.thomasannen.com/pub/gi2008esm.pdf [10]
CSM "Convolution" http://research.edm.uhasselt.be/~tmertens/slides/csm.ppt [11]
VSM "Variance" http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.104.2569&rep=rep1&
type=pdf [12]
SAVSM "Summed Area Variance" http://http.developer.nvidia.com/GPUGems3/gpugems3_ch08.html [13]
SMSR "Shadow Map Silhouette Revectorization" http://bondarev.nl/?p=326 [14]
Soft Shadows
PCSS "Percentage Closer" http://developer.download.nvidia.com/shaderlibrary/docs/shadow_PCSS.pdf [15]
SSSS "Screen space soft shadows" http://www.crcnetbase.com/doi/abs/10.1201/b10648-36 [16]
FIV "Fullsphere Irradiance Vector" http://getlab.org/publications/FIV/ [17]
Assorted
186
Shadow mapping
Further reading
Smooth Penumbra Transitions with Shadow Maps [31] Willem H. de Boer
Forward shadow mapping [32] does the shadow test in eye-space rather than light-space to keep texture access
more sequential.
Shadow mapping techniques [33] An overview of different shadow mapping techniques
References
[1]
[2]
[3]
[4]
[5]
[6] http:/ / www. comp. nus. edu. sg/ ~tants/ tsm. html
[7] http:/ / www-sop. inria. fr/ reves/ Marc. Stamminger/ psm/
[8] http:/ / bib. irb. hr/ datoteka/ 570987. 12_CSSM. pdf
[9] http:/ / http. developer. nvidia. com/ GPUGems/ gpugems_ch11. html
[10] http:/ / www. thomasannen. com/ pub/ gi2008esm. pdf
[11] http:/ / research. edm. uhasselt. be/ ~tmertens/ slides/ csm. ppt
[12] http:/ / citeseerx. ist. psu. edu/ viewdoc/ download?doi=10. 1. 1. 104. 2569& rep=rep1& type=pdf
[13] http:/ / http. developer. nvidia. com/ GPUGems3/ gpugems3_ch08. html
[14] http:/ / bondarev. nl/ ?p=326
[15] http:/ / developer. download. nvidia. com/ shaderlibrary/ docs/ shadow_PCSS. pdf
[16] http:/ / www. crcnetbase. com/ doi/ abs/ 10. 1201/ b10648-36
[17] http:/ / getlab. org/ publications/ FIV/
[18] http:/ / www. cs. cornell. edu/ ~kb/ publications/ ASM. pdf
[19] http:/ / visual-computing. intel-research. net/ art/ publications/ avsm/
[20] http:/ / free-zg. t-com. hr/ cssm/
[21] http:/ / sites. google. com/ site/ osmanbrian2/ dpsm. pdf
[22] http:/ / graphics. pixar. com/ library/ DeepShadows/ paper. pdf
[23] http:/ / www. cs. unc. edu/ ~zhangh/ technotes/ shadow/ shadow. ps
[24] http:/ / gamma. cs. unc. edu/ LOGSM/
[25] http:/ / citeseerx. ist. psu. edu/ viewdoc/ download?doi=10. 1. 1. 59. 3376& rep=rep1& type=pdf
[26] http:/ / www. cspaul. com/ wiki/ doku. php?id=publications:rosen. 2012. i3d
[27] http:/ / www. idav. ucdavis. edu/ func/ return_pdf?pub_id=919
[28] http:/ / visual-computing. intel-research. net/ art/ publications/ sdsm/
[29] http:/ / jgt. akpeters. com/ papers/ Mikkelsen07/ sep_math. pdf
[30] http:/ / graphics. stanford. edu/ papers/ silmap/ silmap. pdf
[31] http:/ / www. whdeboer. com/ papers/ smooth_penumbra_trans. pdf
[32] http:/ / www. cs. unc. edu/ ~zhangh/ shadow. html
[33] http:/ / www. gamerendering. com/ category/ shadows/ shadow-mapping/
187
Shadow mapping
External links
Hardware Shadow Mapping (http://developer.nvidia.com/attach/8456), nVidia
Shadow Mapping with Today's OpenGL Hardware (http://developer.nvidia.com/attach/6769), nVidia
Riemer's step-by-step tutorial implementing Shadow Mapping with HLSL and DirectX (http://www.riemers.
net/Tutorials/DirectX/Csharp3/index.php)
NVIDIA Real-time Shadow Algorithms and Techniques (http://developer.nvidia.com/object/doc_shadows.
html)
Shadow Mapping implementation using Java and OpenGL (http://www.embege.com/shadowmapping)
Shadow volume
Shadow volume is a technique used in 3D computer graphics to add shadows to a rendered scene. They were first
proposed by Frank Crow in 1977[1] as the geometry describing the 3D shape of the region occluded from a light
source. A shadow volume divides the virtual world in two: areas that are in shadow and areas that are not.
The stencil buffer implementation of shadow volumes is generally considered among the most practical general
purpose real-time shadowing techniques for use on modern 3D graphics hardware. It has been popularised by the
video game Doom 3, and a particular variation of the technique used in this game has become known as Carmack's
Reverse (see depth fail below).
Shadow volumes have become a popular tool for real-time shadowing, alongside the more venerable shadow
mapping. The main advantage of shadow volumes is that they are accurate to the pixel (though many
implementations have a minor self-shadowing problem along the silhouette edge, see construction below), whereas
the accuracy of a shadow map depends on the texture memory allotted to it as well as the angle at which the shadows
are cast (at some angles, the accuracy of a shadow map unavoidably suffers). However, the shadow volume
technique requires the creation of shadow geometry, which can be CPU intensive (depending on the
implementation). The advantage of shadow mapping is that it is often faster, because shadow volume polygons are
often very large in terms of screen space and require a lot of fill time (especially for convex objects), whereas
shadow maps do not have this limitation.
Construction
In order to construct a shadow volume, project a ray from the light source through each vertex in the shadow casting
object to some point (generally at infinity). These projections will together form a volume; any point inside that
volume is in shadow, everything outside is lit by the light.
For a polygonal model, the volume is usually formed by classifying each face in the model as either facing toward
the light source or facing away from the light source. The set of all edges that connect a toward-face to an away-face
form the silhouette with respect to the light source. The edges forming the silhouette are extruded away from the
light to construct the faces of the shadow volume. This volume must extend over the range of the entire visible
scene; often the dimensions of the shadow volume are extended to infinity to accomplish this (see optimization
below.) To form a closed volume, the front and back end of this extrusion must be covered. These coverings are
called "caps". Depending on the method used for the shadow volume, the front end may be covered by the object
itself, and the rear end may sometimes be omitted (see depth pass below).
There is also a problem with the shadow where the faces along the silhouette edge are relatively shallow. In this
case, the shadow an object casts on itself will be sharp, revealing its polygonal facets, whereas the usual lighting
model will have a gradual change in the lighting along the facet. This leaves a rough shadow artifact near the
silhouette edge which is difficult to correct. Increasing the polygonal density will minimize the problem, but not
eliminate it. If the front of the shadow volume is capped, the entire shadow volume may be offset slightly away from
188
Shadow volume
the light to remove any shadow self-intersections within the offset distance of the silhouette edge (this solution is
more commonly used in shadow mapping).
The basic steps for forming a shadow volume are:
1. Find all silhouette edges (edges which separate front-facing faces from back-facing faces)
2. Extend all silhouette edges in the direction away from the light-source
3. Add a front-cap and/or back-cap to each surface to form a closed volume (may not be necessary, depending on
the implementation used)
Illustration of shadow volumes. The image above at left shows a scene shadowed using shadow volumes. At right, the shadow volumes are
shown in wireframe. Note how the shadows form a large conical area pointing away from the light source (the bright white point).
189
Shadow volume
Depth pass
Heidmann proposed that if the front surfaces and back surfaces of the shadows were rendered in separate passes, the
number of front faces and back faces in front of an object can be counted using the stencil buffer. If an object's
surface is in shadow, there will be more front facing shadow surfaces between it and the eye than back facing
shadow surfaces. If their numbers are equal, however, the surface of the object is not in shadow. The generation of
the stencil mask works as follows:
1.
2.
3.
4.
5.
6.
7.
After this is accomplished, all lit surfaces will correspond to a 0 in the stencil buffer, where the numbers of front and
back surfaces of all shadow volumes between the eye and that surface are equal.
This approach has problems when the eye itself is inside a shadow volume (for example, when the light source
moves behind an object). From this point of view, the eye sees the back face of this shadow volume before anything
else, and this adds a 1 bias to the entire stencil buffer, effectively inverting the shadows. This can be remedied by
adding a "cap" surface to the front of the shadow volume facing the eye, such as at the front clipping plane. There is
another situation where the eye may be in the shadow of a volume cast by an object behind the camera, which also
has to be capped somehow to prevent a similar problem. In most common implementations, because properly
capping for depth-pass can be difficult to accomplish, the depth-fail method (see below) may be licensed for these
special situations. Alternatively one can give the stencil buffer a +1 bias for every shadow volume the camera is
inside, though doing the detection can be slow.
There is another potential problem if the stencil buffer does not have enough bits to accommodate the number of
shadows visible between the eye and the object surface, because it uses saturation arithmetic. (If they used arithmetic
overflow instead, the problem would be insignificant.)
Depth pass testing is also known as z-pass testing, as the depth buffer is often referred to as the z-buffer.
Depth fail
Around the year 2000, several people discovered that Heidmann's method can be made to work for all camera
positions by reversing the depth. Instead of counting the shadow surfaces in front of the object's surface, the surfaces
behind it can be counted just as easily, with the same end result. This solves the problem of the eye being in shadow,
since shadow volumes between the eye and the object are not counted, but introduces the condition that the rear end
of the shadow volume must be capped, or shadows will end up missing where the volume points backward to
infinity.
1.
2.
3.
4.
5.
6.
7.
The depth fail method has the same considerations regarding the stencil buffer's precision as the depth pass method.
Also, similar to depth pass, it is sometimes referred to as the z-fail method.
190
Shadow volume
William Bilodeau and Michael Songy discovered this technique in October 1998, and presented the technique at
Creativity, a Creative Labs developer's conference, in 1999. Sim Dietrich presented this technique at both GDC in
March 1999, and at Creativity in late 1999. A few months later, William Bilodeau and Michael Songy filed a US
patent application for the technique the same year, US 6384822 [2], entitled "Method for rendering shadows using a
shadow volume and a stencil buffer" issued in 2002. John Carmack of id Software independently discovered the
algorithm in 2000 during the development of Doom 3. Since he advertised the technique to the larger public, it is
often known as Carmack's Reverse.
Exclusive-or
Either of the above types may be approximated with an exclusive-or variation, which does not deal properly with
intersecting shadow volumes, but saves one rendering pass (if not fill time), and only requires a 1-bit stencil buffer.
The following steps are for the depth pass version:
1. Disable writes to the depth and color buffers.
2. Set the stencil operation to XOR on depth pass (flip on any shadow surface).
3. Render the shadow volumes.
Optimization
One method of speeding up the shadow volume geometry calculations is to utilize existing parts of the rendering
pipeline to do some of the calculation. For instance, by using homogeneous coordinates, the w-coordinate may be
set to zero to extend a point to infinity. This should be accompanied by a viewing frustum that has a far clipping
plane that extends to infinity in order to accommodate those points, accomplished by using a specialized
projection matrix. This technique reduces the accuracy of the depth buffer slightly, but the difference is usually
negligible. See 2002 paper Practical and Robust Stenciled Shadow Volumes for Hardware-Accelerated
Rendering [3], C. Everitt and M. Kilgard, for a detailed implementation.
Rasterization time of the shadow volumes can be reduced by using an in-hardware scissor test to limit the
shadows to a specific onscreen rectangle.
NVIDIA has implemented a hardware capability called the depth bounds test [4] that is designed to remove parts
of shadow volumes that do not affect the visible scene. (This has been available since the GeForce FX 5900
model.) A discussion of this capability and its use with shadow volumes was presented at the Game Developers
Conference in 2005.
Since the depth-fail method only offers an advantage over depth-pass in the special case where the eye is within a
shadow volume, it is preferable to check for this case, and use depth-pass wherever possible. This avoids both the
unnecessary back-capping (and the associated rasterization) for cases where depth-fail is unnecessary, as well as
the problem of appropriately front-capping for special cases of depth-pass.
On more recent GPU pipelines, geometry shaders can be used to generate the shadow volumes.[5]
191
Shadow volume
References
[1]
[2]
[3]
[4]
[5]
Crow, Franklin C: "Shadow Algorithms for Computer Graphics", Computer Graphics (SIGGRAPH '77 Proceedings), vol. 11, no. 2, 242-248.
http:/ / worldwide. espacenet. com/ textdoc?DB=EPODOC& IDX=US6384822
http:/ / arxiv. org/ abs/ cs/ 0301002
http:/ / www. opengl. org/ registry/ specs/ EXT/ depth_bounds_test. txt
http:/ / web. archive. org/ web/ 20110516024500/ http:/ / developer. nvidia. com/ node/ 168
External links
The Theory of Stencil Shadow Volumes (http://www.gamedev.net/page/resources/_/technical/
graphics-programming-and-theory/the-theory-of-stencil-shadow-volumes-r1873)
The Mechanics of Robust Stencil Shadows (http://www.gamasutra.com/view/feature/2942/
the_mechanics_of_robust_stencil_.php)
An Introduction to Stencil Shadow Volumes (http://www.devmaster.net/articles/shadow_volumes)
Shadow Mapping and Shadow Volumes (http://www.devmaster.net/articles/shadow_techniques)
Stenciled Shadow Volumes in OpenGL (http://joshbeam.com/articles/stenciled_shadow_volumes_in_opengl/)
Volume shadow tutorial (http://web.archive.org/web/20110514001245/http://www.gamedev.net/reference/
articles/article2036.asp)
Fast shadow volumes (http://web.archive.org/web/20110515182521/http://developer.nvidia.com/object/
fast_shadow_volumes.html) at NVIDIA
Robust shadow volumes (http://developer.nvidia.com/object/robust_shadow_volumes.html) at NVIDIA
Advanced Stencil Shadow and Penumbral Wedge Rendering (http://www.terathon.com/gdc_lengyel.
ppt)Wikipedia:Link rot
192
Silhouette edge
Silhouette edge
In computer graphics, a silhouette edge on a 3D body projected onto a 2D plane (display plane) is the collection of
points whose outwards surface normal is perpendicular to the view vector. Due to discontinuities in the surface
normal, a silhouette edge is also an edge which separates a front facing face from a back facing face. Without loss of
generality, this edge is usually chosen to be the closest one on a face, so that in parallel view this edge corresponds to
the same one in a perspective view. Hence, if there is an edge between a front facing face and a side facing face, and
another edge between a side facing face and back facing face, the closer one is chosen. The easy example is looking
at a cube in the direction where the face normal is collinear with the view vector.
The first type of silhouette edge is sometimes troublesome to handle because it does not necessarily correspond to a
physical edge in the CAD model. The reason that this can be an issue is that a programmer might corrupt the original
model by introducing the new silhouette edge into the problem. Also, given that the edge strongly depends upon the
orientation of the model and view vector, this can introduce numerical instabilities into the algorithm (such as when
a trick like dilution of precision is considered).
Computation
To determine the silhouette edge of an object, we first have to know the plane equation of all faces. Then, by
examining the sign of the point-plane distance from the light-source to each face
Using this result, we can determine if the face is front- or back facing.
The silhouette edge(s) consist of all edges separating a front facing face from a back facing face.
Similar Technique
A convenient and practical implementation of front/back facing detection is to use the unit normal of the plane
(which is commonly precomputed for lighting effects anyway), then simply applying the dot product of the light
position to the plane's unit normal and adding the D component of the plane equation (a scalar value):
Where plane_D is easily calculated as a point on the plane dot product with the unit normal of the plane:
Note: The homogeneous coordinates, L_w and d, are not always needed for this computation.
After doing this calculation, you may notice indicator is actually the signed distance from the plane to the light
position. This distance indicator will be negative if it is behind the face, and positive if it is in front of the face.
This is also the technique used in the 2002 SIGGRAPH paper, "Practical and Robust Stenciled Shadow Volumes for
Hardware-Accelerated Rendering"
193
Silhouette edge
External links
http://wheger.tripod.com/vhl/vhl.htm
Spectral rendering
In Computer Graphics, spectral rendering is where a scene's light transport is modeled considering the whole span
of wavelengths instead of R,G,B values (still relating on geometric optic, which ignore wave phase). The motivation
is that real colors of the physical world are spectrum; trichromatic colors are only inherent to Human Visual System.
Many phenomenons are poorly represented through trichromy:
A "green" light can have a spectrum with a peak in green, or peaks at yellow and blue. Indeed, plainty of different
spectrums are perceived equivalent.
Similarly for a transparent sheet filtering white light into "green".
Similarly for a surface coat which reflect white light into "green".
Still, the reflection and filtering of the light is wavelength-wise.
Similarly for a series of filters, or for multiple scattering in a transparent volume, or for multiple reflections
between coated surfaces. Thick layers of colored volumes as well as accumulated reflection at the corner or two
bright coated walls tend to "purify" the material spectrum to its peaks since it is a power law of the base spectrum
with the number of bounces. Thus, how "green" fluids or walls should looks like in this conditions is
undetermined without spectrum.
The refractive index is wavelength-dependant, which means that white rays are decomposed into rays going in
different directions depending of the wavelength. Getting a rainbow caustic or arc requests managing
wavelengths.
As an example, certain properties of tomatoes make them appear differently under sunlight than under fluorescent
light. Using the blackbody radiation equations to simulate sunlight or the emission spectrum of a fluorescent bulb in
combination with the tomato's spectral reflectance curve, more accurate images of each scenario can be produced.
Chlorophyll, paint pigments, some bricks, are often strongly wavelength-dependent. Besides "temperature color" of
incandescent light, LED, fluorescent and fluo-compact lights have "pathologic" spectrums made of isolated peaks
which thus interact very differently than sun light with matter color. Thus the importance of accurate simulation for
architectural, museographic or even night-driving simulation.
Some specific aspects can be dealt with using local evaluations (local light-material interaction), approximations or
interpolations (.e.g, refraction). Still, the base method consist in replacing the triple R,G,B by a given larger
sampling of frequencies, or by random chose of photon wavelengths. This process is thus a lot slower than classical
trichromic rendering. Spectral rendering is often used in ray tracing or photon mapping to more accurately simulate
the scene with demanding coat material and lighting characteristics, often for comparison with an actual photograph
to test the rendering algorithm (as in a Cornell Box) or to simulate different portions of the electromagnetic spectrum
for the purpose of scientific work.
194
Spectral rendering
Implementations
For example, Arion,[1] FluidRay[2] fryrender,[3] Indigo Renderer,[4] LuxRender,[5] mental ray,[6] Mitsuba,[7] Octane
Render,[8] Spectral Studio,[9] Thea Render[10] and Ocean[11] describe themselves as spectral renderers.
References
[1] http:/ / www. randomcontrol. com/ arion-tech-specs
[2] http:/ / www. fluidray. com/ features
[3] http:/ / www. randomcontrol. com/ fryrender-tech-specs
[4] http:/ / www. indigorenderer. com/ features/ technical
[5] http:/ / www. luxrender. net/ wiki/ Features#Physically_based. 2C_spectral_rendering
[6] http:/ / www. mentalimages. com/ products/ mental-ray/ about-mental-ray/ features. html
[7] http:/ / www. mitsuba-renderer. org/ index. html
[8] http:/ / render. otoy. com/ features. php
[9] http:/ / www. spectralpixel. com/ index. php/ features
[10] http:/ / www. thearender. com/ cms/ index. php/ features/ tech-tour/ 37. html
[11] http:/ / www. eclat-digital. com/ spectral-rendering/
External links
Cornell Box photo comparison (http://www.graphics.cornell.edu/online/box/compare.html)
Specular highlight
A specular highlight is the bright spot of light that appears on shiny
objects when illuminated (for example, see image at right). Specular
highlights are important in 3D computer graphics, as they provide a
strong visual cue for the shape of an object and its location with respect
to light sources in the scene.
Microfacets
The term specular means that light is perfectly reflected in a
mirror-like way from the light source to the viewer. Specular reflection
is visible only where the surface normal is oriented precisely halfway
between the direction of incoming light and the direction of the viewer;
Specular highlights on a pair of spheres.
this is called the half-angle direction because it bisects (divides into
halves) the angle between the incoming light and the viewer. Thus, a
specularly reflecting surface would show a specular highlight as the perfectly sharp reflected image of a light source.
However, many shiny objects show blurred specular highlights.
This can be explained by the existence of microfacets. We assume that surfaces that are not perfectly smooth are
composed of many very tiny facets, each of which is a perfect specular reflector. These microfacets have normals
that are distributed about the normal of the approximating smooth surface. The degree to which microfacet normals
differ from the smooth surface normal is determined by the roughness of the surface. At points on the object where
the smooth normal is close to the half-angle direction, many of the microfacets point in the half-angle direction and
so the specular highlight is bright. As one moves away from the center of the highlight, the smooth normal and the
half-angle direction get farther apart; the number of microfacets oriented in the half-angle direction falls, and so the
intensity of the highlight falls off to zero.
195
Specular highlight
196
The specular highlight often reflects the color of the light source, not the color of the reflecting object. This is
because many materials have a thin layer of clear material above the surface of the pigmented material. For example
plastic is made up of tiny beads of color suspended in a clear polymer and human skin often has a thin layer of oil or
sweat above the pigmented cells. Such materials will show specular highlights in which all parts of the color
spectrum are reflected equally. On metallic materials such as gold the color of the specular highlight will reflect the
color of the material.
Models of microfacets
A number of different models exist to predict the distribution of microfacets. Most assume that the microfacet
normals are distributed evenly around the normal; these models are called isotropic. If microfacets are distributed
with a preference for a certain direction along the surface, the distribution is anisotropic.
NOTE: In most equations, when it says
it means
Phong distribution
In the Phong reflection model, the intensity of the specular highlight is calculated as:
Where R is the mirror reflection of the light vector off the surface, and V is the viewpoint vector.
In the BlinnPhong shading model, the intensity of a specular highlight is calculated as:
Where N is the smooth surface normal and H is the half-angle direction (the direction vector midway between L, the
vector to the light, and V, the viewpoint vector).
The number n is called the Phong exponent, and is a user-chosen value that controls the apparent smoothness of the
surface. These equations imply that the distribution of microfacet normals is an approximately Gaussian distribution
(for large ), or approximately Pearson type II distribution, of the corresponding angle.[1] While this is a useful
heuristic and produces believable results, it is not a physically based model.
Another similar formula, but only calculated differently:
where R is an eye reflection vector, E is an eye vector (view vector), N is surface normal vector. All vectors
are
normalized
(
).
L
is
a
light
vector.
For
example,
then:
If
then
vector
is
normalized
Specular highlight
197
Gaussian distribution
A slightly better model of microfacet distribution can be created using a Gaussian distribution.[citation
usual function calculates specular highlight intensity as:
needed]
The
where m is a constant between 0 and 1 that controls the apparent smoothness of the surface.[2]
Beckmann distribution
A physically based model of microfacet distribution is the Beckmann distribution:[3]
where m is the rms slope of the surface microfacets (the roughness of the material).[4] Compare to the empirical
models above, this function "gives the absolute magnitude of the reflectance without introducing arbitrary constants;
the disadvantage is that it requires more computation". However, this model can be simplified since
. Also note that the product of
where n is the anisotropic exponent, V is the viewing direction, L is the direction of incoming light, and T is the
direction parallel to the grooves or fibers at this point on the surface. If you have a unit vector D which specifies the
global direction of the anisotropic distribution, you can compute the vector T at a given point by the following:
where N is the unit normal vector at that point on the surface. You can also easily compute the cosine of the angle
between the vectors by using a property of the dot product and the sine of the angle by using the trigonometric
identities.
The anisotropic
The specular term is zero if NL < 0 or NR < 0. All vectors are unit vectors. The vector R is the mirror reflection of
the light vector off the surface, L is the direction from the surface point to the light, H is the half-angle direction, N is
Specular highlight
198
the surface normal, and X and Y are two orthogonal vectors in the normal plane which specify the anisotropic
directions.
CookTorrance model
The CookTorrance model[] uses a specular term of the form
.
Here D is the Beckmann distribution factor as above and F is the Fresnel term,
For performance reasons in real-time 3D graphics Schlick's approximation is often used to approximate Fresnel term.
G is the geometric attenuation term, describing selfshadowing due to the microfacets, and is of the form
.
In these formulas E is the vector to the camera or eye, H is the half-angle vector, L is the vector to the light source
and N is the normal vector, and is the angle between H and N.
References
[1] Richard Lyon, "Phong Shading Reformulation for Hardware Renderer Simplification", Apple Technical Report #43, Apple Computer, Inc.
1993 PDF (http:/ / dicklyon. com/ tech/ Graphics/ Phong_TR-Lyon. pdf)
[2] Glassner, Andrew S. (ed). An Introduction to Ray Tracing. San Diego: Academic Press Ltd, 1989. p. 148.
[3] Petr Beckmann, Andr Spizzichino, The scattering of electromagnetic waves from rough surfaces, Pergamon Press, 1963, 503 pp
(Republished by Artech House, 1987, ISBN 978-0-89006-238-8).
[4] Foley et al. Computer Graphics: Principles and Practice. Menlo Park: Addison-Wesley, 1997. p. 764.
[5] http:/ / radsite. lbl. gov/ radiance/ papers/
Specularity
199
Specularity
Specularity is the visual appearance of specular reflections. In
computer graphics, it means the quantity used in three-dimensional
(3D) rendering which represents the amount of specular reflectivity a
surface has. It is a key component in determining the brightness of
specular highlights, along with shininess to determine the size of the
highlights.
It is frequently used in real-time computer graphics where the
mirror-like specular reflection of light from other surfaces is often
ignored (due to the more intensive computations required to calculate
it), and the specular reflection of light directly from point light sources
is modelled as specular highlights.
Specular highlights on a pair of spheres
References
Sphere mapping
In computer graphics, sphere mapping (or spherical environment mapping) is a type of reflection mapping that
approximates reflective surfaces by considering the environment to be an infinitely far-away spherical wall. This
environment is stored as a texture depicting what a mirrored sphere would look like if it were placed into the
environment, using an orthographic projection (as opposed to one with perspective). This texture contains reflective
data for the entire environment, except for the spot directly behind the sphere. (For one example of such an object,
see Escher's drawing Hand with Reflecting Sphere.)
To use this data, the surface normal of the object, view direction from the object to the camera, and/or reflected
direction from the object to the environment is used to calculate a texture coordinate to look up in the
aforementioned texture map. The result appears like the environment is reflected in the surface of the object that is
being rendered.
Usage example
In the simplest case for generating texture coordinates, suppose:
The map has been created as above, looking at the sphere along the z-axis.
The texture coordinate of the center of the map is (0,0), and the sphere's image has radius 1.
We are rendering an image in the same exact situation as the sphere, but the sphere has been replaced with a
reflective object.
The image being created is orthographic, or the viewer is infinitely far away, so that the view direction does not
change as one moves across the image.
At texture coordinate
(where z is
normal for which we need to produce a texture map coordinate). So the texture coordinate corresponding to normal
is
.
Stencil buffer
200
Stencil buffer
A stencil buffer is an extra buffer, in addition to the
color buffer (pixel buffer) and depth buffer
(z-buffering) found on modern graphics hardware. The
buffer is per pixel, and works on integer values, usually
with a depth of one byte per pixel. The depth buffer and
stencil buffer often share the same area in the RAM of
the graphics hardware.
In the simplest case, the stencil buffer is used to limit
the area of rendering (stenciling). More advanced usage
of the stencil buffer makes use of the strong connection
between the depth buffer and the stencil buffer in the
rendering pipeline. For example, stencil values can be
automatically increased/decreased for every pixel that
fails or passes the depth test.
OpenGL
glEnable(GL_STENCIL_TEST); // by default not enabled
glStencilMask(stencilMask); // allow writing to stencil buffer, by
default (0xFF) no mask.
glClearStencil(clearStencilValue); // clear stencil value, by default =
0
glStencilFunc(func, ref, mask); // by default GL_ALWAYS, 0, 0xFF,
always pass stencil test
glStencilOp(fail,zfail,zpass); // by default GL_KEEP, GL_KEEP, GL_KEEP,
dont change stencil buffer
glClear(GL_STENCIL_BUFFER_BIT); // clear stencil buffer, fill with
(clearStencilValue & stencilMask)
Test: ( ref & mask ) func (stencilValue & mask)
Depending on the three possible conditions of stencil function/depth function.
1. Stencil Test Function fails:
If say func is GL_NEVER, the stencil test will always fail.
Neither Color/Depth buffers are modified. Stencil buffer is modified as per glStencilOp fail.
If say glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP) then GL_REPLACE takes place and
Stencil buffer
stencilValue = (ref & stencilMask) // will become ref
Typically Stencil buffer is initialized by setting depth buffer and color buffer masks to false. and then setting
appropriate ref value to stencil buffer by failing the stencil test every time.
// disable color and depth buffers
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthMask(GL_FALSE);
glStencilFunc(GL_NEVER, 1, 0xFF); // never pass stencil test
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP); // replace stencil buffer
values to ref=1
glStencilMask(0xFF); // stencil buffer free to write
glClear(GL_STENCIL_BUFFER_BIT); // first clear stencil buffer by
writing default stencil value (0) to all of stencil buffer.
draw_stencil_shape(); // at stencil shape pixel locations in stencil
buffer replace stencil buffer values to ref = 1
Now use the initialized stencil buffer and stencil test to write only in the locations where stencil value is 1
// enable color and depth buffers.
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthMask(GL_TRUE);
// no more modifying of stencil buffer on stencil and depth pass.
glStencilMask(0x00);
// can also be achieved by glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
// stencil test: only pass stencil test at stencilValue == 1
(Assuming depth test would pass.) and write actual content to depth and
color buffer only at stencil shape locations.
glStencilFunc(GL_EQUAL, 1, 0xFF);
draw_actual_content();
201
Stencil codes
202
Stencil codes
Stencil codes are a class of iterative kernels[1] which update array
elements according to some fixed pattern, called stencil.[2] They are
most commonly found in the codes of computer simulations, e.g. for
computational fluid dynamics in the context of scientific and
engineering applications. Other notable examples include solving
partial differential equations, the Jacobi kernel, the GaussSeidel
method, image processing and cellular automata.[3] The regular
structure of the arrays sets stencil codes apart from other modeling
methods such as the Finite element method. Most finite difference
codes which operate on regular grids can be formulated as stencil
codes.
Definition
stencil.
Stencil codes perform a sequence of sweeps (called timesteps) through
a given array. Generally this is a 2- or 3-dimensional regular grid. The
elements of the arrays are often referred to as cells. In each timestep, the stencil code updates all array elements.
Using neighboring array elements in a fixed pattern (called the stencil), each cell's new value is computed. In most
cases boundary values are left unchanged, but in some cases (e.g. LBM codes) those need to be adjusted during the
course of the computation as well. Since the stencil is the same for each element, the pattern of data accesses is
repeated.[4]
is the stencil itself and describes the actual shape of the neighborhood. (There are
elements in the
stencil.
is the transition function which is used to determine a cell's new state, depending on its neighbors.
Since I is a k-dimensional integer interval, the array will always have the topology of a finite regular grid. The array
is also called simulation space and individual cells are identified by their index
. The stencil is an ordered set
of
, where
is
defined as follows:
This is all we need to define the system's state for the following time steps
with
Stencil codes
Note that
elements of
203
is defined on
may be defined by a vector addition modulo the simulation space's dimension to realize toroidal
topologies:
This may be useful for implementing periodic boundary conditions, which simplifies certain physical models.
Stencil codes
2D Jacobi Iteration on a
204
Array
Stencils
The shape of the neighborhood used during the updates depends on the application itself. The most common stencils
are the 2D or 3D versions of the von Neumann neighborhood and Moore neighborhood. The example above uses a
2D von Neumann stencil while LBM codes generally use its 3D variant. Conway's Game of Life uses the 2D Moore
neighborhood. That said, other stencils such as a 25-point stencil for seismic wave propagation[5] can be found, too.
9-point 2D stencil
5-point 2D stencil
6-point 3D stencil
Stencil codes
25-point 3D stencil
A selection of stencils used in various scientific applications.
Implementation issues
Many simulation codes may be formulated naturally as stencil codes. Since computing time and memory
consumption grow linearly with the number of array elements, parallel implementations of stencil codes are of
paramount importance to research.[6] This is challenging since the computations are tightly coupled (because of the
cell updates depending on neighboring cells) and most stencil codes are memory bound (i.e. the ratio of memory
accesses to calculations is high).[7] Virtually all current parallel architectures have been explored for executing
stencil codes efficiently;[8] at the moment GPGPUs have proven to be most efficient.[9]
Libraries
Due to both, the importance of stencil codes to computer simulations and their high computational requirements,
there are a number of efforts which aim at creating reusable libraries to support scientists in implementing new
stencil codes. The libraries are mostly concerned with the parallelization, but may also tackle other challenges, such
as IO, steering and checkpointing. They may be classified by their API.
Patch-based libraries
This is a traditional design. The library manages a set of n-dimensional scalar arrays, which the user code may access
to perform updates. The library handles the synchronization of the boundaries (dubbed ghost zone or halo). The
advantage of this interface is that the user code may loop over the arrays, which makes it easy to integrate legacy
codes[10] . The disadvantage is that the library can not handle cache blocking (as this has to be done within the
loops[11]) or wrapping of the code for accelerators (e.g. via CUDA or OpenCL). Notable implementations include
Cactus [12], a physics problem solving environment, and waLBerla [13].
Cell-based libraries
These libraries move the interface to updating single simulation cells: only the current cell and its neighbors are
exposed to the user code, e.g. via getter/setter methods. The advantage of this approach is that the library can control
tightly which cells are updated in which order, which is useful not only to implement cache blocking, but also to run
the same code on multi-cores and GPUs.[14] This approach requires the user to recompile his source code together
with the library. Otherwise a function call for every cell update would be required, which would seriously impair
performance. This is only feasible with techniques such as class templates or metaprogramming, which is also the
reason why this design is only found in newer libraries. Examples are Physis [15] and LibGeoDecomp [16].
205
Stencil codes
References
[1] Roth, Gerald et al. (1997) Proceedings of SC'97: High Performance Networking and Computing. Compiling Stencils in High Performance
Fortran. (http:/ / citeseer. ist. psu. edu/ viewdoc/ summary?doi=10. 1. 1. 53. 1505)
[2] Sloot, Peter M.A. et al. (May 28, 2002) Computational Science ICCS 2002: International Conference, Amsterdam, The Netherlands, April
2124, 2002. Proceedings, Part I. (http:/ / books. google. com/ books?id=qVcLw1UAFUsC& pg=PA843& dq=stencil+ array&
sig=g3gYXncOThX56TUBfHE7hnlSxJg#PPA843,M1) Page 843. Publisher: Springer. ISBN 3-540-43591-3.
[3] Fey, Dietmar et al. (2010) Grid-Computing: Eine Basistechnologie fr Computational Science (http:/ / books. google. com/
books?id=RJRZJHVyQ4EC& pg=PA51& dq=fey+ grid& hl=de& ei=uGk8TtDAAo_zsgbEoZGpBQ& sa=X& oi=book_result& ct=result&
resnum=1& ved=0CCoQ6AEwAA#v=onepage& q& f=true).
External links
Physis (https://github.com/naoyam/physis)
LibGeoDecomp (http://www.libgeodecomp.org)
206
Subdivision surface
207
Subdivision surface
A subdivision surface, in the field of 3D computer graphics, is a method of representing a smooth surface via the
specification of a coarser piecewise linear polygon mesh. The smooth surface can be calculated from the coarse mesh
as the limit of a recursive process of subdividing each polygonal face into smaller faces that better approximate the
smooth surface.
Overview
Subdivision surfaces are defined recursively. The process starts with a
given polygonal mesh. A refinement scheme is then applied to this
mesh. This process takes that mesh and subdivides it, creating new
vertices and new faces. The positions of the new vertices in the mesh
are computed based on the positions of nearby old vertices. In some
refinement schemes, the positions of old vertices might also be altered
(possibly based on the positions of new vertices).
This process produces a denser mesh than the original one, containing
more polygonal faces. This resulting mesh can be passed through the
same refinement scheme again and so on.
The limit subdivision surface is the surface produced from this process
being iteratively applied infinitely many times. In practical use
however, this algorithm is only applied a limited number of times. The
limit surface can also be calculated directly for most subdivision
surfaces using the technique of Jos Stam, which eliminates the need for
recursive refinement. Subdivision surfaces and T-Splines are
competing technologies. Mathematically, subdivision surfaces are
spline surfaces with singularities.
Refinement schemes
Subdivision surface refinement schemes can be broadly classified into two categories: interpolating and
approximating. Interpolating schemes are required to match the original position of vertices in the original mesh.
Approximating schemes are not; they can and will adjust these positions as needed. In general, approximating
schemes have greater smoothness, but editing applications that allow users to set exact surface constraints require an
optimization step. This is analogous to spline surfaces and curves, where Bzier splines are required to interpolate
certain control points (namely the two end-points), while B-splines are not.
There is another division in subdivision surface schemes as well, the type of polygon that they operate on. Some
function for quadrilaterals (quads), while others operate on triangles.
Subdivision surface
Approximating schemes
Approximating means that the limit surfaces approximate the initial meshes and that after subdivision, the newly
generated control points are not in the limit surfaces. Examples of approximating subdivision schemes are:
CatmullClark (1978) generalized bi-cubic uniform B-spline to produce their subdivision scheme. For arbitrary
initial meshes, this scheme generates limit surfaces that are C2 continuous everywhere except at extraordinary
vertices where they are C1 continuous (Peters and Reif 1998).
DooSabin - The second subdivision scheme was developed by Doo and Sabin (1978) who successfully extended
Chaikin's corner-cutting method for curves to surfaces. They used the analytical expression of bi-quadratic
uniform B-spline surface to generate their subdivision procedure to produce C1 limit surfaces with arbitrary
topology for arbitrary initial meshes.
Loop, Triangles - Loop (1987) proposed his subdivision scheme based on a quartic box-spline of six direction
vectors to provide a rule to generate C2 continuous limit surfaces everywhere except at extraordinary vertices
where they are C1 continuous.
Mid-Edge subdivision scheme - The mid-edge subdivision scheme was proposed independently by PetersReif
(1997) and HabibWarren (1999). The former used the midpoint of each edge to build the new mesh. The latter
used a four-directional box spline to build the scheme. This scheme generates C1 continuous limit surfaces on
initial meshes with arbitrary topology.
3 subdivision scheme - This scheme has been developed by Kobbelt (2000): it handles arbitrary triangular
meshes, it is C2 continuous everywhere except at extraordinary vertices where it is C1 continuous and it offers a
natural adaptive refinement when required. It exhibits at least two specificities: it is a Dual scheme for triangle
meshes and it has a slower refinement rate than primal ones.
Interpolating schemes
After subdivision, the control points of the original mesh and the new generated control points are interpolated on the
limit surface. The earliest work was the butterfly scheme by Dyn, Levin and Gregory (1990), who extended the
four-point interpolatory subdivision scheme for curves to a subdivision scheme for surface. Zorin, Schrder and
Sweldens (1996) noticed that the butterfly scheme cannot generate smooth surfaces for irregular triangle meshes and
thus modified this scheme. Kobbelt (1996) further generalized the four-point interpolatory subdivision scheme for
curves to the tensor product subdivision scheme for surfaces.
Butterfly, Triangles - named after the scheme's shape
Midedge, Quads
Kobbelt, Quads - a variational subdivision method that tries to overcome uniform subdivision drawbacks
208
Subdivision surface
Key developments
1978: Subdivision surfaces were discovered simultaneously by Edwin Catmull and Jim Clark (see CatmullClark
subdivision surface). In the same year, Daniel Doo and Malcom Sabin published a paper building on this work
(see DooSabin subdivision surface.)
1995: Ulrich Reif characterized subdivision surfaces near extraordinary vertices by treating them as splines with
singularities.
1998: Jos Stam contributed a method for exact evaluation for CatmullClark and Loop subdivision surfaces under
arbitrary parameter values.[3]
References
Peters, J.; Reif, U. (October 1997). "The simplest subdivision scheme for smoothing polyhedra". ACM
Transactions on Graphics 16 (4): 420431. doi: 10.1145/263834.263851 (http://dx.doi.org/10.1145/263834.
263851).
Habib, A.; Warren, J. (May 1999). "Edge and vertex insertion for a class C1 of subdivision surfaces". Computer
Aided Geometric Design 16 (4): 223247. doi: 10.1016/S0167-8396(98)00045-4 (http://dx.doi.org/10.1016/
S0167-8396(98)00045-4).
Kobbelt, L. (2000). "3-subdivision". Proceedings of the 27th annual conference on Computer graphics and
interactive techniques - SIGGRAPH '00. pp.103112. doi: 10.1145/344779.344835 (http://dx.doi.org/10.
1145/344779.344835). ISBN1-58113-208-5.
External links
Resources about Subdvisions (http://www.subdivision.org)
Geri's Game (http://www.pixar.com/shorts/gg/theater/index.html) : Oscar winning animation by Pixar
completed in 1997 that introduced subdivision surfaces (along with cloth simulation)
Subdivision for Modeling and Animation (http://www.multires.caltech.edu/pubs/sig99notes.pdf) tutorial,
SIGGRAPH 1999 course notes
Subdivision for Modeling and Animation (http://www.mrl.nyu.edu/dzorin/sig00course/) tutorial,
SIGGRAPH 2000 course notes
Subdivision of Surface and Volumetric Meshes (http://www.hakenberg.de/subdivision/ultimate_consumer.
htm), software to perform subdivision using the most popular schemes
Surface Subdivision Methods in CGAL, the Computational Geometry Algorithms Library (http://www.cgal.
org/Pkg/SurfaceSubdivisionMethods3)
Surface and Volumetric Subdivision Meshes, hierarchical/multiresolution data structures in CGoGN (http://
cgogn.unistra.fr)
Modified Butterfly method implementation in C++ (https://bitbucket.org/rukletsov/b)
209
Subsurface scattering
210
Subsurface scattering
Subsurface scattering (or SSS), also
known as subsurface light transport
(SSLT),[1] is a mechanism of light
transport in which light penetrates the
surface of a translucent object, is
scattered by interacting with the
material, and exits the surface at a
different point. The light will generally
penetrate the surface and be reflected a
number of times at irregular angles
inside the material, before passing
back out of the material at an angle
other than the angle it would have if it
had been reflected directly off the
surface. Subsurface scattering is
important in 3D computer graphics,
being necessary for the realistic
rendering of materials such as marble,
skin, leaves, wax and milk.
Direct surface scattering (left), plus subsurface scattering (middle), create the final
image on the right.
Rendering Techniques
Most materials used in real-time
Example of Subsurface scattering made in
Blender software.
computer graphics today only account
for the interaction of light at the
surface of an object. In reality, many materials are slightly translucent: light enters the surface; is absorbed, scattered
and re-emitted potentially at a different point. Skin is a good case in point; only about 6% of reflectance is direct,
94% is from subsurface scattering. An inherent property of semitransparent materials is absorption. The further
through the material light travels, the greater the proportion absorbed. To simulate this effect, a measure of the
distance the light has traveled through the material must be obtained.
Subsurface scattering
other more traditional lighting models, allows the creation of different materials such as marble, jade and wax.
Potentially, problems can arise if models are not convex, but depth peeling can be used to avoid the issue. Similarly,
depth peeling can be used to account for varying densities beneath the surface, such as bone or muscle, to give a
more accurate scattering model.
As can be seen in the image of the wax head to the right, light isnt diffused when passing through object using this
technique; back features are clearly shown. One solution to this is to take multiple samples at different points on
surface of the depth map. Alternatively, a different approach to approximation can be used, known as texture-space
diffusion.
References
[1] http:/ / wiki. povray. org/ content/ Reference:Finish#Subsurface_Light_Transport
External links
Henrik Wann Jensen's subsurface scattering website (http://graphics.ucsd.edu/~henrik/images/subsurf.html)
An academic paper by Jensen on modeling subsurface scattering (http://graphics.ucsd.edu/~henrik/papers/
bssrdf/)
Maya Tutorial - Subsurface Scattering: Using the Misss_Fast_Simple_Maya shader (http://www.highend3d.
com/maya/tutorials/rendering_lighting/shaders/135.html)
3d Studio Max Tutorial - The definitive guide to using subsurface scattering in 3dsMax (http://www.
mrbluesummers.com/3510/3d-tutorials/3dsmax-mental-ray-sub-surface-scattering-guide/)
211
Surface caching
212
Surface caching
Surface caching is a computer graphics technique pioneered by John Carmack, first used in the computer game
Quake, to apply lightmaps to level geometry. Carmack's technique was to combine lighting information with surface
textures in texture-space when primitives became visible (at the appropriate mipmap level), exploiting temporal
coherence for those calculations. As hardware capable of blended multi-texture rendering (and later pixel shaders)
became more commonplace, the technique became less common, being replaced with screenspace combination of
lightmaps in rendering hardware.
Surface caching contributed greatly to the visual quality of Quake's software rasterized 3D engine on Pentium
microprocessors, which lacked dedicated graphics instructions. [citation needed].
Surface caching could be considered a precursor to the more recent MegaTexture technique in which lighting and
surface decals and other procedural texture effects are combined for rich visuals devoid of unnatural repeating
artifacts.
External links
Quake's Lighting Model: Surface Caching [1] - an in-depth explanation by Michael Abrash
References
[1] http:/ / www. bluesnews. com/ abrash/ chap68. shtml
Texel
A texel, texture element, or texture pixel is the fundamental unit of
texture space,[1] used in computer graphics. Textures are represented
by arrays of texels, just as pictures are represented by arrays of pixels.
Texels can also be described by image regions that are obtained
through a simple procedure such as thresholding. Voronoi tesselation
can be used to define their spatial relationships. This means that a
division is made at the half-way point between the centroid of each
texel and the centroids of every surrounding texel for the entire texture.
The result is that each texel centroid will have a Voronoi polygon
surrounding it. This polygon region consists of all points that are closer
to its texel centroid than any other centroid.[2]
Texel
Rendering texels
When texturing a 3D surface or surfaces (a process known as texture
mapping), the renderer maps texels to appropriate pixels in the output
picture. On modern computers, this operation is accomplished on the
graphics processing unit.
The texturing process starts with a location in space. The location can
be in world space, but typically it is in Model space so that the texture
moves with the model. A projector function is applied to the location to
Two different projector functions.
change the location from a three-element vector to a two-element
vector with values ranging from zero to one (uv).[3] These values are multiplied by the resolution of the texture to
obtain the location of the texel. When a texel is requested that is not on an integer position, texture filtering is
applied.
When a texel is requested that is outside of the texture, one of two techniques is used: clamping or wrapping.
Clamping limits the texel to the texture size, moving it to the nearest edge if it is more than the texture size.
Wrapping moves the texel in increments of the texture's size to bring it back into the texture. Wrapping causes a
texture to be repeated; clamping causes it to be in one spot only.
References
[1] Andrew Glassner, An Introduction to Ray Tracing, San Francisco: MorganKaufmann, 1989
[2] Linda G. Shapiro and George C. Stockman, Computer Vision, Upper Saddle River: PrenticeHall, 2001
[3] Tomas Akenine-Moller, Eric Haines, and Naty Hoffman, Real-Time Rendering, Wellesley: A K Peters, 2008
Texture atlas
In realtime computer graphics, a texture atlas is a large image containing a collection of sub-images, or "atlas"
which contains many smaller sub-images, each of which is a texture for some part of a 3D object. The sub-textures
can be rendered by modifying the texture coordinates of the object's uvmap on the atlas, essentially telling it which
part of the image its texture is in. In an application where many small textures are used frequently, it is often more
efficient to store the textures in a texture atlas which is treated as a single unit by the graphics hardware. In
particular, because there are less rendering state changes by binding once, it can be faster to bind one large texture
once than to bind many smaller textures as they are drawn.
For example, a tile-based game would benefit greatly in performance from a texture atlas.
Atlases can consist of uniformly-sized sub-textures, or they can consist of textures of varying sizes (usually restricted
to powers of two). In the latter case, the program must usually arrange the textures in an efficient manner before
sending the textures to hardware. Manual arrangement of texture atlases is possible, and sometimes preferable, but
can be tedious. If using mipmaps, care must be taken to arrange the textures in such a manner as to avoid sub-images
being "polluted" by their neighbours.
213
Texture atlas
External links
Sprite Sheets - Essential Facts Every Game Developer Should Know [1] - Funny video explaining the benefits of
using sprite sheets
Texture Atlas Whitepaper [2] - A whitepaper by NVIDIA which explains the technique.
TexturePacker [3] - Commercial texture atlas creator for game developers.
Texture Atlas Maker [4] - Open source texture atlas utility for 2D OpenGL games.
Practical Texture Atlases [5] - A guide on using a texture atlas (and the pros and cons).
SpriteMapper [6] - Open source texture atlas (sprite map) utility including an Apache Ant task.
References
[1]
[2]
[3]
[4]
[5]
[6]
Texture filtering
In computer graphics, texture filtering or texture smoothing is the method used to determine the texture color for a
texture mapped pixel, using the colors of nearby texels (pixels of the texture). Mathematically, texture filtering is a
type of anti-aliasing (AA), but it filters out high frequencies from the texture fill whereas other AA techniques
generally focus on visual edges. Put simply, it allows a texture to be applied at many different shapes, sizes and
angles while minimizing blurriness, shimmering and blocking.
There are many methods of texture filtering, which make different trade-offs between computational complexity and
image quality.
214
Texture filtering
Mipmapping
Mipmapping is a standard technique used to save some of the filtering work needed during texture minification.
During texture magnification, the number of texels that need to be looked up for any pixel is always four or fewer;
during minification, however, as the textured polygon moves farther away potentially the entire texture might fall
into a single pixel. This would necessitate reading all of its texels and combining their values to correctly determine
the pixel color, a prohibitively expensive operation. Mipmapping avoids this by prefiltering the texture and storing it
in smaller sizes down to a single pixel. As the textured surface moves farther away, the texture being applied
switches to the prefiltered smaller size. Different sizes of the mipmap are referred to as 'levels', with Level 0 being
the largest size (used closest to the viewer), and increasing levels used at increasing distances.
Filtering methods
This section lists the most common texture filtering methods, in increasing order of computational cost and image
quality.
Nearest-neighbor interpolation
Nearest-neighbor interpolation is the fastest and crudest filtering method it simply uses the color of the texel
closest to the pixel center for the pixel color. While fast, this results in a large number of artifacts - texture
'blockiness' during magnification, and aliasing and shimmering during minification.
Bilinear filtering
Bilinear filtering is the next step up. In this method the four nearest texels to the pixel center are sampled (at the
closest mipmap level), and their colors are combined by weighted average according to distance. This removes the
'blockiness' seen during magnification, as there is now a smooth gradient of color change from one texel to the next,
instead of an abrupt jump as the pixel center crosses the texel boundary. Bilinear filtering is almost invariably used
with mipmapping; though it can be used without, it would suffer the same aliasing and shimmering problems as its
nearest neighbor.
Trilinear filtering
Trilinear filtering is a remedy to a common artifact seen in mipmapped bilinearly filtered images: an abrupt and very
noticeable change in quality at boundaries where the renderer switches from one mipmap level to the next. Trilinear
filtering solves this by doing a texture lookup and bilinear filtering on the two closest mipmap levels (one higher and
one lower quality), and then linearly interpolating the results. This results in a smooth degradation of texture quality
as distance from the viewer increases, rather than a series of sudden drops. Of course, closer than Level 0 there is
only one mipmap level available, and the algorithm reverts to bilinear filtering.
215
Texture filtering
216
Anisotropic filtering
Anisotropic filtering is the highest quality filtering available in current consumer 3D graphics cards. Simpler,
"isotropic" techniques use only square mipmaps which are then interpolated using bi or trilinear filtering. (Isotropic
means same in all directions, and hence is used to describe a system in which all the maps are squares rather than
rectangles or other quadrilaterals.)
When a surface is at a high angle relative to the camera, the fill area for a texture will not be approximately square.
Consider the common case of a floor in a game: the fill area is far wider than it is tall. In this case, none of the square
maps are a good fit. The result is blurriness and/or shimmering, depending on how the fit is chosen. Anisotropic
filtering corrects this by sampling the texture as a non-square shape. Some implementations simply use rectangles
instead of squares, which are a much better fit than the original square and offer a good approximation.
However, going back to the example of the floor, the fill area is not just compressed vertically, there are also more
pixels across the near edge than the far edge. Consequently, more advanced implementations will use trapezoidal
maps for an even better approximation (at the expense of greater processing).
In either rectangular or trapezoidal implementations, the filtering produces a map, which is then bi or trilinearly
filtered, using the same filtering algorithms used to filter the square maps of traditional mipmapping.
Texture mapping
Texture mapping is a method for adding detail, surface texture (a
bitmap or raster image), or color to a computer-generated graphic or
3D model. Its application to 3D graphics was pioneered by Edwin
Catmull in 1974.
Texture mapping
Texture mapping
217
polygons. Multitexturing is the use of more than one texture at a time on a polygon.[2] For instance, a light map
texture may be used to light a surface as an alternative to recalculating that lighting every time the surface is
rendered. Another multitexture technique is bump mapping, which allows a texture to directly control the facing
direction of a surface for the purposes of its lighting calculations; it can give a very good appearance of a complex
surface, such as tree bark or rough concrete, that takes on lighting detail in addition to the usual detailed coloring.
Bump mapping has become popular in recent video games as graphics hardware has become powerful enough to
accommodate it in real-time.
The way the resulting pixels on the screen are calculated from the texels (texture pixels) is governed by texture
filtering. The fastest method is to use the nearest-neighbour interpolation, but bilinear interpolation or trilinear
interpolation between mipmaps are two commonly used alternatives which reduce aliasing or jaggies. In the event of
a texture coordinate being outside the texture, it is either clamped or wrapped.
Perspective correctness
Texture coordinates are specified at
each vertex of a given triangle, and
these coordinates are interpolated
using an extended Bresenham's line
algorithm. If these texture coordinates
are linearly interpolated across the
screen, the result is affine texture
mapping. This is a fast calculation, but
Because affine texture mapping does not take into account the depth information about a
there can be a noticeable discontinuity
polygon's vertices, where the polygon is not perpendicular to the viewer it produces a
noticeable defect.
between adjacent triangles when these
triangles are at an angle to the plane of
the screen (see figure at right textures (the checker boxes) appear bent).
Perspective correct texturing accounts for the vertices' positions in 3D space, rather than simply interpolating a 2D
triangle. This achieves the correct visual effect, but it is slower to calculate. Instead of interpolating the texture
coordinates directly, the coordinates are divided by their depth (relative to the viewer), and the reciprocal of the
depth value is also interpolated and used to recover the perspective-correct coordinate. This correction makes it so
that in parts of the polygon that are closer to the viewer the difference from pixel to pixel between texture
coordinates is smaller (stretching the texture wider), and in parts that are farther away this difference is larger
(compressing the texture).
Affine texture mapping directly interpolates a texture coordinate
and
where
Perspective correct mapping interpolates after dividing by depth
recover the correct coordinate:
Texture mapping
218
Development
Classic texture mappers generally did only simple mapping with at most one lighting effect, and the perspective
correctness was about 16 times more expensive. To achieve two goals - faster arithmetic results, and keeping the
arithmetic mill busy at all times - every triangle is further subdivided into groups of about 16 pixels. For perspective
texture mapping without hardware support, a triangle is broken down into smaller triangles for rendering, which
improves details in non-architectural applications. Software renderers generally preferred screen subdivision because
it has less overhead. Additionally they try to do linear interpolation along a line of pixels to simplify the set-up
(compared to 2d affine interpolation) and thus again the overhead (also affine texture-mapping does not fit into the
low number of registers of the x86 CPU; the 68000 or any RISC is much more suited). For instance, Doom restricted
the world to vertical walls and horizontal floors/ceilings. This meant the walls would be a constant distance along a
vertical line and the floors/ceilings would be a constant distance along a horizontal line. A fast affine mapping could
be used along those lines because it would be correct. A different approach was taken for Quake, which would
calculate perspective correct coordinates only once every 16 pixels of a scanline and linearly interpolate between
them, effectively running at the speed of linear interpolation because the perspective correct calculation runs in
parallel on the co-processor.[3] The polygons are rendered independently, hence it may be possible to switch between
spans and columns or diagonal directions depending on the orientation of the polygon normal to achieve a more
constant z, but the effort seems not to be worth it.
References
[1] Jon Radoff, Anatomy of an MMORPG, http:/ / radoff. com/ blog/ 2008/ 08/ 22/ anatomy-of-an-mmorpg/
[2] Blythe, David. Advanced Graphics Programming Techniques Using OpenGL (http:/ / www. opengl. org/ resources/ code/ samples/ sig99/
advanced99/ notes/ notes. html). Siggraph 1999. (see: Multitexture (http:/ / www. opengl. org/ resources/ code/ samples/ sig99/ advanced99/
notes/ node60. html))
[3] Abrash, Michael. Michael Abrash's Graphics Programming Black Book Special Edition. The Coriolis Group, Scottsdale Arizona, 1997. ISBN
1-57610-174-6 ( PDF (http:/ / www. gamedev. net/ reference/ articles/ article1698. asp)) (Chapter 70, pg. 1282)
Texture mapping
219
External links
Introduction into texture mapping using C and SDL (http://www.happy-werner.de/howtos/isw/parts/3d/
chapter_2/chapter_2_texture_mapping.pdf)
Programming a textured terrain (http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series4/
Textured_terrain.php) using XNA/DirectX, from www.riemers.net
Perspective correct texturing (http://www.gamers.org/dEngine/quake/papers/checker_texmap.html)
Time Texturing (http://www.fawzma.com/time-texturing-texture-mapping-with-bezier-lines/) Texture
mapping with bezier lines
Polynomial Texture Mapping (http://www.hpl.hp.com/research/ptm/) Interactive Relighting for Photos
3 Mtodos de interpolacin a partir de puntos (in spanish) (http://www.um.es/geograf/sigmur/temariohtml/
node43_ct.html) Methods that can be used to interpolate a texture knowing the texture coords at the vertices of a
polygon
Texture synthesis
Texture synthesis is the process of algorithmically constructing a large digital image from a small digital sample
image by taking advantage of its structural content. It is an object of research in computer graphics and is used in
many fields, amongst others digital image editing, 3D computer graphics and post-production of films.
Texture synthesis can be used to fill in holes in images (as in inpainting), create large non-repetitive background
images and expand small pictures. See "SIGGRAPH 2007 course on Example-based Texture Synthesis" [1] for more
details.
Textures
"Texture" is an ambiguous word and in the context of texture synthesis
may have one of the following meanings:
1. In common speech, the word "texture" is used as a synonym for
"surface structure". Texture has been described by five different
properties in the psychology of perception: coarseness, contrast,
directionality, line-likeness and roughness [2].
2. In 3D computer graphics, a texture is a digital image applied to the
surface of a three-dimensional model by texture mapping to give the
model a more realistic appearance. Often, the image is a photograph
of a "real" texture, such as wood grain.
3. In image processing, every digital image composed of repeated elements is called a "texture." For example, see
the images below.
Texture can be arranged along a spectrum going from stochastic to regular:
Stochastic textures. Texture images of stochastic textures look like noise: colour dots that are randomly scattered
over the image, barely specified by the attributes minimum and maximum brightness and average colour. Many
textures look like stochastic textures when viewed from a distance. An example of a stochastic texture is
roughcast.
Structured textures. These textures look like somewhat regular patterns. An example of a structured texture is a
stonewall or a floor tiled with paving stones.
These extremes are connected by a smooth transition, as visualized in the figure below from "Near-regular Texture
Analysis and Manipulation." Yanxi Liu, Wen-Chieh Lin, and James Hays. SIGGRAPH 2004 [3]
Texture synthesis
Goal
Texture synthesis algorithms are intended to create an output image that meets the following requirements:
The output should have the size given by the user.
The output should be as similar as possible to the sample.
The output should not have visible artifacts such as seams, blocks and misfitting edges.
The output should not repeat, i. e. the same structures in the output image should not appear multiple places.
Like most algorithms, texture synthesis should be efficient in computation time and in memory use.
Methods
The following methods and algorithms have been researched or developed for texture synthesis:
Tiling
The simplest way to generate a large image from a sample image is to tile it. This means multiple copies of the
sample are simply copied and pasted side by side. The result is rarely satisfactory. Except in rare cases, there will be
the seams in between the tiles and the image will be highly repetitive.
220
Texture synthesis
Chaos mosaic
This method, proposed by the Microsoft group for internet graphics, is a refined version of tiling and performs the
following three steps:
1. The output image is filled completely by tiling. The result is a repetitive image with visible seams.
2. Randomly selected parts of random size of the sample are copied and pasted randomly onto the output image.
The result is a rather non-repetitive image with visible seams.
3. The output image is filtered to smooth edges.
The result is an acceptable texture image, which is not too repetitive and does not contain too many artifacts. Still,
this method is unsatisfactory because the smoothing in step 3 makes the output image look blurred.
221
Texture synthesis
Chemistry based
Realistic textures can be generated by simulations of complex chemical reactions within fluids, namely
Reaction-diffusion systems. It is believed that these systems show behaviors which are qualitatively equivalent to
real processes (Morphogenesis) found in the nature, such as animal markings (shells, fish, wild cats...).
Implementations
Some texture synthesis implementations exist as plug-ins for the free image editor Gimp:
Texturize [10]
Resynthesizer [11]
A pixel-based texture synthesis implementation:
Parallel Controllable Texture Synthesis [12]
Patch-based texture synthesis:
KUVA: Graphcut textures [13]
Literature
Several of the earliest and most referenced papers in this field include:
Popat [14] in 1993 - "Novel cluster-based probability model for texture synthesis, classification, and compression".
Heeger-Bergen [15] in 1995 - "Pyramid based texture analysis/synthesis".
Paget-Longstaff [16] in 1998 - "Texture synthesis via a noncausal nonparametric multiscale Markov random field"
Efros-Leung [17] in 1999 - "Texture Synthesis by Non-parameteric Sampling".
Wei-Levoy [6] in 2000 - "Fast Texture Synthesis using Tree-structured Vector Quantization"
External links
Micro-texture synthesis by phase randomization, with code and online demonstration [26]
222
Texture synthesis
References
[1] http:/ / www. cs. unc. edu/ ~kwatra/ SIG07_TextureSynthesis/ index. htm
[2] http:/ / en. wikipedia. org/ wiki/ Texture_synthesis#endnote_Tamura
[3] http:/ / graphics. cs. cmu. edu/ projects/ nrt/
[4] http:/ / www. texturesynthesis. com/ nonparaMRF. htm
[5] http:/ / graphics. cs. cmu. edu/ people/ efros/ research/ EfrosLeung. html
[6] http:/ / graphics. stanford. edu/ papers/ texture-synthesis-sig00/
[7] http:/ / mrl. nyu. edu/ projects/ image-analogies/
[8] http:/ / graphics. cs. cmu. edu/ people/ efros/ research/ quilting. html
[9] http:/ / www-static. cc. gatech. edu/ gvu/ perception/ / projects/ graphcuttextures/
[10] http:/ / gimp-texturize. sourceforge. net/
[11] http:/ / www. logarithmic. net/ pfh/ resynthesizer
[12] http:/ / www-sop. inria. fr/ members/ Sylvain. Lefebvre/ _wiki_/ pmwiki. php?n=Main. TSynEx
[13] https:/ / github. com/ textureguy/ KUVA
[14] http:/ / xenia. media. mit. edu/ ~popat/ personal/
[15] http:/ / www. cns. nyu. edu/ heegerlab/ index. php?page=publications& id=heeger-siggraph95
[16] http:/ / www. texturesynthesis. com/ papers/ Paget_IP_1998. pdf
[17] http:/ / graphics. cs. cmu. edu/ people/ efros/ research/ NPS/ efros-iccv99. pdf
[18] http:/ / graphics. cs. cmu. edu/ people/ efros/ research/ synthesis. html
[19] http:/ / www. cs. utah. edu/ ~michael/ ts/
[20] http:/ / www. cs. huji. ac. il/ labs/ cglab/ papers/ texsyn/
[21]
[22]
[23]
[24]
[25]
[26]
Tiled rendering
Tiled rendering is the process of subdividing (or tiling) a computer graphics image by a regular grid in image space
to exploit local spatial coherence in the scene and/or to facilitate the use of limited hardware rendering resources
later in the graphics pipeline.
Tiled rendering is sometimes known as a "sort middle" architecture.
In a typical tiled renderer, geometry must first be transformed into screen space and assigned to screen-space tiles.
This requires some storage for the lists of geometry for each tile. In early tiled systems, this was performed by the
CPU, but all modern hardware contains hardware to accelerate this step. The list of geometry can also be sorted front
to back, allowing the GPU to use hidden surface removal to avoid processing pixels that are hidden behind others,
saving on memory bandwidth for unnecessary texture lookups.
Once geometry is assigned to tiles, the GPU renders each tile separately to a small on-chip buffer of memory. This
has the advantage that composition operations are cheap, both in terms of time and power. Once rendering is
complete for a particular tile, the final pixel values for the whole tile are then written once to external memory. Also,
since tiles can be rendered independently, the pixel processing lends itself very easily to parallel architectures with
multiple tile rendering engines.
Tiles are typically small (16x16 and 32x32 pixels are popular tile sizes), although some architectures use much
larger on-chip buffers and can be said to straddle the divide between tiled rendering and immediate mode ("sort last")
rendering.
Tiled rendering can also be used to create a nonlinear framebuffer to make adjacent pixels also adjacent in memory.
223
Tiled rendering
Early Work
Much of the early work on tiled rendering was done as part of the Pixel Planes 5 architecture (1989).
The Pixel Planes 5 project validated the tiled approach and invented a lot of the techniques now viewed as standard
for tiled renderers. It is the work most widely cited by other papers in the field.
The tiled approach was also known early in the history of software rendering. Implementations of Reyes rendering
often divide the image into "tile buckets".
References
224
UV mapping
225
UV mapping
UV mapping is the 3D modeling
process of making a 2D image
representation of a 3D model.
UV mapping
This process projects a texture map
onto a 3D object. The letters "U" and
"V" denote the axes of the 2D
texture[1] because "X", "Y" and "Z" are
already used to denote the axes of the
3D object in model space.
When a model is created as a polygon mesh using a 3D modeler, UV coordinates can be generated for each vertex in
the mesh. One way is for the 3D modeler to unfold the triangle mesh at the seams, automatically laying out the
triangles on a flat page. If the mesh is a UV sphere, for example, the modeler might transform it into an
equirectangular projection. Once the model is unwrapped, the artist can paint a texture on each triangle individually,
using the unwrapped mesh as a template. When the scene is rendered, each triangle will map to the appropriate
UV mapping
226
Finding UV on a sphere
For any point
Assuming that the sphere's poles are aligned with the Y axis, UV coordinates in the range
can then be
calculated as follows:
Notes
[1] when using quaternions (which is standard), "W" is also used; cf. UVW mapping
[2] Mullen, T (2009). Mastering Blender. 1st ed. Indianapolis, Indiana: Wiley Publishing, Inc.
[3] Murdock, K.L. (2008). 3ds Max 2009 Bible. 1st ed. Indianapolis, Indiana: Wiley Publishing, Inc.
References
External links
LSCM Mapping image (http://de.wikibooks.org/wiki/Bild:Blender3D_LSCM.png) with Blender
Blender UV Mapping Tutorial (http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics)
with Blender
Rare practical example of UV mapping (http://blog.nobel-joergensen.com/2011/04/05/
procedural-generated-mesh-in-unity-part-2-with-uv-mapping/) from a blog (not related to a specific product such
as Maya or Blender).
UVW mapping
227
UVW mapping
UVW mapping is a mathematical technique for coordinate mapping. In computer graphics, it is most commonly a
to
map, suitable for converting a 2D image (a texture) to a three dimensional object of a given topology.
"UVW", like the standard Cartesian coordinate system, has three dimensions; the third dimension allows texture
maps to wrap in complex ways onto irregular surfaces. Each point in a UVW map corresponds to a point on the
surface of the object. The graphic designer or programmer generates the specific mathematical function to
implement the map, so that points on the texture are assigned to (XYZ) points on the target surface. Generally
speaking, the more orderly the unwrapped polygons are, the easier it is for the texture artist to paint features onto the
texture. Once the texture is finished, all that has to be done is to wrap the UVW map back onto the object, projecting
the texture in a way that is far more flexible and advanced, preventing graphic artifacts that accompany more
simplistic texture mappings such as planar projection. For this reason, UVW mapping is commonly used to texture
map non-platonic solids, non-geometric primitives, and other irregularly-shaped objects, such as characters and
furniture.
External links
UVW Mapping Tutorial [1]
References
[1] http:/ / oman3d. com/ tutorials/ 3ds/ texture_stealth/
Vertex
In geometry, a vertex (plural vertices) is a special kind of point that describes the corners or intersections of
geometric shapes.
Definitions
Of an angle
The vertex of an angle is the point where two rays begin or meet,
where two line segments join or meet, where two lines intersect
(cross), or any appropriate combination of rays, segments and lines that
result in two straight "sides" meeting at one place.
Of a polytope
A vertex is a corner point of a polygon, polyhedron, or other higher
dimensional polytope, formed by the intersection of edges, faces or
facets of the object.
Vertex
228
Polytope vertices are related to vertices of graphs, in that the 1-skeleton of a polytope is a graph, the vertices of
which correspond to the vertices of the polytope, and in that a graph can be viewed as a 1-dimensional simplicial
complex the vertices of which are the graph's vertices. However, in graph theory, vertices may have fewer than two
incident edges, which is usually not allowed for geometric vertices. There is also a connection between geometric
vertices and the vertices of a curve, its points of extreme curvature: in some sense the vertices of a polygon are
points of infinite curvature, and if a polygon is approximated by a smooth curve there will be a point of extreme
curvature near each polygon vertex. However, a smooth curve approximation to a polygon will also have additional
vertices, at the points where its curvature is minimal.
Of a plane tiling
A vertex of a plane tiling or tessellation is a point where three or more tiles meet; generally, but not always, the tiles
of a tessellation are polygons and the vertices of the tessellation are also vertices of its tiles. More generally, a
tessellation can be viewed as a kind of topological cell complex, as can the faces of a polyhedron or polytope; the
vertices of other kinds of complexes such as simplicial complexes are its zero-dimensional faces.
Principal vertex
A polygon vertex xi of a simple polygon P is a principal polygon vertex
if the diagonal [x(i1),x(i+1)] intersects the boundary of P only at x(i1)
and x(i+1). There are two types of principal vertices: ears and mouths.
Ears
A principal vertex xi of a simple polygon P is called an ear if the
diagonal [x(i1),x(i+1)] that bridges xi lies entirely in P. (see also convex
polygon)
Mouths
A principal vertex xi of a simple polygon P is called a mouth if the
diagonal [x(i1),x(i+1)] lies outside the boundary of P.
External links
Weisstein, Eric W., "Polygon Vertex [1]", MathWorld.
Weisstein, Eric W., "Polyhedron Vertex [2]", MathWorld.
Weisstein, Eric W., "Principal Vertex [3]", MathWorld.
Vertex
229
References
[1] http:/ / mathworld. wolfram. com/ PolygonVertex. html
[2] http:/ / mathworld. wolfram. com/ PolyhedronVertex. html
[3] http:/ / mathworld. wolfram. com/ PrincipalVertex. html
230
/* These pointers will receive the contents of our shader source code
files */
GLchar *vertexSource, *fragmentSource;
231
232
float data[3][3] = {
{
},
},
};
233
234
References
[1] http:/ / www. opengl. org/ about/ arb/
External links
Vertex Buffer Object Whitepaper (http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt)
Vertex normal
In the geometry of computer graphics, a vertex normal at a vertex of a
polyhedron is the normalized average of the surface normals of the
faces that contain that vertex.[1][2] The average can be weighted for
example by the area of the face or it can be unweighted.[3][4] Vertex
normals are used in Gouraud shading, Phong shading and other
lighting models. This produces much smoother results than flat
shading; however, without some modifications, it cannot produce a
sharp edge.[5]
References
[1] Henri Gouraud. "Continuous Shading of Curved Surfaces." IEEE Transactions on
Computers, C-20(6) : 623--629 (June 1971).
[2] Andrew Glassner, I.6 Building vertex normals from a unstructured polygon list, in Graphics Gems IV, edited by Paul S. Heckber, Morgan
Kaufmann, 1994. pp. 60--74
[3] Nelson Max, Weights for Computing Vertex Normals from Facet Normals, Journal of Graphics Tools, Volume 4, Issue 2, 1999 p. 1-6
[4] Grit Thrrner and Charles A. Wthrich, Computing Vertex Normals from Polygonal Facets. Journal of Graphics Tools, Volume 3, Issue 1,
1998. pp. 43-46
[5] Max Wagner, Generating Vertex Normals, http:/ / www. emeyex. com/ site/ tuts/ VertexNormals. pdf
Viewing frustum
235
Viewing frustum
In 3D computer graphics, the viewing frustum or view frustum is the
region of space in the modeled world that may appear on the screen; it
is the field of view of the notional camera.[1]
The exact shape of this region varies depending on what kind of
camera lens is being simulated, but typically it is a frustum of a
rectangular pyramid (hence the name). The planes that cut the frustum
perpendicular to the viewing direction are called the near plane and the
far plane. Objects closer to the camera than the near plane or beyond
the far plane are not drawn. Sometimes, the far plane is placed
infinitely far away from the camera so all objects within the frustum
are drawn regardless of their distance from the camera.
A view frustum.
Viewing frustum culling or view frustum culling is the process of removing objects that lie completely outside the
viewing frustum from the rendering process. Rendering these objects would be a waste of time since they are not
directly visible. To make culling fast, it is usually done using bounding volumes surrounding the objects rather than
the objects themselves.
Definitions
VPN
the view-plane normal a normal to the view plane.
VUV
the view-up vector the vector on the view plane that indicates the upward direction.
VRP
the viewing reference point a point located on the view plane, and the origin of the VRC.
PRP
the projection reference point the point where the image is projected from, for parallel projection, the PRP is
at infinity.
VRC
the viewing-reference coordinate system.
The geometry is defined by a field of view angle (in the 'y' direction), as well as an aspect ratio. Further, a set of
z-planes define the near and far bounds of the frustum.
References
[1] http:/ / msdn. microsoft. com/ en-us/ library/ ff634570. aspx Microsoft What Is a View Frustum?
Virtual actor
Virtual actor
A virtual human or digital clone is the creation or re-creation of a human being in image and voice using
computer-generated imagery and sound, that is often indistinguishable from the real actor. This idea was first
portrayed in the 1981 film Looker, wherein models had their bodies scanned digitally to create 3D computer
generated images of the models, and then animating said images for use in TV commercials. Two 1992 books used
this concept: "Fools" by Pat Cadigan, and Et Tu, Babe by Mark Leyner.
In general, virtual humans employed in movies are known as synthespians, virtual actors, vactors, cyberstars, or
"silicentric" actors. There are several legal ramifications for the digital cloning of human actors, relating to
copyright and personality rights. People who have already been digitally cloned as simulations include Bill Clinton,
Marilyn Monroe, Fred Astaire, Ed Sullivan, Elvis Presley, Bruce Lee, Audrey Hepburn, Anna Marie Goddard, and
George Burns. Ironically, data sets of Arnold Schwarzenegger for the creation of a virtual Arnold (head, at least)
have already been made.
The name Schwarzeneggerization comes from the 1992 book Et Tu, Babe by Mark Leyner. In one scene, on pages
5051, a character asks the shop assistant at a video store to have Arnold Schwarzenegger digitally substituted for
existing actors into various works, including (amongst others) Rain Man (to replace both Tom Cruise and Dustin
Hoffman), My Fair Lady (to replace Rex Harrison), Amadeus (to replace F. Murray Abraham), The Diary of Anne
Frank (as Anne Frank), Gandhi (to replace Ben Kingsley), and It's a Wonderful Life (to replace James Stewart).
Schwarzeneggerization is the name that Leyner gives to this process. Only 10 years later, Schwarzeneggerization
was close to being reality.
By 2002, Schwarzenegger, Jim Carrey, Kate Mulgrew, Michelle Pfeiffer, Denzel Washington, Gillian Anderson, and
David Duchovny had all had their heads laser scanned to create digital computer models thereof.
Early history
Early computer-generated animated faces include the 1985 film Tony de Peltrie and the music video for Mick
Jagger's song "Hard Woman" (from She's the Boss). The first actual human beings to be digitally duplicated were
Marilyn Monroe and Humphrey Bogart in a March 1987 filmWikipedia:Please clarify created by Nadia Magnenat
Thalmann and Daniel Thalmann for the 100th anniversary of the Engineering Society of Canada. The film was
created by six people over a year, and had Monroe and Bogart meeting in a caf in Montreal. The characters were
rendered in three dimensions, and were capable of speaking, showing emotion, and shaking hands.
In 1987, the Kleizer-Walczak Construction Company begain its Synthespian ("synthetic thespian") Project, with the
aim of creating "life-like figures based on the digital animation of clay models".
In 1988, Tin Toy was the first entirely computer-generated movie to win an Academy Award (Best Animated Short
Film). In the same year, Mike the Talking Head, an animated head whose facial expression and head posture were
controlled in real time by a puppeteer using a custom-built controller, was developed by Silicon Graphics, and
performed live at SIGGRAPH. In 1989, The Abyss, directed by James Cameron included a computer-generated face
placed onto a watery pseudopod.
In 1991, Terminator 2, also directed by Cameron, confident in the abilities of computer-generated effects from his
experience with The Abyss, included a mixture of synthetic actors with live animation, including computer models of
Robert Patrick's face. The Abyss contained just one scene with photo-realistic computer graphics. Terminator 2
contained over forty shots throughout the film.
In 1997, Industrial Light and Magic worked on creating a virtual actor that was a composite of the bodily parts of
several real actors.
By the 21st century, virtual actors had become a reality. The face of Brandon Lee, who had died partway through the
shooting of The Crow in 1994, had been digitally superimposed over the top of a body-double in order to complete
236
Virtual actor
those parts of the movie that had yet to be filmed. By 2001, three-dimensional computer-generated realistic humans
had been used in Final Fantasy: The Spirits Within, and by 2004, a synthetic Laurence Olivier co-starred in Sky
Captain and the World of Tomorrow.
Legal issues
Critics such as Stuart Klawans in the New York Times expressed worry about the loss of "the very thing that art was
supposedly preserving: our point of contact with the irreplaceable, finite person". And even more problematic are the
issues of copyright and personality rights. Actors have little legal control over a digital clone of themselves. In the
United States, for instance, they must resort to database protection laws in order to exercise what control they have
(The proposed Database and Collections of Information Misappropriation Act would strengthen such laws). An actor
does not own the copyright on his digital clones, unless they were created by him. Robert Patrick, for example,
would not have any legal control over the liquid metal digital clone of himself that was created for Terminator 2.
The use of digital clones in movie industry, to replicate the acting performances of a cloned person, represents a
controversial aspect of these implications, as it may cause real actors to land in fewer roles, and put them in
disadvantage at contract negotiations, since a clone could always be used by the producers at potentially lower costs.
It is also a career difficulty, since a clone could be used in roles that a real actor would never accept for various
reasons. Bad identifications of an actor's image with a certain type of roles could harm his career, and real actors,
conscious of this, pick and choose what roles they play (Bela Lugosi and Margaret Hamilton became typecast with
their roles as Count Dracula and the Wicked Witch of the West, whereas Anthony Hopkins and Dustin Hoffman
have played a diverse range of parts). A digital clone could be used to play the parts of (for examples) an axe
murderer or a prostitute, which would affect the actor's public image, and in turn affect what future casting
opportunities were given to that actor. Both Tom Waits and Bette Midler have won actions for damages against
people who employed their images in advertisements that they had refused to take part in themselves.
In the USA, the use of a digital clone in advertisements is requireed to be accurate and truthful (section 43(a) of the
Lanham Act and which makes deliberate confusion unlawful). The use of a celebrity's image would be an implied
endorsement. The New York District Court held that an advertisement employing a Woody Allen impersonator
would violate the Act unless it contained a disclaimer stating that Allen did not endorse the product.
Other concerns include posthumous use of digital clones. Barbara Creed states that "Arnold's famous threat, 'I'll be
back', may take on a new meaning". Even before Brandon Lee was digitally reanimated, the California Senate drew
up the Astaire Bill, in response to lobbying from Fred Astaire's widow and the Screen Actors Guild, who were
seeking to restrict the use of digital clones of Astaire. Movie studios opposed the legislation, and as of 2002 it had
yet to be finalized and enacted. Several companies, including Virtual Celebrity Productions, have purchased the
rights to create and use digital clones of various dead celebrities, such as Marlene Dietrich[1] and Vincent Price.
In fiction
S1m0ne, a 2002 science fiction drama film written, produced and directed by Andrew Niccol, starring Al Pacino.
In business
A Virtual Actor can also be a person who performs a role in real-time when logged into a Virtual World or
Collaborative On-Line Environment. One who represents, via an avatar, a character in a simulation or training event.
One who behaves as if acting a part through the use of an avatar.
Vactor Studio LLC is a New York-based company, but its "Vactors" (virtual actors) are located all across the US and
Canada. The Vactors log into virtual world applications from their homes or offices to participate in exercises
covering an extensive range of markets including: Medical, Military, First Responder, Corporate, Government,
Entertainment, and Retail. Through their own computers, they become doctors, soldiers, EMTs, customer service
237
Virtual actor
238
reps, victims for Mass Casualty Response training, or whatever the demonstration requires. Since 2005, Vactor
Studios role-players have delivered thousands of hours of professional virtual world demonstrations, training
exercises, and event management services.
References
[1] Los Angeles Times / Digital Elite Inc. (http:/ / articles. latimes. com/ 1999/ aug/ 09/ business/ fi-64043)
Further reading
Michael D. Scott and James N. Talbott (1997). "Titles and Characters". Scott on Multimedia Law. Aspen
Publishers Online. ISBN1-56706-333-0. a detailed discussion of the law, as it stood in 1997, relating to virtual
humans and the rights held over them by real humans
Richard Raysman (2002). "Trademark Law". Emerging Technologies and the Law: Forms and Analysis. Law
Journal Press. pp.615. ISBN1-58852-107-9. how trademark law affects digital clones of celebrities who
have trademarked their person
External links
Vactor Studio (http://www.vactorstudio.com/)
Volume rendering
In scientific visualization and computer graphics,
volume rendering is a set of techniques used to
display a 2D projection of a 3D discretely sampled data
set.
A typical 3D data set is a group of 2D slice images
acquired by a CT, MRI, or MicroCT scanner. Usually
these are acquired in a regular pattern (e.g., one slice
every millimeter) and usually have a regular number of
image pixels in a regular pattern. This is an example of
a regular volumetric grid, with each volume element, or
voxel represented by a single value that is obtained by
sampling the immediate area surrounding the voxel.
To render a 2D projection of the 3D data set, one first
needs to define a camera in space relative to the
volume. Also, one needs to define the opacity and color
of every voxel. This is usually defined using an RGBA
(for red, green, blue, alpha) transfer function that
defines the RGBA value for every possible voxel value.
For example, a volume may be viewed by extracting isosurfaces (surfaces of equal values) from the volume and
rendering them as polygonal meshes or by rendering the volume directly as a block of data. The
Volume rendering
239
A combination of these techniques is possible. For instance, a shear warp implementation could use texturing
hardware to draw the aligned slices in the off-screen buffer.
Volume rendering
240
Splatting
This is a technique which trades quality for speed. Here, every volume element is splatted, as Lee Westover said, like
a snow ball, on to the viewing surface in back to front order. These splats are rendered as disks whose properties
(color and transparency) vary diametrically in normal (Gaussian) manner. Flat disks and those with other kinds of
property distribution are also used depending on the application.
Shear warp
The shear warp approach to volume rendering was
developed by Cameron and Undrill, popularized by
Philippe Lacroute and Marc Levoy.[2] In this technique,
the viewing transformation is transformed such that the
nearest face of the volume becomes axis aligned with
an off-screen image buffer with a fixed scale of voxels
to pixels. The volume is then rendered into this buffer
using the far more favorable memory alignment and
fixed scaling and blending factors. Once all slices of
the volume have been rendered, the buffer is then
warped into the desired orientation and scaled in the
displayed image.
This technique is relatively fast in software at the cost
of less accurate sampling and potentially worse image
quality compared to ray casting. There is memory
overhead for storing multiple copies of the volume, for
the ability to have near axis aligned volumes. This
overhead can be mitigated using run length encoding.
Texture mapping
Many 3D graphics systems use texture mapping to apply images, or textures, to geometric objects. Commodity PC
graphics cards are fast at texturing and can efficiently render slices of a 3D volume, with real time interaction
capabilities. Workstation GPUs are even faster, and are the basis for much of the production volume visualization
used in medical imaging, oil and gas, and other markets (2007). In earlier years, dedicated 3D texture mapping
systems were used on graphics systems such as Silicon Graphics InfiniteReality, HP Visualize FX graphics
accelerator, and others. This technique was first described by Bill Hibbard and Dave Santek.[3]
These slices can either be aligned with the volume and rendered at an angle to the viewer, or aligned with the
viewing plane and sampled from unaligned slices through the volume. Graphics hardware support for 3D textures is
needed for the second technique.
Volume aligned texturing produces images of reasonable quality, though there is often a noticeable transition when
the volume is rotated.
Volume rendering
241
Volume rendering
Optimization techniques
The primary goal of optimization is to skip as much of the volume as possible. A typical medical data set can be 1
GB in size. To render that at 30 frame/s requires an extremely fast memory bus. Skipping voxels means that less
information needs to be processed.
Volume segmentation
By sectioning out large portions of the volume that one considers uninteresting before rendering, the amount of
calculations that have to be made by ray casting or texture blending can be significantly reduced. This reduction can
be as much as from O(n) to O(log n) for n sequentially indexed voxels. Volume segmentation also has significant
performance benefits for other ray tracing algorithms.
242
Volume rendering
Image-based meshing
Image-based meshing is the automated process of creating computer models from 3D image data (such as MRI, CT,
Industrial CT or microtomography) for computational analysis and design, e.g. CAD, CFD, and FEA.
References
[1] Marc Levoy, "Display of Surfaces from Volume Data", IEEE CG&A, May 1988. Archive of Paper (http:/ / graphics. stanford. edu/ papers/
volume-cga88/ )
[2] Fast Volume Rendering Using a Shear-Warp Factorization of the Viewing Transformation (http:/ / graphics. stanford. edu/ papers/ shear/ )
[3] Hibbard W., Santek D., "Interactivity is the key" (http:/ / www. ssec. wisc. edu/ ~billh/ p39-hibbard. pdf), Chapel Hill Workshop on Volume
Visualization, University of North Carolina, Chapel Hill, 1989, pp.3943.
[4] Sherbondy A., Houston M., Napel S.: Fast volume segmentation with simultaneous visualization using programmable graphics hardware. In
Proceedings of IEEE Visualization (2003), pp.171176.
[5] Max N., Hanrahan P., Crawfis R.: Area and volume coherence for efficient visualization of 3D scalar functions. In Computer Graphics (San
Diego Workshop on Volume Visualization, 1990) vol. 24, pp.2733.
[6] Stein C., Backer B., Max N.: Sorting and hardware assisted rendering for volume visualization. In Symposium on Volume Visualization
(1994), pp.8390.
[7] Lum E., Wilson B., Ma K.: High-Quality Lighting and Efficient Pre-Integration for Volume Rendering. In Eurographics/IEEE Symposium on
Visualization 2004.
Bibliography
1. ^ Barthold Lichtenbelt, Randy Crane, Shaz Naqvi, Introduction to Volume Rendering (Hewlett-Packard
Professional Books), Hewlett-Packard Company 1998.
2. ^ Peng H., Ruan, Z, Long, F, Simpson, JH, Myers, EW: V3D enables real-time 3D visualization and quantitative
analysis of large-scale biological image data sets. Nature Biotechnology, 2010 doi: 10.1038/nbt.1612 (http://dx.
doi.org/10.1038/nbt.1612) Volume Rendering of large high-dimensional image data (http://www.nature.
com/nbt/journal/vaop/ncurrent/full/nbt.1612.html).
243
Volumetric lighting
244
Volumetric lighting
Volumetric lighting is a technique used in
3D computer graphics to add lighting effects
to a rendered scene. It allows the viewer to
see beams of light shining through the
environment; seeing sunbeams streaming
through an open window is an example of
volumetric lighting, also known as
crepuscular rays. The term seems to have
been introduced from cinematography and is
now widely applied to 3D modelling and
rendering especially in the field of 3D
gaming.[citation needed]
Forest scene from Big Buck Bunny, showing light rays through the canopy.
In volumetric lighting, the light cone emitted by a light source is modeled as a transparent object and considered as a
container of a "volume": as a result, light has the capability to give the effect of passing through an actual three
dimensional medium (such as fog, dust, smoke, or steam) that is inside its volume, just like in the real world.
References
[1] NeHe Volumetric Lighting (http:/ / nehe. gamedev. net/ data/ lessons/ lesson. asp?lesson=36)
External links
Volumetric lighting tutorial at Art Head Start (http://www.art-head-start.com/tutorial-volumetric.html)
3D graphics terms dictionary at Tweak3D.net (http://www.tweak3d.net/3ddictionary/)
Voxel
245
Voxel
A voxel (volume element), represents a value on a regular grid in three
dimensional space. Voxel is a combination of "volume" and "pixel"
where pixel is a combination of "picture" and "element".[1] This is
analogous to a texel, which represents 2D image data in a bitmap
(which is sometimes referred to as a pixmap). As with pixels in a
bitmap, voxels themselves do not typically have their position (their
coordinates) explicitly encoded along with their values. Instead, the
position of a voxel is inferred based upon its position relative to other
voxels (i.e., its position in the data structure that makes up a single
volumetric image). In contrast to pixels and voxels, points and
polygons are often explicitly represented by the coordinates of their
vertices. A direct consequence of this difference is that polygons are
able to efficiently represent simple 3D structures with lots of empty or
homogeneously filled space, while voxels are good at representing
regularly sampled spaces that are non-homogeneously filled.
Voxels are frequently used in the visualization and analysis of medical and scientific data. Some volumetric displays
use voxels to describe their resolution. For example, a display might be able to show 512512512 voxels.
Rasterization
Another technique for voxels involves Raster graphics where you simply raytrace every pixel of the display into the
scene. A typical implementation will raytrace each pixel of the display starting at the bottom of the screen using
what is known as a y-buffer. When a voxel is reached that has a higher y value on the display it is added to the
y-buffer overriding the previous value and connected with the previous y-value on the screen interpolating the color
values.
Outcast and other 1990's video games employed this graphics technique for effects such as reflection and
bump-mapping and usually for terrain rendering. Outcast's graphics engine was mainly a combination of a ray
casting (heightmap) engine, used to render the landscape, and a texture mapping polygon engine used to render
objects. The "Engine Programming" section of the games credits in the manual has several subsections related to
graphics, among them: "Landscape Engine", "Polygon Engine", "Water & Shadows Engine" and "Special effects
Engine". Although Outcast is often cited as a forerunner of voxel technology, this is somewhat misleading. The
game does not actually model three-dimensional volumes of voxels. Instead, it models the ground as a surface,
which may be seen as being made up of voxels. The ground is decorated with objects that are modeled using
texture-mapped polygons. When Outcast was developed, the term "voxel engine", when applied to computer games,
commonly referred to a ray casting engine (for example the VoxelSpace engine). On the engine technology page of
the game's website, the landscape engine is also referred to as the "Voxels engine".[2] The engine is purely
software-based; it does not rely on hardware-acceleration via a 3D graphics card.[3]
John Carmack also experimented with Voxels for the Quake III engine.[4] One such problem cited by Carmack is the
lack of graphics cards designed specifically for such rendering requiring them to be software rendered, which still
remains an issue with the technology to this day.
Comanche was also the first commercial flight simulation based on voxel technology via the company's proprietary
Voxel Space engine (written entirely in Assembly language). This rendering technique allowed for much more
detailed and realistic terrain compared to simulations based on vector graphics at that time.
Voxel
246
Voxel data
A voxel represents a single sample, or data point, on a regularly
spaced, three-dimensional grid. This data point can consist of a single
piece of data, such as an opacity, or multiple pieces of data, such as a
color in addition to opacity. A voxel represents only a single point on
this grid, not a volume; the space between each voxel is not
represented in a voxel-based dataset. Depending on the type of data
and the intended use for the dataset, this missing information may be
reconstructed and/or approximated, e.g. via interpolation.
The value of a voxel may represent various properties. In CT scans, the
values are Hounsfield units, giving the opacity of material to
X-rays.[5]:29 Different types of value are acquired from MRI or
ultrasound.
While voxels provide the benefit of precision and depth of reality, they
are typically large data sets and are unwieldy to manage given the bandwidth of common computers. However,
through efficient compression and manipulation of large data files, interactive visualization can be enabled on
consumer market computers.
Other values may be useful for immediate 3D rendering, such as a surface normal vector and color.
Uses
Common uses of voxels include volumetric imaging in medicine and representation of terrain in games and
simulations. Voxel terrain is used instead of a heightmap because of its ability to represent overhangs, caves, arches,
and other 3D terrain features. These concave features cannot be represented in a heightmap due to only the top 'layer'
of data being represented, leaving everything below it filled (the volume that would otherwise be the inside of the
caves, or the underside of arches or overhangs).
Visualization
A volume containing voxels can be visualized either by direct volume rendering or by the extraction of polygon
isosurfaces that follow the contours of given threshold values. The marching cubes algorithm is often used for
isosurface extraction, however other methods exist as well.
Computer gaming
Planet Explorers is a 3D building game that uses voxels for rendering equipment, buildings, and terrain. Using a
voxel editor, players can actually create their own models for weapons and buildings, and terrain can be modified
similar to other building games.
C4 Engine is a game engine that uses voxels for in game terrain and has a voxel editor for its built-in level editor.
Miner Wars 2081 uses its own Voxel Rage engine to let the user deform the terrain of asteroids allowing tunnels
to be formed.
Many NovaLogic games have used voxel-based rendering technology, including the Delta Force, Armored Fist
and Comanche series.
Voxel
Westwood Studios' Command & Conquer: Tiberian Sun and Command & Conquer: Red Alert 2 use voxels to
render most vehicles.
Westwood Studios' Blade Runner video game used voxels to render characters and artifacts.
Outcast, a game made by Belgian developer Appeal, sports outdoor landscapes that are rendered by a voxel
engine.
Comanche_series, a game made by NovaLogic used voxel rasterization for terrain rendering.[6]
The videogame Amok for the Sega Saturn makes use of voxels in its scenarios.
The computer game Vangers uses voxels for its two-level terrain system.
Master of Orion III uses voxel graphics to render space battles and solar systems. Battles displaying 1000 ships at
a time were rendered slowly on computers without hardware graphic acceleration.
Sid Meier's Alpha Centauri uses voxel models to render units.
Shattered Steel featured deforming landscapes using voxel technology.
Build engine first-person shooter games Shadow Warrior and Blood use voxels instead of sprites as an option for
many of the items pickups and scenery. Duke Nukem 3D has an fan-created pack in a similar style.
Crysis, as well as the Cryengine 2 and 3, use a combination of heightmaps and voxels for its terrain system.
Worms 4: Mayhem uses a voxel-based engine to simulate land deformation similar to the older 2D Worms games.
The multi-player role playing game Hexplore uses a voxel engine allowing the player to rotate the isometric
rendered playfield.
The computer game Voxatron, produced by Lexaloffle, is composed and generated fully using voxels.
Ace of Spades used Ken Silverman's Voxlap engine before being rewritten in a bespoke OpenGL engine.
3D Dot Game Heroes uses voxels to present retro-looking graphics.
Vox, an upcoming voxel based exploration/RPG game focusing on player generated content.
ScrumbleShip, a block-building MMO space simulator game in development, renders each in-game component
and damage to those components using dozens to thousands of voxels.
Castle Story, a castle building Real Time Strategy game in development, has terrain consisting of smoothed
voxels
Block Ops, a voxel based First Person Shooter game.
Cube World, an Indie voxel based game with RPG elements based on games like, Terraria, Diablo (video game),
The Legend of Zelda, Monster Hunter, World of Warcraft, Secret of Mana, and many others.
EverQuest Next and EverQuest Next: Landmark, upcoming MMORPGs by Sony Online Entertainment, make
extensive use of voxels for world creation as well as player generated content
7 Days to Die, Voxel based open world survival horror game developed by The Fun Pimps Entertainment.
Brutal Nature, Voxel based Survival FPS that uses surface net relaxation to render voxels as a smooth mesh.
Voxel editors
While scientific volume visualization doesn't require modifying the actual voxel data, voxel editors can be used to
create art (especially 3D pixel art) and models for voxel based games. Some editors are focused on a single approach
to voxel editing while others mix various approaches. Some common approaches are:
Slice based: The volume is sliced in one or more axes and the user can edit each image individually using 2D
raster editor tools. These generally store color information in voxels.
Sculpture: Similar to the vector counterpart but with no topology constraints. These usually store density
information in voxels and lack color information.
Building blocks: The user can add and remove blocks just like a construction set toy.
247
Voxel
Extensions
A generalization of a voxel is the doxel, or dynamic voxel. This is used in the case of a 4D dataset, for example, an
image sequence that represents 3D space together with another dimension such as time. In this way, an image could
contain 100100100100 doxels, which could be seen as a series of 100 frames of a 100100100 volume image
(the equivalent for a 3D image would be showing a 2D cross section of the image in each frame). Although storage
and manipulation of such data requires large amounts of memory, it allows the representation and analysis of
spacetime systems.
References
[1] http:/ / www. tomshardware. com/ reviews/ voxel-ray-casting,2423-3. html
[2] Engine Technology (http:/ / web. archive. org/ web/ 20060507235618/ http:/ / www. outcast-thegame. com/ tech/ paradise. htm)
[3] " Voxel terrain engine (http:/ / www. codermind. com/ articles/ Voxel-terrain-engine-building-the-terrain. html)", introduction. In a coder's
mind, 2005.
[4] http:/ / www. tomshardware. com/ reviews/ voxel-ray-casting,2423-2. html
[5] Novelline, Robert. Squire's Fundamentals of Radiology. Harvard University Press. 5th edition. 1997. ISBN 0-674-83339-2.
[6] http:/ / projectorgames. net/ blog/ ?p=168
External links
Games with voxel graphics (http://www.mobygames.com/game-group/visual-technique-style-voxel-graphics)
at MobyGames
Fundamentals of voxelization (http://labs.cs.sunysb.edu/labs/projects/volume/Papers/Voxel/)
248
Z-buffering
249
Z-buffering
In computer graphics, z-buffering, also known as depth buffering, is
the management of image depth coordinates in three-dimensional
(3-D) graphics, usually done in hardware, sometimes in software. It is
one solution to the visibility problem, which is the problem of deciding
which elements of a rendered scene are visible, and which are hidden.
The painter's algorithm is another common solution which, though less
efficient, can also handle non-opaque scene elements.
When an object is rendered, the depth of a generated pixel (z
coordinate) is stored in a buffer (the z-buffer or depth buffer). This
buffer is usually arranged as a two-dimensional array (x-y) with one
element for each screen pixel. If another object of the scene must be
rendered in the same pixel, the method compares the two depths and
overrides the current pixel if the object is closer to the observer. The
chosen depth is then saved to the z-buffer, replacing the old one. In the
end, the z-buffer will allow the method to correctly reproduce the usual
depth perception: a close object hides a farther one. This is called
z-culling.
Z-buffer data
The granularity of a z-buffer has a great influence on the scene quality: a 16-bit z-buffer can result in artifacts (called
"z-fighting") when two objects are very close to each other. A 24-bit or 32-bit z-buffer behaves much better,
although the problem cannot be entirely eliminated without additional algorithms. An 8-bit z-buffer is almost never
used since it has too little precision.
Uses
The Z-buffer is a technology used in almost all contemporary computers, laptops and mobile phones for performing
3-D (3 dimensional) graphics, for example for computer games. The Z-buffer is implemented as hardware in the
silicon ICs (integrated circuits) within these computers. The Z-buffer is also used (implemented as software as
opposed to hardware) for producing computer-generated special effects for films.
Furthermore, Z-buffer data obtained from rendering a surface from a light's point-of-view permits the creation of
shadows by the "shadow mapping" technique.
Developments
Even with small enough granularity, quality problems may arise when precision in the z-buffer's distance values is
not spread evenly over distance. Nearer values are much more precise (and hence can display closer objects better)
than values which are farther away. Generally, this is desirable, but sometimes it will cause artifacts to appear as
objects become more distant. A variation on z-buffering which results in more evenly distributed precision is called
w-buffering (see below).
At the start of a new scene, the z-buffer must be cleared to a defined value, usually 1.0, because this value is the
upper limit (on a scale of 0 to 1) of depth, meaning that no object is present at this point through the viewing
frustum.
The invention of the z-buffer concept is most often attributed to Edwin Catmull, although Wolfgang Straer also
described this idea in his 1974 Ph.D. thesis1.
Z-buffering
250
On recent PC graphics cards (19992005), z-buffer management uses a significant chunk of the available memory
bandwidth. Various methods have been employed to reduce the performance cost of z-buffering, such as lossless
compression (computer resources to compress/decompress are cheaper than bandwidth) and ultra fast hardware
z-clear that makes obsolete the "one frame positive, one frame negative" trick (skipping inter-frame clear altogether
using signed numbers to cleverly check depths).
Z-culling
In rendering, z-culling is early pixel elimination based on depth, a method that provides an increase in performance
when rendering of hidden surfaces is costly. It is a direct consequence of z-buffering, where the depth of each pixel
candidate is compared to the depth of existing geometry behind which it might be hidden.
When using a z-buffer, a pixel can be culled (discarded) as soon as its depth is known, which makes it possible to
skip the entire process of lighting and texturing a pixel that would not be visible anyway. Also, time-consuming
pixel shaders will generally not be executed for the culled pixels. This makes z-culling a good optimization
candidate in situations where fillrate, lighting, texturing or pixel shaders are the main bottlenecks.
While z-buffering allows the geometry to be unsorted, sorting polygons by increasing depth (thus using a reverse
painter's algorithm) allows each screen pixel to be rendered fewer times. This can increase performance in
fillrate-limited scenes with large amounts of overdraw, but if not combined with z-buffering it suffers from severe
problems such as:
polygons might occlude one another in a cycle (e.g. : triangle A occludes B, B occludes C, C occludes A), and
there is no canonical "closest" point on a triangle (e.g.: no matter whether one sorts triangles by their centroid or
closest point or furthest point, one can always find two triangles A and B such that A is "closer" but in reality B
should be drawn first).
As such, a reverse painter's algorithm cannot be used as an alternative to Z-culling (without strenuous
re-engineering), except as an optimization to Z-culling. For example, an optimization might be to keep polygons
sorted according to x/y-location and z-depth to provide bounds, in an effort to quickly determine if two polygons
might possibly have an occlusion interaction.
Algorithm
Given: A list of polygons {P1,P2,.....Pn}
Output: A COLOR array, which displays the intensity of the visible polygon surfaces.
Initialize:
note : z-depth and z-buffer(x,y) is positive........
z-buffer(x,y)=max depth; and
COLOR(x,y)=background color.
Begin:
for(each polygon P in the polygon list)
do{
for(each pixel(x,y) that intersects P)
do{
Calculate z-depth of P at (x,y)
If (z-depth < z-buffer[x,y])
then{
z-buffer[x,y]=z-depth;
COLOR(x,y)=Intensity of P at(x,y);
Z-buffering
251
}
}
}
display COLOR array.
Mathematics
The range of depth values in camera space (see 3D projection) to be rendered is often defined between a
value of . After a perspective transformation, the new value of , or , is defined by:
where
, or
and
, is defined by:
or
plane is at 1. Values outside of this range correspond to points which are not in the viewing frustum, and
shouldn't be rendered.
Fixed-point representation
Typically, these values are stored in the z-buffer of the hardware graphics accelerator in fixed point format. First they
are normalized to a more common range which is [0,1] by substituting the appropriate conversion
into the previous formula:
This formula can be inverted and derivated in order to calculate the z-buffer resolution (the 'granularity' mentioned
earlier). The inverse of the above
:
where
The z-buffer resolution in terms of camera space would be the incremental value resulted from the smallest change
in the integer stored in the z-buffer, which is +1 or -1. Therefore this resolution can be calculated from the derivative
of as a function of :
by the above
Z-buffering
252
~
This shows that the values of
farther away, resulting in better precision closer to the camera. The smaller the
W-buffer
To implement a w-buffer,Wikipedia:Please clarify the old values of in camera space, or , are stored in the
buffer, generally in floating point format. However, these values cannot be linearly interpolated across screen space
from the verticesthey usually have to be inverted[1], interpolated, and then inverted again. The resulting values of
, as opposed to , are spaced evenly between
and
. There are implementations of the w-buffer that
avoid the inversions altogether.
Whether a z-buffer or w-buffer results in a better image depends on the application.
References
[1] http:/ / toolserver. org/ %7Edispenser/ cgi-bin/ dab_solver. py?page=Z-buffering& editintro=Template:Disambiguation_needed/ editintro&
client=Template:Dn
External links
Learning to Love your Z-buffer (http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html)
Alpha-blending and the Z-buffer (http://www.sjbaker.org/steve/omniv/alpha_sorting.html)
Notes
Note 1: see W.K. Giloi, J.L. Encarnao, W. Straer. "The Gilois School of Computer Graphics". Computer
Graphics 35 4:1216.
Z-fighting
253
Z-fighting
Z-fighting is a phenomenon in 3D rendering that occurs when two or
more primitives have similar values in the z-buffer. It is particularly
prevalent with coplanar polygons, where two faces occupy essentially
the same space, with neither in front. Affected pixels are rendered with
fragments from one polygon or the other arbitrarily, in a manner
determined by the precision of the z-buffer. It can also vary as the
scene or camera is changed, causing one polygon to "win" the z test,
then another, and so on. The overall effect is a flickering, noisy
rasterization of two polygons which "fight" to color the screen pixels.
This problem is usually caused by limited sub-pixel precision and
floating point and fixed point round-off errors.
Z-fighting can be reduced through the use of a higher resolution depth buffer, by z-buffering in some scenarios, or by
simply moving the polygons further apart. Z-fighting which cannot be entirely eliminated in this manner is often
resolved by the use of a stencil buffer, or by applying a post transformation screen space z-buffer offset to one
polygon which does not affect the projected shape on screen, but does affect the z-buffer value to eliminate the
overlap during pixel interpolation and comparison. Where z-fighting is caused by different transformation paths in
hardware for the same geometry (for example in a multi-pass rendering scheme) it can sometimes be resolved by
requesting that the hardware uses invariant vertex transformation.
The more z-buffer precision one uses, the less likely it is that z-fighting will be encountered. But for coplanar
polygons, the problem is inevitable unless corrective action is taken.
As the distance between near and far clip planes increases and in particular the near plane is selected near the eye,
the greater the likelihood exists that z-fighting between primitives will occur. With large virtual environments
inevitably there is an inherent conflict between the need to resolve visibility in the distance and in the foreground, so
for example in a space flight simulator if you draw a distant galaxy to scale, you will not have the precision to
resolve visibility on any cockpit geometry in the foreground (although even a numerical representation would
present problems prior to z-buffered rendering). To mitigate these problems, z-buffer precision is weighted towards
the near clip plane, but this is not the case with all visibility schemes and it is insufficient to eliminate all z-fighting
issues.
Z-fighting
254
Demonstration of z-fighting with multiple colors and textures over a grey background
255
Appendix
3D computer graphics software
3D computer graphics
Basics
3D modeling / 3D scanning
3D rendering / 3D printing
3D computer graphics software
Primary Uses
v
t
e [1]
3D computer graphics software produces computer-generated imagery (CGI) through 3D modeling and 3D
rendering.
Classification
Modeling
3D modeling software is a class of 3D computer graphics software used to produce 3D models. Individual programs
of this class are called modeling applications or modelers.
3D modelers allow users to create and alter models via their 3D mesh. Users can add, subtract, stretch and otherwise
change the mesh to their desire. Models can be viewed from a variety of angles, usually simultaneously. Models can
be rotated and the view can be zoomed in and out.
3D modelers can export their models to files, which can then be imported into other applications as long as the
metadata are compatible. Many modelers allow importers and exporters to be plugged-in, so they can read and write
data in the native formats of other applications.
Most 3D modelers contain a number of related features, such as ray tracers and other rendering alternatives and
texture mapping facilities. Some also contain features that support or allow animation of models. Some may be able
to generate full-motion video of a series of rendered scenes (i.e. animation).
Rendering
Although 3D modeling and CAD software may perform 3D rendering as well (e.g.Autodesk 3ds Max or Blender),
exclusive 3D rendering software also exist.
Computer-aided design
Computer aided design software may employ the same fundamental 3D modeling techniques that 3D modeling
software use but their goal differs. They are used in computer-aided engineering, computer-aided manufacturing,
Finite element analysis, product lifecycle management, 3D printing and Computer-aided architectural design.
Complementary tools
After producing video, studios then edit or composite the video using programs such as Adobe Premiere Pro or Final
Cut Pro at the low end, or Autodesk Combustion, Digital Fusion, Shake at the high-end. Match moving software is
commonly used to match live video with computer-generated video, keeping the two in sync as the camera moves.
Use of real-time computer graphics engines to create a cinematic production is called machinima.
References
External links
3D Tools table (http://wiki.cgsociety.org/index.php/Comparison_of_3d_tools) from the CGSociety wiki
Comparison of 10 most popular modeling software (http://tideart.com/?id=4e26f595) from TideArt
256
257
258
259
260
261
262
263
264
265
266
License
License
Creative Commons Attribution-Share Alike 3.0
//creativecommons.org/licenses/by-sa/3.0/
267