Graphics Reference
In-Depth Information
the hardware should compute a MIP map for the texture image, and to select the
MIP level during texture mapping according to the size of the screen projection
of a small square. Nonetheless, we suggest that you play with texture band limits
yourself (see Exercise 20.3) to get a feel for what's required.
In those situations where you need to implement texture mapping yourself (as
in a software ray tracer, where you don't have the hardware support provided by
a graphics card), and you want to do image-based texture mapping, two problems
arise.
1. Sometimes you view an object from very close up, and even the texture
map doesn't have enough detail: Two adjacent pixels in the texture map
end up corresponding to two pixels in the final image that are perhaps ten
pixels apart. You need to interpolate texture values in between. The usual
solution is bilinear (for surface textures) or trilinear (for solid textures)
interpolation.
2. Sometimes you view an object from a distance, and many texture pixels
map to one image pixel. In this case, as we said, MIP mapping is the most
widely used solution.
Note that the texture-sampling grid will rarely be aligned well with the screen-
sampling grid, so merely having the texture resolution match the screen resolution
(i.e., adjacent texture pixels project to points that are about one screen pixel apart)
will still result in blurring. In practice, you need at least twice the resolution in
each dimension for bilinearly interpolated texture values to look “sharp enough”
when the texture's not exactly aligned with the final image pixel grid (or sampling
pattern, if you're using something more complex than single-sample-at-the-pixel-
center ray tracing).
20.8 Texture Synthesis
We've suggested gathering textures from photographs (for the soda can) or from
data (mapping a world map onto a sphere) or from direct design (as in the 1D
texture used for contour rendering). If you want to create a texture that's unlike
anything seen before, you may want to use texture synthesis, a process for gener-
ating textures either ab initio or in some clever way from existing data. You might
have a photo of part of a brick wall, and wish to make an entire brick building
without the kind of obvious replication that wrapping from bottom to top and right
to left might produce, or you might want to make a hilly area via a displacement
map in which the displacements tend to produce rolling hills at a certain scale, but
without repetition. We'll now discuss a few approaches to these problems.
20.8.1 Fourier-like Synthesis
For the rolling-hills problem, one solution is a procedural texture, where you
assign a displacement in the form
n
1
d ( x , y )=
c i cos( a i x + b i y + c ) ,
(20.11)
i = 0
where the numbers a i , b i , and c i affect the orientation of the cosine waves, with
c i displacing the i th wave along its direction of propagation and with a i + b i
 
 
 
Search WWH ::




Custom Search