Graphics & Visualization
Chapter 14
Texturing
Graphics & Visualization: Principles & Algorithms Chapter 14
Texturing Graphics & Visualization: Principles & Algorithms - - PowerPoint PPT Presentation
Graphics & Visualization Chapter 14 Texturing Graphics & Visualization: Principles & Algorithms Chapter 14 Texturing Why? On every surface, the human visual system can detect: Small
Graphics & Visualization: Principles & Algorithms Chapter 14
Graphics & Visualization: Principles & Algorithms Chapter 14
Small imperfections, Geometric details, Patterns, Variations in material consistency
Determine the physical qualities of the various media
Need a different approach to modify the local material behavior across a
surface
2
Graphics & Visualization: Principles & Algorithms Chapter 14
3
Graphics & Visualization: Principles & Algorithms Chapter 14
Color of the surface Transparency of the surface Local normal at a given point Reflectivity at a given point
4
Graphics & Visualization: Principles & Algorithms Chapter 14
A 1-, 2-, or 3-D digital image (texture map) A procedurally generated material
5
Graphics & Visualization: Principles & Algorithms Chapter 14
Scalar value (as in case of surface's specular coefficient) Alpha value (transparency) Vector (signifying an RGB color value) New local normal vector …
Multiple textures can be applied to a single surface
6
Graphics & Visualization: Principles & Algorithms Chapter 14
pre-computed or hand-drawn or digitized
7
Graphics & Visualization: Principles & Algorithms Chapter 14
Association of 3-D Cartesian coordinates to the parametric domain of the
digital image
Extraction of material attribute values according to color intensity of
texture samples at the above parametric coordinates
8
Graphics & Visualization: Principles & Algorithms Chapter 14
9
Graphics & Visualization: Principles & Algorithms Chapter 14
Cartesian coordinates are mapped to texture coordinates Material attributes are estimated from the discrete texel values & applied
to the initial surface locations
10
Graphics & Visualization: Principles & Algorithms Chapter 14
11
Graphics & Visualization: Principles & Algorithms Chapter 14
12
Graphics & Visualization: Principles & Algorithms Chapter 14
13
Graphics & Visualization: Principles & Algorithms Chapter 14
Compute the scalar texel locations x & y that correspond to
Calculate interpolation coefficients for the horizontal and
14
· ·
x y
x u N y v N
' u x x v y y
Graphics & Visualization: Principles & Algorithms Chapter 14
15
Graphics & Visualization: Principles & Algorithms Chapter 14
16
bot top bot top
Graphics & Visualization: Principles & Algorithms Chapter 14
Texture coordinates for each vertex are assigned to them before the
polygon rasterization
Texture coordinates are determined from the local surface &
17
Graphics & Visualization: Principles & Algorithms Chapter 14
Texture parameters are assigned to vertices not transformed when
polygons are perspectively projected
The latter have not been divided by the depth value, as the projective
transformation dictates
18
Graphics & Visualization: Principles & Algorithms Chapter 14
Interpolate the (u, v)-coordinates after dividing them with the z vertex value The 1/z quantity is also interpolated from the projected vertex depth values Then, the perspectively correct parameters are obtained by dividing the
interpolated u/z & v/z parameters by the estimated 1/z
19
Graphics & Visualization: Principles & Algorithms Chapter 14
when progressively sampling the polygon surface in a regular manner or when the surface- and texture-coordinate parameterizations are coincident
single texture-coordinate sample is required at an arbitrary
We can use the barycentric coordinate representation of the
20
Graphics & Visualization: Principles & Algorithms Chapter 14
21
1 1 2 2 3 3
3
Graphics & Visualization: Principles & Algorithms Chapter 14
22 2 3 1 1 1 2 3 1 3 2 2 1 2 3 3 1 2 3 1 2 1 2 3
( ) , ( ) ( ) , ( ) ( ) 1 , ( ) A p A A A A p A A A A A A A p p p p p p p p p p p p p p p p
Graphics & Visualization: Principles & Algorithms Chapter 14
23
2 3 1 1 3 1 2 3 1 2 1 2 1 3 1 2 1 3
, , 1 pp pp p p p p p p p p p p p p
1 2 3 1 2 1 3
Graphics & Visualization: Principles & Algorithms Chapter 14
BUT more costly to perform should be used when a
24
1 1 2 2 3 3 1 1 2 2 3 3
Graphics & Visualization: Principles & Algorithms Chapter 14
Provides a simple mapping from the Cartesian domain to the
Arbitrary Cartesian coordinates predetermined “auxiliary”
Auxiliary surface parameters are normalized to represent
25
Graphics & Visualization: Principles & Algorithms Chapter 14
Texture-coordinate generation transformation should map a point in space
into the bounded domain of the image map: [0,1][0,1]
26
Graphics & Visualization: Principles & Algorithms Chapter 14
27
Graphics & Visualization: Principles & Algorithms Chapter 14
Location in space of the fragment being rendered Local surface normal vector
28
Graphics & Visualization: Principles & Algorithms Chapter 14
Uses a plane as an intermediate parametric surface Cartesian coordinates are parallelly projected onto the plane
(14.9)
Although an arbitrary plane can be used, selecting one that is axis-aligned
greatly simplifies the calculations
29
, ·
·
x y
u x x x a x v y y y b y
Graphics & Visualization: Principles & Algorithms Chapter 14
30
Graphics & Visualization: Principles & Algorithms Chapter 14
31
Graphics & Visualization: Principles & Algorithms Chapter 14
Usually u is derived from θ & v is calculated from the height h
32 1 2 2
tan ( / ), , ( ) x z h y r x z
Graphics & Visualization: Principles & Algorithms Chapter 14
33
Graphics & Visualization: Principles & Algorithms Chapter 14
34
1
Graphics & Visualization: Principles & Algorithms Chapter 14
35
1 1 2 2 2 2 2
Graphics & Visualization: Principles & Algorithms Chapter 14
36
Graphics & Visualization: Principles & Algorithms Chapter 14
37
, 2 2 / 2 / 2 a a u b b v
Graphics & Visualization: Principles & Algorithms Chapter 14
a whole line of the texture is typically mapped onto a single
38
Graphics & Visualization: Principles & Algorithms Chapter 14
Replace (x,y,z) point coordinates of Equation (14.13) with the
Light sources are considered to be infinitely far from the
39
Graphics & Visualization: Principles & Algorithms Chapter 14
40
Graphics & Visualization: Principles & Algorithms Chapter 14
41
Graphics & Visualization: Principles & Algorithms Chapter 14
42
Graphics & Visualization: Principles & Algorithms Chapter 14
43
Graphics & Visualization: Principles & Algorithms Chapter 14
44
Graphics & Visualization: Principles & Algorithms Chapter 14
45
x y z
Graphics & Visualization: Principles & Algorithms Chapter 14
46
1 ( 1), 2 1 ( 1) 2
c a c a
u u m v v m ( , , ) ( , , ) max{ , , }, ( , , ) ( , , ) max{ , , }, ( , , ) ( , , ) max{ , , }, ( , , ) ( , , ) max{ , , }, ( , , ) ( , , ) max{ ,
c c a z y x x x y z c c a z y x x x y z c c a x z y y x y z c c a x z y y x y z c c a x y z z x y
u v m v v v v v v v u v m v v v v v v v u v m v v v v v v v u v m v v v v v v v u v m v v v v v v , }, ( , , ) ( , , ) max{ , , }.
z c c a x y z z x y z
v u v m v v v v v v v
Graphics & Visualization: Principles & Algorithms Chapter 14
distant landscapes, buildings in cityscapes, sky boxes, and sky domes
47
Graphics & Visualization: Principles & Algorithms Chapter 14
48
Graphics & Visualization: Principles & Algorithms Chapter 14
49
Graphics & Visualization: Principles & Algorithms Chapter 14
50
Graphics & Visualization: Principles & Algorithms Chapter 14
51
Graphics & Visualization: Principles & Algorithms Chapter 14 52
Graphics & Visualization: Principles & Algorithms Chapter 14
53
Graphics & Visualization: Principles & Algorithms Chapter 14
54
Graphics & Visualization: Principles & Algorithms Chapter 14
missing depth information or gaps need to be extrapolated
55
Graphics & Visualization: Principles & Algorithms Chapter 14
56
Graphics & Visualization: Principles & Algorithms Chapter 14
An environment map is constructed from a fixed
57
Graphics & Visualization: Principles & Algorithms Chapter 14
58
Graphics & Visualization: Principles & Algorithms Chapter 14
59
Graphics & Visualization: Principles & Algorithms Chapter 14
render the object from a viewpoint that ensures maximum visibility &
project the image as a texture on the low-detail model
60
Graphics & Visualization: Principles & Algorithms Chapter 14
the local spacing of the texture coordinates the size of the primitive being textured
projection-transformation parameters viewport size distance from center of projection (perspective projection)
61
Graphics & Visualization: Principles & Algorithms Chapter 14
Interpolation methods used for extracting a texture value
Higher-order filtering generates far better images that can be
62
Graphics & Visualization: Principles & Algorithms Chapter 14
63
Graphics & Visualization: Principles & Algorithms Chapter 14
64
Graphics & Visualization: Principles & Algorithms Chapter 14
65
Graphics & Visualization: Principles & Algorithms Chapter 14
Texture super-sampling in image space ensure
Band-limit the original signal before rendering the
66
Graphics & Visualization: Principles & Algorithms Chapter 14
67
Graphics & Visualization: Principles & Algorithms Chapter 14
Provides a means for global antialiasing Contributes to the solution of texture aliasing problem when
Suffers from an obvious problem in the case of texture
Transposes aliasing problem higher in the spatial frequency
Poor solution in the case of real-time rendering algorithms
68
Graphics & Visualization: Principles & Algorithms Chapter 14
Contributing texels are first averaged (low-pass filtering) and
69
G
Graphics & Visualization: Principles & Algorithms Chapter 14
A naive box filter has an infinite impulse response (IIR), i.e., it has an
infinite support in the spatial domain
B-spline approximation to the Gaussian filter
70
Graphics & Visualization: Principles & Algorithms Chapter 14
71
Graphics & Visualization: Principles & Algorithms Chapter 14
Shape & area of a pixel‟s pre-image have to be estimated by
Texture values must be integrated over it
appropriately limit the texture spatial frequency avoid unnecessarily blurring of the texture 72
Graphics & Visualization: Principles & Algorithms Chapter 14
A filter kernel should be estimated for each pixel sampled
73
Graphics & Visualization: Principles & Algorithms Chapter 14
Filter kernel has a constant aspect ratio and orientation Variable size
Determine the proper kernel size obtain the proper pre-filtered version
74
Graphics & Visualization: Principles & Algorithms Chapter 14
75
Graphics & Visualization: Principles & Algorithms Chapter 14
76
i i
2
Graphics & Visualization: Principles & Algorithms Chapter 14
77
Graphics & Visualization: Principles & Algorithms Chapter 14
78
max
Graphics & Visualization: Principles & Algorithms Chapter 14
Far from the ideal filtering Does not take into account any affine transformation of the kernel BUT
usually works very well when an appropriate value for d is selected
Requires pre-computation of all combinations of mip-map sizes d is calculated individually for each texture coordinate
Poorly selected d failure to antialias the texture or blurring
79
Graphics & Visualization: Principles & Algorithms Chapter 14
80
2 2 2 2
max , u v u v x x y y
Graphics & Visualization: Principles & Algorithms Chapter 14
81
max max max
level level , lev l , 0, e d
2 max
Graphics & Visualization: Principles & Algorithms Chapter 14
82
Graphics & Visualization: Principles & Algorithms Chapter 14
83
Graphics & Visualization: Principles & Algorithms Chapter 14 84
Calculated from a mathematical model Derived in a procedural algorithmic manner
Does not use intermediate parametric space Often referred to as procedural shaders
A color triplet A normalized set of coordinates A vector direction A scalar value
directly and uniquely association with
Graphics & Visualization: Principles & Algorithms Chapter 14 85
An input to another procedural texture A mapping function to index a parametric
texture
proc proc proc
Graphics & Visualization: Principles & Algorithms Chapter 14 86
Not blurring when sampling a surface at a high resolution Not suffering from magnification problems
Graphics & Visualization: Principles & Algorithms Chapter 14 87
Graphics & Visualization: Principles & Algorithms Chapter 14 88
Act as a pseudo-number generator Also exhibit some more convenient & controllable properties
Graphics & Visualization: Principles & Algorithms Chapter 14 89
The procedural noise model must be memory-less
The new output should not depend on previous stages or past input values
Necessary if we want an uncorrelated train of outputs
The output has to be deterministic
Avoid dependence of the noise function on clock-based random generators
The output signal should be continuous and smooth
First-order derivatives should be computable
A white-noise generator is not useful
Should control the max (and min) variation rate of the pattern
Graphics & Visualization: Principles & Algorithms Chapter 14 90
Graphics & Visualization: Principles & Algorithms Chapter 14 91
, , i j k
Graphics & Visualization: Principles & Algorithms Chapter 14 92
, ,
i j k
, , i j k
3 2
1, 2 3 1 ( ) 1 t t t t t
Graphics & Visualization: Principles & Algorithms Chapter 14 93
is given by trilinear interpolation of the values γi,j,k of the 8 lattice points Ωi,j,k closest to p
use as the interpolation coefficient
γi,j,k is selected from a table G of N pre-computed uniformly distributed scalars using a common modulo-based hashing mechanism:
where P: table containing a pseudo-random permutation of the first N integers
noise( )
f p
( ) t t
, ,
G hash hash hash( ) , hash( ) P[ modN]
i j k
i j k n n
Graphics & Visualization: Principles & Algorithms Chapter 14 94
turb 1/ noise 1
i f i i
Graphics & Visualization: Principles & Algorithms Chapter 14 95
Graphics & Visualization: Principles & Algorithms Chapter 14 96
Appears as a scaled version of noise (p)
Larger values give a more swirling look to the result
ω = corresponds to the speed of motion
λ = simulates the entropy of the system under Brownian motion
1/ ( ) f
1/ noise 1
( ) · ( · )
i i f i
f f
p p
1/ ( ) f
f p
Graphics & Visualization: Principles & Algorithms Chapter 14 97
A bias to the input points
Part of a composite function
proc math turb proc math turb
( ) ( ) , ( ) ( · ( )) f f f f f a f p p p p p
Graphics & Visualization: Principles & Algorithms Chapter 14 98
checker( )
Graphics & Visualization: Principles & Algorithms Chapter 14 99
single Cartesian coordinates
spherical parameters
gradient( )
f y y p
Graphics & Visualization: Principles & Algorithms Chapter 14 100
A base mathematical expression
Turbulence
noise
wood 2 2 turb
( ) cos 2 , · ( ) f d d d y z a f p p
Graphics & Visualization: Principles & Algorithms Chapter 14 101
marble turb2
turb2 noise 1
1 ( ) sin 2 ( ) , 2 1 2 · 2
i i i
f x f f f f f
p p p
Graphics & Visualization: Principles & Algorithms Chapter 14 102
successively higher frequencies of the texture were overlaid on each other
what mechanism was employed to shrink the texture?
1 2 3
ˆ ˆ ˆ { , , , } L e e e o
1 2 3 1 1 2 3 1 2 3 1 2 3
ˆ ˆ ˆ ( , , ) ( ): ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ :{ , , , } ({ , , , }) x y z x y z x y z
p M p p
e e p
e e
M
gradientX 90, gradient gradient 90,
( ) ( ) ( · )
z z
f R f f
p p R p
Graphics & Visualization: Principles & Algorithms Chapter 14 103
1 proc proc
( ) · M f f
p M p
Graphics & Visualization: Principles & Algorithms Chapter 14 104
To alter the material characteristics of a surface
To modulate its geometry to create patterns in relief
To imitate the apparent effect of a bumpy surface without extra detail
Graphics & Visualization: Principles & Algorithms Chapter 14 105
Is a scalar-valued map used in both the displacement + bump mapping
Is the elevation pattern
The surface is highly tessellated from the beginning, or
An adaptive algorithm adds more surface elements at high slope areas
Graphics & Visualization: Principles & Algorithms Chapter 14 106
Graphics & Visualization: Principles & Algorithms Chapter 14 107
Only the normal vector contributes to the shading calculation
Calculate how the normal vector would be perturbed if the surface was elevated
The surface points are not actually moved
Graphics & Visualization: Principles & Algorithms Chapter 14 108
= the tangent vector
= the bitangent vector (also called binormal vector)
Graphics & Visualization: Principles & Algorithms Chapter 14 109
(u,v) (u,v) ˆ ˆ ˆ = = (2) u v
s s n u v
ˆ ( , ) ( , ) ( , ) ( , ) ˆ · ( , ) ( , )· , (3) ˆ ( , ) ( , ) ( , ) ( , ) ˆ · ( , ) ( , )· u v u v u v b u v b u v u v u u u u u v u v u v b u v b u v u v v v v v s s n n s s n n
Graphics & Visualization: Principles & Algorithms Chapter 14 110
Is expressed relative to the object world coordinate system
Depends only on the tangent vectors + the partial derivatives of the bump map
( , ) ( , ) ( , ) ( , ) ˆ ˆ ( , )· ( , )· , (4) ( , ) ( , ) ( , ) ( , ) ˆ ˆ ( , )· ( , )· u v u v b u v b u v u v u v u u u u u v u v b u v b u v u v u v v v v v s s n t n s s n b n ( , ) ( , ) ( , ) ( , ) ( , ) ( , ) ˆ ˆ ˆ ˆ ˆ ˆ ˆ · · · · · ( , ) ( , ) ˆ ˆ · · b u v b u v b u v b u v b u v b u v u v v u u v b u v b u v v u
n t n b n t b t n n b n n n n b t
Graphics & Visualization: Principles & Algorithms Chapter 14 111
(+): produces accurate elevation parallax (-) : has a high geometry tessellation
(+): very simple & convincing (-) : 1. poor representation on deep depressions
Graphics & Visualization: Principles & Algorithms Chapter 14 112
Uses as input an elevation image map (i.e. a grayscale elevation image)
Must transfer a pre-calculated relief pattern onto a model
The normal vector is stored as a color-coded triplet an a bitmap file
R,G,B components of the image c(u,v) keep properly scaled and quantized Cartesian coordinate values of the unit-length vector: where Nbits: the number of bits used for storing each color channel
Nbits
Graphics & Visualization: Principles & Algorithms Chapter 14 113
1. The normals can be calculated intuitively from high resolution surfaces and stored in normal maps on simplified texture-mapped version 2. Significantly fewer calculation to derive the local normal & perform shading
Need to be performed along with the object
When an object undergoes any kind of distortion, the object space normals are wrong and result in unconvincing images
Graphics & Visualization: Principles & Algorithms Chapter 14 114
Graphics & Visualization: Principles & Algorithms Chapter 14 115
ˆ ( )
L
n
V
Graphics & Visualization: Principles & Algorithms Chapter 14 116
Tangent
x y z x y z x y z
Graphics & Visualization: Principles & Algorithms Chapter 14 117
Calculate the object-space tangent vectors
Calculate the respective normalized ones
and t b
ˆ ˆ and u v
1 1 1 ˆ
Graphics & Visualization: Principles & Algorithms Chapter 14 118
2 1 2 1 2 1 3 1 3 1 3 1
ˆ ˆ, ˆ ˆ u u v v u u v v p p v v p p v v
2 21 21 3 31 31
ˆ ˆ, ˆ ˆ u v u v q u v q u v
2 2 2 21 21 3 3 3 31 31 x y z x y z x y z x y z
Graphics & Visualization: Principles & Algorithms Chapter 14 119
not normalized
possibly not even orthogonal.
2 2 2 31 21 3 3 3 31 21 21 31 31 21
1
x y z x y z x y z x y z
t t t q q q v v b b b q q q u u u v u v
Graphics & Visualization: Principles & Algorithms Chapter 14
An object is 1st partitioned into charts Each chart is parameterized so that the surface patch is unfolded on a 2-D
domain to ensure a unique mapping for each point in the chart
At this stage, texture-domain pieces may overlap Finally, individual map pieces & corresponding parameter ranges are
packed in a single texture charts no more overlap in texture space
120
Graphics & Visualization: Principles & Algorithms Chapter 14
Minimize texture distortion and artifacts Distribute the texels over the surface as evenly as possible Ensure continuity & conformity of mapping among the charts, if possible Maximize the area coverage of the charts & minimize the # of separate
charts
121
Graphics & Visualization: Principles & Algorithms Chapter 14
A number of objects of different volumes need to be packed into a finite
set of bins, while minimizing the vacant space
122
Graphics & Visualization: Principles & Algorithms Chapter 14
123
Graphics & Visualization: Principles & Algorithms Chapter 14
124
Graphics & Visualization: Principles & Algorithms Chapter 14
Unused space in the atlas texture is increased with the # of atlas elements Seams between adjacent textured patches are noticeable as the texture
parameterization changes in scaling or direction across the surface
125
Graphics & Visualization: Principles & Algorithms Chapter 14
126
proj texels total Charts proj 1
j
Graphics & Visualization: Principles & Algorithms Chapter 14
Surface is almost uniformly sampled & the texture atlas can be ideally
used for surface resampling or the mapping of pre-calculated illumination
127
texels texels
i i i i i i i
Graphics & Visualization: Principles & Algorithms Chapter 14
“Active texels”: Texels actually mapped to the polygons after shrinking
the texture coordinates
“Sand texels”: Unused pixels left in the atlas element outside the active
texels (guard space)
128
Graphics & Visualization: Principles & Algorithms Chapter 14
129
sand sand sand sand sand
2 2 1 1 , · ,
i i i i i i
w N h N N N w h w h M T S
Graphics & Visualization: Principles & Algorithms Chapter 14
130
Graphics & Visualization: Principles & Algorithms Chapter 14
131
Graphics & Visualization: Principles & Algorithms Chapter 14
132
Graphics & Visualization: Principles & Algorithms Chapter 14
Insert the bulkiest subtextures first Avoid any unnecessary fragmentation of the available space
133
Graphics & Visualization: Principles & Algorithms Chapter 14
Furthermore, leaving some guard space requires chunks of at least 3x3
pixels
134
Graphics & Visualization: Principles & Algorithms Chapter 14
class TreeNode { //DATA MEMBERS: //atlas texture area extents subtended by the node int width, height, xmin, ymin, xmax, ymax; //node type: branch (vert/horiz), empty, leaf (atlas element) int type; // In case of leaf node, pointer to allocated element bitmap TextureMap *map; //MEMBER FUNCTIONS: TreeNode(TreeNode *parent, int minx, int maxx, int miny, int maxy); bool isBranch(); bool isLeaf();bool insert(Element * element); }
135
Graphics & Visualization: Principles & Algorithms Chapter 14
bool TreeNode::insert (Element * element) { // Case A. terminal, occupied node: cannot insert if (isLeaf ()) return false; // CASE B. Branch node, try inserting in children nodes if (isBranch()) { if (child[0]->insert (element)) // try to insert in left child return true; else if (child[1]->insert (element)) // failed, try the right child return true; else // failed, element cannot fit return false; }
136
Graphics & Visualization: Principles & Algorithms Chapter 14
//CASE C. Unused node, try inserting element //1) Check if the remaining space is adequate for this element if (width < element->width || height < element->height) { // doesn't fit as is, try to fit it sideways: if (height < element->width || width < element->height) { // doesn't fit either way, insertion failed return false; } else // fits sideways, rotate the element by swapping params element->swapUVs (); }
137
Graphics & Visualization: Principles & Algorithms Chapter 14
// 2)Choose splitting direction, split space and insert element
if (width - element->width >= height - element->height) { //i. if the map leaves more space horizontally, split the // cell horizontally, creating a left and a right child type = NODE_HORIZONTAL_SPLIT; child[CHILD_LEFT] = new TreeNode (this, xmin, xmin + element->width - 1, ymin, ymax); child[CHILD_RIGHT] =new TreeNode (this, xmin + element->width, xmax, ymin, ymax); // Now split the left child vertically into: //a leaf node (top)... child[CHILD_LEFT]->type = NODE_VERTICAL_SPLIT; child[CHILD_LEFT]->child[CHILD_TOP] = new TreeNode (child[CHILD_LEFT], xmin, xmin + element->width - 1, ymin, ymin + element->height - 1); child[CHILD_LEFT]->child[CHILD_TOP]->type = NODE_LEAF; child[CHILD_LEFT]->child[CHILD_TOP]->map = element->map;
138
Graphics & Visualization: Principles & Algorithms Chapter 14
// ... and an empty node (bottom) child[CHILD_LEFT]->child[CHILD_BOTTOM] = new TreeNode (child[CHILD_LEFT],xmin, xmin + element->width - 1, ymin + element->height, ymax); } else { // ii. split the cell vertically, creating a top and bottom child type = NODE_VERTICAL_SPLIT; child[CHILD_TOP] = new TreeNode (this,xmin, xmax, ymin, ymin + element->height - 1); child[CHILD_BOTTOM] = new TreeNode (this,xmin, xmax, ymin + element->height, ymax);
139
Graphics & Visualization: Principles & Algorithms Chapter 14
// Now split the top child into a leaf node (left)...
child[CHILD_TOP]->type = NODE_HORIZONTAL_SPLIT; child[CHILD_TOP]->child[CHILD_LEFT] =new TreeNode (child[CHILD_TOP], xmin, xmin + element->width – 1,ymin, ymin + element->height - 1); child[CHILD_TOP]->child[CHILD_LEFT]->type = NODE_LEAF; child[CHILD_TOP]->child[CHILD_LEFT]->map = element->map; // ... and an empty node (right) child[CHILD_TOP]->child[CHILD_RIGHT] =new TreeNode child[CHILD_TOP], xmin + element->width, xmax,ymin,ymin + element->height - 1); } return true; }
140
Graphics & Visualization: Principles & Algorithms Chapter 14
Suitable for large polygon charts with low compactness Operates in the discrete texture space
Rotate the charts so that their longest diameter is vertically aligned Sort charts according to height and insert into the atlas Incoming charts are stacked on top of the existing clusters in the atlas Topmost texels occupied by the charts already in the atlas form a
“horizon”, which the new chart's underside texels (“bottom horizon”) cannot penetrate
New chart's position is optimized so that the space left between the
existing horizon and the bottom horizon is minimized
Then, horizon is updated, taking into account the upper texels of the new
chart
141
Graphics & Visualization: Principles & Algorithms Chapter 14
A 3-D model is parameterized into a texture atlas (light map or
illumination map) & the incident direct & indirect diffuse illumination is stored in the texels of the map
Geometry is part of a static environment Moving objects' contribution to diffuse illumination is negligible
142
Graphics & Visualization: Principles & Algorithms Chapter 14
Separate set of parameters for light mapping is stored on the polygon
vertices
Making rendering overhead of the pre-calculated illumination negligible
143
Graphics & Visualization: Principles & Algorithms Chapter 14
Above efficient 3-D representation provides a regular sampling of the
surface and can be used for 3-D pattern recognition (on 2D input data), easy multi-resolutional object representation, fast transmission, re- meshing & many other important applications
144
Graphics & Visualization: Principles & Algorithms Chapter 14
145
Graphics & Visualization: Principles & Algorithms Chapter 14
Allow the creation of material libraries consisting of basic, reusable
building blocks that can be combined in an easy & reconfigurable manner to produce the final result
In real-time rendering, texture trees are implemented via the use of
multiple texture units & hardware texture combiners, along with fragment shader programs that are executed in the GPUs' programmable cores
146
Graphics & Visualization: Principles & Algorithms Chapter 14
147
Graphics & Visualization: Principles & Algorithms Chapter 14
148