4. The problem of Visibility – Occlusion.
The problem of Visibility Occlusion.
Problem Definition:
Given a set of 3 D surfaces to be
Given a set of 3-D surfaces to be
projected onto a 2-D screen, obtain the
nearest surface corresponding to any point
nearest surface corresponding to any point
on the screen.
Two types of methods used:
• Object-space methods (Continuous):
Compares parts of objects to each other
to determine which surfaces should be labeled
to determine which surfaces should be labeled
as visible (use of bounding boxes, and check
limits along each direction).
g )
5. Order the surfaces being drawn, such
that it provides the correct impression of
p p
depth variations and positions.
Image Space methods (discrete):
Image Space methods (discrete):
Visibility is decided point by point at
Visibility is decided point by point at
each pixel position on the projection plane.
Screen resolution can be a limitation.
Hidden Surface – (a) Surface for rendering
Hidden Surface – (a) Surface for rendering
or
(b)Line drawing
(b)Line drawing
6. Coherence properties:
Coherence properties:
• Object Coherence – If one object is entirely
Object Coherence If one object is entirely
separate from another, do not compare.
• Face Coherence – smooth variations across a
face; incrementally modify.
; y y
• Edge Coherence – Visibility changes if a
edge crosses behind a visible face.
• Implied edge coherence – Line of
intersection of a planar face penetrating
another, can be obtained from two points on
the intersection.
7. • Scanline coherence Successive lines have
• Scanline coherence – Successive lines have
similar spans.
• Area Coherence – Span of adjacent group
of pixels is often covered by the same
of pixels is often covered by the same
visible face.
• Depth Coherence – Use difference equation
to estimate depths of nearby points on the
to estimate depths of nearby points on the
same surface.
• Frame Coherence – Pictures of two
successive frames of an animation
sequence are quite similar (small changes
in object and viewpoint).
j p )
8. Different Visible Surface
Different Visible Surface
Detection Methods:
• Back-face Detection
• Depth (Z) buffer method
Depth (Z) buffer method
• Scan-line method
• Depth-sorting method
ept so t g et od
• Area-subdivision method
• Octree methods
• A-buffer method
• BSP Trees
• Ray casting method
Vi ibl f h i 3D
Visible surface techniques are 3D
versions of sorting algorithms
b i ll d th
– basically compare depth.
9. Back face Culling or removal
g
A Polygon (in 3D) is a back face if:
V N > 0
V.N > 0.
Let V = (0 0 V ) and N = Ai + Bj + Ck
Let V = (0, 0, Vz) and N = Ai + Bj + Ck.
Then V N = V C;
Then V.N = Vz.C;
Let V be +ve (view along +ve Z-direction)
Let Vz be +ve (view along +ve Z-direction),
Check the sign of C.
Check the sign of C.
Condition of back face is thus:
Condition of back face is thus:
sgn(C) > 0.
What happens if
V N 0 ??
V. N = 0 ??
11. How to get normal vector (N) for a
g ( )
3D surface, polygon ?
Q
R
P
φ
R = P X Q
P
-R
Order of vertices for calculation
of N w r t the front side of the surface
of N – w.r.t the front side of the surface.
Brighter
Side
Darker
side
Side side
12. T k th d f ti t b
Take the order of vertices to be
counter-clockwise for the brighter side.
Take the case of a cube:
Exterior faces of a cube:
13. You can choose any two vectors (edges)
to obtain the normal to the surface.
Any risks in such a case, if we randomly
choose any two vectors?
Better Solution to obtain the direction
cosines of N:
cosines of N:
Assume )
Z
)(Z
Y
(Y
a j
i
j
n
i
+
−
=
n vertices
of the 1
i
j
where
)
X
)(X
Z
(Z
b j
i
j
n
i
1
i
+
=
+
−
=
=
polygon:
(Xi, Yi, Zi);
j
)
Y
)(Y
X
(X
c
)
)(
(
n
j
i
j
1
i
i
+
=
=
i i i
i=1,2,…,n.
1
j
n
i
If
)
Y
)(Y
X
(X
c j
i
j
1
i
i
=
=
+
−
=
=
Compute: 1
j
n,
i
If =
=
Compute:
14. n
)
Z
)(Z
Y
(Y
a
n
j
i
j
1
i
i
+
−
=
=
1
i
j
where
)
X
)(X
Z
(Z
b j
i
j
n
1
i
i
+
=
+
−
=
=
)
Y
)(Y
X
(X
c j
i
j
n
1
i
i
+
−
=
=
1
j
n,
i
If
1
i
=
=
T k th i f “ ”
Take the expression of “c”:
Can you relate that to one property of
the 2 D pol gon in X Y plane?
a, b and c also describe the projection
the 2-D polygon in X-Y plane?
surface of the polygon on the Y-Z, Z-X and
X-Y planes (or along the X, Y and Z axis)
i l
respectively.
15. 1 2 1 2 2 3 2 3 3 1 3 1
( )( ) ( )( ) ( )( )
c X X Y Y X X Y Y X X Y Y
= − + + − + + − +
If A is the total area of the polygon the
1 2 3 2 3 1 3 1 2
( ) ( ) ( )
X Y Y X Y Y X Y Y
= − + − + −
If A is the total area of the polygon, the
projected areas are:
AYZ = a/2; AXZ = b/2; AXY = c/2;
The surface normal appears to be
i ti t d F i t d th i
pointing outwards. Facing towards the viewer,
the edges of the polygon appears to be drawn
counter clockwise
counter-clockwise.
The polygon is a back face, if c > 0
p yg ,
If the view direction is along the –ve Z-
di i h b di i b
direction, the above condition becomes:
c < 0
16. D b k f b k f lli
Drawbacks of back face culling:
P ti ll hidd f t b d t i d
• Partially hidden faces cannot be determined
by this method
• Not useful for ray tracing, or photometry/
radiosity
radiosity.
However this is still
However, this is still
useful as a pre-processing
step as almost 50% of the
step, as almost 50% of the
surfaces are eliminated.
18. Each (X,Y,Z) point on a polygon
( , , ) p p yg
surface, corresponds to the orthographic
projection point (X, Y) on the view plane.
projection point (X, Y) on the view plane.
At each point (X, Y) on the PP,
object depths are compared by using
object depths are compared by using
the depth(Z) values.
19. Assume normalized coordinates:
(FCP) Zmax > Z > 0 (BCP), where Zmax = 1.
Two buffer areas are used:
Two buffer areas are used:
(i) Depth (Z) buffer: To store the depth
(i) Depth (Z) buffer: To store the depth
values for each (X, Y) position, as
surfaces are processed.
surfaces are processed.
(ii) Refresh Buffer: To store the intensity
( ) y
value at each position (X, Y).
21. Steps for Processing:
max
Z
Y)
depth(X,
Y)
(X
=
∀
(a) Initialize
B
I
Y)
refresh(X,
Y)
(X,
=
∀
IB = background
intensity
(b) For each position on each polygon surface:
intensity
(b) For each position on each polygon surface:
(i) Calculate depth Z for each position
( ) p p
(X, Y) on the polygon.
(ii) If Z < depth(X, Y) then
depth (X, Y) = Z;
refresh (X, Y) = Is (X, Y)
22. I is the projected intensity value of the
Is is the projected intensity value of the
surface at position (X, Y), which has the
minimum value of Z at the current stage of
:
surface
the
of
Equation
minimum value of Z, at the current stage of
iteration.
Calculation of Z:
0;
D
CZ
BY
AX
:
surface
the
of
Equation
=
+
+
+
Calculation of Z:
C
D
BY
AX
Z
−
−
−
=
C
Equation for Z at the next scan line:
Equation for Z at the next scan line:
Remember scanline/Polyfill algorithm?
U i d h t f th t
Using edge coherence, we get for the next
scanline (Y+1):
X’ = X 1/m;
X’ = X -1/m;
23. Y
Y
Y-1
X X+1
X X+1
;
A
Z
Z X
1
X
−
=
+
A
;
C
Z
Z X
1
X +
;
C
B
m
A
Z
Z Y
1
Y
+
+
=
+
C
Y
1
Y +
F ti l d Z’ Z B/C
For a vertical edge: Z’ = Z + B/C;
24. So to implement the algorithm three
So to implement the algorithm, three
constants are required for each surface:
B
B)
A
(
A
+
C
B
,
C
)
m
(
,
C
A
−
C
C
C
Wh t i th i l diti C 0?
What is the special condition, C = 0?
Using the above three constants, we can
Using the above three constants, we can
keep calculating the successive depth values
along and for successive scanlines. Similar
g
approaches can be used for curved surfaces:
Z = f(X, Y).
( )
25. Z Buffer Algo:
Z-Buffer Algo:
for all (x,y)
depth(x y) = -∞ /* Watch this change */
depth(x,y) = -∞ /* Watch this change */
refresh(x,y) = IB
for each polygon P
for each position (x,y) on polygon P
for each position (x,y) on polygon P
calculate depth z
if z > depth(x,y) then
1. depth(x,y) = z
p ( ,y)
2. refresh(x,y) = IP(x,y)
Lets take an example
Lets take an example
30. SCAN-LINE Algorithms (for VSD)
SCAN LINE Algorithms (for VSD)
Extension of 2-D Scanline (polyfill) algorithm.
Here we deal with a set of polygons.
Data structure used:
ET (Edge Table),
ET (Edge Table),
AET (Active Edge Table) and
PT (Polygon Table).
( yg )
Edge Table entries contain information
about edges of the polygon, bucket sorted
based on each edge’s smaller Y coordinate.
Entries within a bucket are ordered by
i i X di t f th i d i t
increasing X-coordinate of their endpoint.
31. Structure of each entry in ET:
Structure of each entry in ET:
• X-Coordn. of the end point with the smaller
Y-Coordn.
• Y-Coordn. of the edge’s other end point
• ΔX = 1/m
• Polygon ID X Ymax ΔX ID
Structure of each entry in PT:
• Coefficients of the plane equations
• Shading or color information of the polygon
• Flag (IN/OUT), initialized to ‘false’
ID
Plane
Coeffs.
Shading
Info.
IN/OUT
Coe s
32. Take Adjacent (not successive) pairs of intersections to fill;
FILL (within pair) if POLY_FLAG is set to IN.
B E
L1
L1
L2
L3
C
D
F
L4
A
F
L5
L3
ABC IN;
DEF OUT
ABC IN;
DEF IN.
ABC OUT;
DEF IN.
Compare Z values in this region
Compare Z values in this region
to find the visible Z value.
34. Three non intersecting pol gons
Three non-intersecting polygons
B
E
I
J E
J
D C
F
A
A
G H
GHIJ is behind ABC and DEF.
GHIJ is behind ABC and DEF.
35. So, when scanline leaves edge BC, it is
still inside polygons DEF and GHIJ. If
still inside polygons DEF and GHIJ. If
polygons do not intersect, depth calculations
and comparisons between GHIJ and DEF can
p
be avoided.
Thus depth computations are
unnecessary when the scanline leaves an
obscured polygon. It is required only when it
leaves an obscuring polygon.
Additional treatment is necessary for
i i l
intersecting polygons.
37. Depth-sorting or Painter’s Algorithm
ept so t g o a te s go t
Paint the polygons in the frame buffer
in order of decreasing distance from the
viewpoint.
S f t d i i i d
Broad Steps:
• Surfaces are sorted in increasing order
of DEPTH.
• Resolve ambiguities when polygons
overlap (in DEPTH), splitting polygons
overlap (in DEPTH), splitting polygons
if necessary.
• Surfaces are scan converted in order
• Surfaces are scan converted in order,
starting with the surface of greatest
DEPTH
DEPTH.
38. Principle:
Each layer of paint (polygon surface of
an object) covers up the previous layers
hil d i
while drawing.
S1
ZMax1
S2
ZMin1
ZMax2
S2
ZMin2
X
X
Z
39. Since, ZMin1 > ZMax2 no overlap occurs.
, Min1 Max2 p
S1 is first scan converted, and then S2.
This goes on, as long as no overlap occurs.
g g
S1
ZMax1
S2
ZMin1
ZMax2 S2
ZMin2
Max2
X
V
Z
If depth overlap occurs, additional
If depth overlap occurs, additional
comparisons are necessary to reorder the
surfaces.
surfaces.
The following set of tests are used to
ensure that no re-ordering of surfaces is
g
necessary:
40. Four(4) Tests in Painter’s algorithm
Four(4) Tests in Painter’s algorithm
1.The boundary rectangles in the X-Y plane
for the two surfaces do not overlap.
2.Surface S is completely behind the
overlapping surface relative to the viewing
position.
3.The overlapping surface is completely in
f t f S l ti t th i i iti
front of S relative to the viewing position.
4 The projections of the t o s rfaces onto
4.The projections of the two surfaces onto
the view plane do not overlap.
41. T b f d i d ifi d
Tests must be performed in order, as specified.
Condition to RE-ORDER the surfaces:
If any one of the 4 tests is TRUE, we
proceed to the next overlapping surface. i.e.
If all overlapping surfaces pass at least one of
the tests, none of them is behind S.
No re-ordering is required, and then S is
scan converted.
scan converted.
RE-ORDERing is required if all the four
RE ORDERing is required if all the four
tests fail.
42. TEST #1:
TEST #1:
The boundary rectangles in the X-Y
plane for the two surfaces do not overlap
plane for the two surfaces do not overlap.
We have depth overlap but no overlap
We have depth overlap, but no overlap
in X-direction.
Hence, Test #1 is passed, scan convert
S2 and then S1.
S2
S1
S2
If we have X
overlap, check
f th t
X
Z X1 X2 X3
X4
for the rest.
1 2 3
43. TEST #2:
TEST #2:
Surface S is completely behind the
overlapping surface relative to the viewing
overlapping surface relative to the viewing
position.
S1
S1
S2
X
Z
Fig. 1. S1 is completely behind/inside the
Fig. 1. S1 is completely behind/inside the
overlapping surface S2
44. TEST #3:
TEST #3:
The overlapping surface is completely in
f t f S l ti t th i i iti
front of S relative to the viewing position.
S1 is not completely behind S2
S1
S1 is not completely behind S2.
So, Test #2 fails.
S2
S1
Fig. 2. Overlapping
f S2 i l t l
surface S2 is completely
front/outside S1.
Z X
In Fig. 2, S2 is in front of S1, but S1 is
not completely inside S2 – Test #2 it not TRUE
or FAILS, although Test #3 is TRUE.
45. How to check these conditions?
How to check these conditions?
i) Set the plane equation of S2, such that the
surface S2 is towards the viewing position.
ii) Substitute the coordinates of all vertices of
ii) Substitute the coordinates of all vertices of
S1 into the plane equation of S2 and check
for the sign
for the sign.
iii) If all vertices of S1 are inside S2 then
iii) If all vertices of S1 are inside S2, then
S1 is behind S2. (Fig. 1).
i ) If ll i f S1 id S2 S1 i
iv) If all vertices of S1 are outside S2, S1 is
in front of S2.
46. TEST #4:
Th j ti f th t f t
The projections of the two surfaces onto
the view plane do not overlap.
S2
S1
Z X
47. Four(4) Tests in Painter’s algorithm
Four(4) Tests in Painter’s algorithm
- revisited
1.The boundary rectangles in the X-Y plane
for the two surfaces do not overlap
for the two surfaces do not overlap.
2 Surface S is completely behind the
2.Surface S is completely behind the
overlapping surface relative to the viewing
position
position.
3 The overlapping surface is completely in
3.The overlapping surface is completely in
front of S relative to the viewing position.
4.The projections of the two surfaces onto
the view plane do not overlap.
the view plane do not overlap.
48. T b f d i d ifi d
Tests must be performed in order, as specified.
Condition to RE-ORDER the surfaces:
If any one of the 4 tests is TRUE, we
proceed to the next overlapping surface. i.e.
If all overlapping surfaces pass at least one of
the tests, none of them is behind S.
No re-ordering is required, and then S is
scan converted.
scan converted.
RE-ORDERing is required if all the four
RE ORDERing is required if all the four
tests fail.
50. Case Study I
Case Study - I
S2
S1
X
X
Z
I iti l d
Initial order:
S1 -> S2
Change the order:
S2 > S1
S2 -> S1
51. C S d II
S3
Case Study - II
S1 S2
S3
Initial Order:
S1 -> S2 -> S3
X
S1 -> S2 -> S3.
S1 -> S2 X
Z
S1 -> S2,
Test 1 passed.
Check S1, S3. All tests fail.
Interchange. S3 -> S2 -> S1.
Check S2 and S3. All tests fail again.
Correct Order: S2 -> S3 -> S1.
52. P f h ki th d
Process of checking the order,
results in an infinite loop.
Avoided by setting a FLAG for a
surface that has been re ordered
surface that has been re-ordered
or shuffled. If it has to be altered
again split it into two parts
again, split it into two parts.
53. 0
0 0
Y -0.5 -0.5
Y
0
0
0 5
0 5 -0.5
-0.5
S1
S2 S1
S2
0
0 0
0.5 0.5 0
0
0.5 0.5
X
0 0
Fig A
X
0
Fig. B
What happens in these cases ?
Fig. A Fig. B
What happens in these cases ?
54. Area sub-division method
Examine and divide if necessary
• Works in image-space
y
Works in image space
• Area Coherence is exploited
Area Coherence is exploited
• Divide-and-conquer strategy.
q gy
WARNOCK’s
WARNOCK s
Algorithm
55. Possible relationships of the area of interest
(rectangular, AOI) and the projection of the
g j
polygon:
1 Surrounding polygons are completely
1.Surrounding polygons are completely
overlapping the area of interest.
2. Intersecting polygons intersect the area.
3. Contained polygons are completely inside
the area.
4. Disjoint polygons area completely outside
j p yg p y
the area.
56. Four cases of Polygon position w.r.t rectangular AOI.
yg p g
Intersecting
S di
Surrounding
Contained
Disjoint
57. Treat interior part of the intersection
Treat interior part of the intersection
and contained as equivalent. Disjoint is
irrelevant The decisions about division of an
irrelevant. The decisions about division of an
area is based on:
1.All polygons are disjoint from the area.
Display background color.
p y g
2.Only one intersecting part or interior
y g p
(contained): Fill the area with background
color and then scan-convert the polygon.
3.Single surrounding polygon, and no
intersecting or contained polygon. Use
color of surrounding polygon to shade the
area.
58. 4. More than one polygon intersect, contained
in and surrounding the area. But the
surrounding polygon is in front of all other
l Th fill h i h h l
polygons. Then fill the area with the color
of the surrounding polygon.
Step 4 is implemented by comparing the
Z-coordinates of the planes of all polygons
p p yg
(involved) at the four corners of the area
If all four tests fail divide the
If all four tests fail, divide the
rectangular area into four equal parts.
Recursively apply this logic, till you reach
the lowest minimum area or maximum
the lowest minimum area or maximum
resolution – pixel size.
Use nearest surface in that case to
Use nearest surface in that case to
paint/shade.
59. X Decision – Step 4
X Decision Step 4
X
Z
Z
Intersection with:
Contained Polygon Surrounding
Polygon
Intersecting Polygon
Polygon
60. Four cases of Polygon position w.r.t rectangular AOI.
yg p g
Intersecting
S di
Surrounding
Contained
Disjoint
66. Salient feat es
Salient features:
• Identify surfaces that are inside/front and
outside/back w.r.t. the partitioning plane at
each step of the space division, relative to
the viewing direction.
• Start with any plane and find one set of
bj t b hi d d th t i th f t
objects behind and the rest in the front.
In the tree the objects are represented as
• In the tree, the objects are represented as
terminal nodes with front objects as left
branches and back objects as right
branches and back objects as right
branches.
67. • BSP tree’s root is a polygon selected from
those to be displayed.
• One polygon each from the root polygon’s
front and back half plane, becomes its front
and back children
h l i h i h h d
• The algorithm terminates when each node
contains only a single polygon.
• Intersection and sorting at object space/
i i
precision
71. Also see:
potential visibility sets;
Other applications:
• Robot navigation
KD trees, R+-trees;
• Robot navigation
• Collision Detecion
Bounding Volume Hierarchy (BVH)
and
• GIS
and
Shadow Volume BSP Tree (SVBSP) • Image Registration
72. Display list of a BSP tree
p y
• BSP tree may be traversed in a “modified in-
order tree” walk to yield a correctly priority-
order tree walk to yield a correctly priority-
ordered polygon list for an arbitrary
viewpoint
viewpoint.
• If the viewer is in the root polygon’s front
half space the algorithm must first display:
half space, the algorithm must first display:
1.All polygons in the root’s rear half-
space
space.
2.Then the root.
3.And finally all polygons in the front
• Use back face culling
3.And finally all polygons in the front
half-space.
• Use back face culling
• Each of the root’s children is recursively
processed
processed.
73. Disadvantages
– more polygon splitting may occur than
g
more polygon splitting may occur than
in Painter's algorithm
– appropriate partitioning hyperplane
selection is quite complicated and
selection is quite complicated and
difficult
Finding Optimal BSP:
Finding an optimal root node is by testing a small
number of candidates.
o
The node that results in the smallest number of
d i th BSP t h ld b h
nodes in the BSP tree should be chosen
76. Figure for illustrating
VSD R T i
VSD - Ray Tracing
In reality, possibilities with a light ray:
absorption, reflection, refraction, scattering, fluorescence or
o p o , o , o , g, o o
chromatic aberration (error in lens).
77. Remember? For Z-buffer:
Each (X,Y,Z) point on a polygon surface,
corresponds to the orthographic projection
corresponds to the orthographic projection
point (X, Y) on the view plane.
At each point (X, Y) on the PP, object
depths are compared by using the depth(Z)
l
values.
For Ray-tracing:
• Shoot ray from eye point through pixel (x,y)
• Shoot ray from eye point through pixel (x,y)
into scene
• Intersect with all surfaces, find first one the
ray hits
y
78. F R t i ( t’d)
For Ray-tracing (cont’d):
Li f Si ht f h i l i i t t d
• Line of Sight of each pixel is intersected
with all surfaces
• Shade that point to compute the color of
pixel (x y)
pixel (x,y)
• Consider only the closest surface for shading
• Consider only the closest surface for shading
• Based on optics of image formation paths of
• Based on optics of image formation, paths of
light rays are traced
• Light rays are traced backward
79. For Ray tracing (cont’d):
For Ray-tracing (cont d):
• Suitable for complex curved surfaces
• Computationally expensive
d f ffi i f i i
• Need of an efficient ray-surface intersection
technique
• Almost all visual effects can be generated
g
• Can be parallelized
Can be parallelized
• Has aliasing problems
Has aliasing problems
80. Mathematically, the intersection
problem is of finding the roots of an equation:
problem is of finding the roots of an equation:
Surface – RAY = 0;
Surface RAY = 0;
Ray Equation: r(t) = t (P – C)
Ray Equation: r(t) = t (P C)
Eqns. for
2
2
2
2
0
0
0 ;
;
; z
t
z
z
y
t
y
y
x
t
x
x Δ
+
=
Δ
+
=
Δ
+
=
LINE:
2
2
2
2
)
(
)
(
)
( r
c
z
b
y
a
x =
−
+
−
+
−
SPHERE:
81. Substitution
2
2
)
(
2
)
( a
x
t
x
a
x
t
x +
Δ
+
Δ
+
Substitution
gives us:
2
2
0
0
)
(
2
)
(
)
(
2
)
(
b
y
t
y
b
y
t
y
a
x
t
x
a
x
t
x
+
Δ
+
Δ
+
+
+
Δ
+
−
Δ
+
2
2
2
0
0
)
(
2
)
(
)
(
2
)
(
r
c
z
t
z
c
z
t
z
b
y
t
y
b
y
t
y
=
+
Δ
+
−
Δ
+
+
+
Δ
+
−
Δ
+
+
0
0 )
(
2
)
( r
c
z
t
z
c
z
t
z =
+
Δ
+
−
Δ
+
+
Collecting terms
Collecting terms
gives us:
)
( 2
2
2
2
Δ
Δ
Δ t
)]
(
)
(
)
(
[
2
)
(
0
0
0
2
2
2
2
−
Δ
+
−
Δ
+
−
Δ
+
Δ
+
Δ
+
Δ
c
z
z
b
y
y
a
x
x
t
t
z
y
x
0
)
(
)
(
)
(
)]
(
)
(
)
(
[
2
2
2
0
2
0
2
0
0
0
0
=
−
−
+
−
+
−
+
Δ
+
Δ
+
Δ
r
c
z
b
y
a
x
c
z
z
b
y
y
a
x
x
t
)
(
)
(
)
( 0
0
0 y
82. The Equation is Quadratic, with
The Equation is Quadratic, with
coefficients from the constants of sphere and
ray equations.
Cases:
ray equations.
• No real roots - Surface and ray do
not intersect
• One real root - Ray tangentially
grazes the surface
T l t F b th
• Two real roots - From both
intersections, get
th ith th
the one with the
smallest value of t.
83. What is the shade, at that point of
i t ti ?
intersection?
Sphere has center (a, b, c).
Sphere has center (a, b, c).
The surface normal at any point of
The surface normal at any point of
intersection is:
c
z
b
y
a
x −
−
−
]
,
,
[
r
c
z
r
b
y
r
a
x p
p
p
r
r
r
What about intersection with other (regular) non-
linear surfaces ??
G i
• Gaussian
• Ellipsoid
• Directional sinusoid
• Directional sinusoid
• Torus
84. Eqns. for
0
;
;
; 0
0
0
+
+
+
Δ
+
=
Δ
+
=
Δ
+
=
D
C
B
A
z
t
z
z
y
t
y
y
x
t
x
x
LINE :
0
=
+
+
+ D
Cz
By
Ax
PLANE :
Substitution gives us:
Substitution gives us:
)
( 0
0
0 D
Cz
By
Ax
t
+
+
+
=
)
( z
C
y
B
x
A
t
Δ
+
Δ
+
Δ
−
=
• Denominator should not be zero;
• Find if intersection is within the polygon, by
projecting onto a suitable coordinate plane;
• Overall processing is ray-wise, not
l i
polygon-wise.
85. Read about:
• Stochastic/Distributed Ray Tracing (Monte Carlo on Graphics)
• Global Illumination
R di it
• Radiosity
Th M t li li ht t t (MLT) SIGGRAPH 1997
• The Metropolis light transport (MLT) - SIGGRAPH 1997
• Bi directional Ray Tracing
• Bi-directional Ray Tracing
86. Rendering with global illumination: Light is reflected by
surfaces, and colored light transfers from one surface to
another Color from the red wall and green wall (latter not
another. Color from the red wall and green wall (latter not
visible) reflects onto other surfaces in the scene. Also
notable is the caustic projected onto the red wall from
li ht i th h th l h
light passing through the glass sphere.
88. Comparison of VSD (HSR) techniques
p ( ) q
Algorithms/
Memory Speed
Methods
Memory Speed
Z B ff
Two Depth
Z-Buffer
Two
arrays
Depth
complexity
Apriori
Painter’s
One
array
Apriori
sorting helps
d
y
speed-up
Object O(#pixels,
Ray casting data
base
( p
#surfaces or
objects)
Scanline, Area
sub-division
- Slowest
sub division
89. Algorithms Issues in
Remarks
/Methods Implementation
Remarks
Z B ff
Scan conversion,
C l d
Z-Buffer
,
Hardware
Commonly used
Splitting and
Painter’s Scan conversion
Splitting and
sorting the
major
major
bottleneck
Excellent
Ray casting
Spatial data
structures help
Excellent
for CSG,
h d
y g p
speedup shadows,
transparency
Scanline, Area
sub-division
Hard
Cannot be
generalized for non-
sub division
polygonal models.
90. VSD - “Visible Surface Detection”
i l ll d
is also called:
Hidden Surface Elimination (HSE); Also: HSR, OC.
So, what is HLE:
Hidden Line Elimination.
Problem:
Take any VSD algorithm and
convert to an HLE algorithm
g
91. End of lectures on
End of lectures on
VISIBLE SURFACE
VISIBLE SURFACE
DETECTION
DETECTION