SlideShare a Scribd company logo
1 of 43
Visible Surface Detection and elemination
and
Visible Surface detection Algorithm (VSD algorithm)
By
Ankit Garg
Amity University Haryana Total Slides(49)
What is Visible surface Detection
• For creating realistic view of any object we
must draw those line which are visible to the
user, not those lines which are not viewed by
the user.
• The identification and removal of these
surface is called “Visible surface detection”
and the algorithm used for this purpose are
called “visible surface detection algorithm”
Visible-Surface Detection
Problem:
Given a scene and a projection,
what can we see?
Visible Surface Detection Algorithms
• Z-Buffer Algorithm
• BSP Algorithm (Binary Space Partition Algorithm)
• A buffer Algorithm
• Scan-line Algorithm for VSD.
• Painter’s or Depth sorting Algorithm.
Right hand and Left hand Coordinate System
Figure 1 Figure 2
General Z-buffer Algorithm
• In Z buffer algorithm we compare the Z values
of the pixels which are overlapped with each
other.
• According to the direction of the user we take
maximum Z value or minimum Z values to
initialize the Z buffer.
• No need to compare Z value of those pixels
which are not overlapped with each other.
TWO THING MUST BE CONSIDER IN CASE OF Z-BUFFER
ALGORITHM
1. When user sits on positive z axis and looks towards negative z axis
2. When user sits on negative z axis and looks towards positive z axis
Case-1:
In first case the object with smaller Z value is
far from user and object having more Z value
is closer to the user..
Case 2:
In second case the object with larger Z value
is far from user and object having smaller z
values are closer to the user.
Hence Z buffer algorithm is depend upon the
viewing direction of the user.
8
• Here user’s viewing direction is towards positive Z-direction
• Hence object having minimum Z values are closer to user and objects
having larger Z-values are away from user.
When user sits on -z direction and looks towards +z direction
In this figure we see three polygons in window, which are occluding each
others. It means they are not separated out..
Important Concept of Z-Buffer Algorithm
Each (X,Y,Z) point on a polygon surface,
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) values.
Buffers used in Z-Buffer Algorithm
Two buffers are used :
Z-Buffer: To store the depth values for each
(X,Y) position, as surface are processed.
Refresh Buffer: To store the intensity value at
each position (X,Y).
Two Case In Z-Buffer Algorithm
1. When Viewing direction is from + Z to –Z
2. When Viewing Direction is from –Z to +Z.
In First Case Polygon having less Z value are on back
side and other are on front side.
In second Case polygon having more Z value are on
backside and other are on front side.
When View Direction is from –Z to +Z direction
When View Direction is from +Z to -Z direction
Example on Z-Buffer Algorithm (Viewing Direction
from positive to Negative)
Z-buffer Algorithm
Z-buffer Algorithm
Z-buffer Algorithm
Z-Buffer Algorithm (Refresh buffer and
Depth buffer Together)
Limitation of Z-buffer Algorithm
• This algorithm do not work on transparent
surface, this is only for opaque surface.
• Hence here no method is available to compare
the Z values of the surfaces which are
transparent.
• For working on transparent surface another
method is available which is called A-buffer
Algorithm.
• Extra memory is required to store depth value.
BSP (Binary Space Partitioning) Tree.
The idea of this algorithm is to
sort the polygon to display in back
to front order or from front to back
order.
Method of BSP tree algorithm
• Choose any polygon and compare all the others to it.
•Split the surface in to two, those in front of the selected
polygon and those who are in the back of the polygon.
•Split any polygon lying on both sides.
•This process is repetitive until polygon is not sorted.
•The result of this sorting can be visualize in the form of
binary tree.
•In the resultant binary tree one subtree shows the polygon
who are in front side and other subtree shows the polygon
who are in the back.
•To get the final result traverse final tree by inorder
traversal method.
3
41
2
5
View of scene from above
19/10/200723
BSP Tree.
•Choose polygon arbitrarily
•Divide scene into front (relative to
normal) and back half-spaces.
•Split any polygon lying on both sides.
•Choose a polygon from each side – split
scene again.
•Recursively divide each side until each
node contains only 1 polygon.
3
3
41
2
5
5a
5b
1
2
5a
4
5b
backfront
BSP Tree.
•Choose polygon arbitrarily
•Divide scene into front (relative to
normal) and back half-spaces.
•Split any polygon lying on both sides.
•Choose a polygon from each side –
split scene again.
•Recursively divide each side until each
node contains only 1 polygon.
3
3
41
2
5
5a
5b
4
5b
backfront
2
15a
front
BSP Tree.
•Choose polygon arbitrarily
•Divide scene into front (relative to normal)
and back half-spaces.
•Split any polygon lying on both sides.
•Choose a polygon from each side – split
scene again.
•Recursively divide each side until each
node contains only 1 polygon.
•Result: In-order traversal of this tree is:
5a , 2 , 1 , 3 ,4, 5b
3
3
41
2
5
5a
5b
backfront
2
15a
front
5b
4
Question?
Find out front polygon and back polygon for polygon: P1
A-Buffer Algorithm
• Z-buffer algorithm is not sufficient to work on
surfaces which are transparent in nature.
• A buffer algorithm is used not only for
transparent surface but also for opaque
surface. Hence this algorithm is expansion of Z
buffer algorithm.
• In a buffer algorithm a link list is attached with
each pixel positions. This link list contains
intensity information of each surface
associated with it.
A Buffer Algorithm
A buffer Algorithm
• Each node in A buffer contain three field
• Depth field
• Intensity value
• Pointer to next node
For portion of surface which are not overlapped,
we don’t need to compare the Z value. Hence
node in link list will always contain the single
intensity value.
A Buffer Algorithm
 When surfaces are overlapped we need to compare Z value
same as Z buffer algorithm.
 Hence for overlapping surfaces multiple intensity values
are stored in the linked list.
 Many other information can be stored in the link list such
as:
Transparency factor
RGB values
Scan-Line Method
• Unlike z-buffer or A-buffer, scan-line method is also used to detect
visible surface.
• In this algorithm we maintain depth information for each scan line.
• We do not compare the Z value where portion of surfaces are not
overlapped but in case of overlapping surface we need to compare
the Z value same as Z buffer and A buffer algorithm.
In this algorithm we have to maintain following things:
• Build table of edges of all polygons in scene.
• Maintain active-edge-table as we visit each scan-line in scene. AET
now contains edges for all polygons at that scan line. Just Like Scan
line algorithm (Polygon Fill).
• Must maintain flag for each surface to determine whether pixel on
scan-line is inside that surface.
Scan-Line Method Basic Example
• Scan Line 1:
– (A,B) to (B,C) only inside S1, so color from S1 (Flag1 will on and
2 will off)
– (E,H) to (F,G) only inside S2, so color from S2 (Flag 2 will on 1
will off)
• Scan Line 3:
– (A,D) to (E,H) only inside S1, so color from S1
– (E,H) to (B,C) inside S1 and S2 , so compute & test depth. In this example we color from
S1
– (B,C) to (F,G) only inside S2, so color from S2
B
A
D
C
G
F
E
H
S1 S2
Scan Line 1
Scan Line 2
Scan Line 3
Painter’s or Depth sorting method
• In this algorithm polygons are sorting according in
ascending order.
• In this algorithm we maintain “behind counter”. This
behind counter is used to record number of polygons
behind any polygon.
• Polygon which has “behind counter” Zero are those
polygon that have no other polygon behind them.
• After painting the polygon we decrease behind counter
of that polygon by one.
• This algorithm terminates when “Behind counter” of all
the polygon becomes -1.
34
Painter’s Algorithm
Draw surfaces from back (farthest away) to front (closest):
– Sort surfaces/polygons by their depth (z value)
– Draw objects in order (farthest to closest)
– Closer objects paint over the top of farther away objects
6
2
4
1
5
Painter’s Algorithm or Depth sorting Method
Triangle Behind
counter
Triangle
name
Which is
overlapped
List of
triangle in
front
1 2 T2 , T4 5
2 0 NULL 1,3
3 1 T2 4
4 1 T3 1,5
5 2 T4,T1 0
6 0 NULL 0
Depth Order Table
6
2
4
1
5
Triangle Behind
counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
triangle
1 2 T2 , T4 5 1
2 0 NULL 1,3 -1
3 1 T2 4 0 T2, T6
4 1 T3 1,5 1
5 2 T4,T1 0 2
6 0 NULL 0 -1
Flow of Algorithm: Step -1 Triangle Behind
counter
Triangle
overlapped
List of
triangle in
front
1 2 T2 , T4 5
2 0 NULL 1,3
3 1 T2 4
4 1 T3 1,5
5 2 T4,T1 0
6 0 NULL 0
Triangle List of new
Behind
Counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
Triangle
1 1 T2 , T4 5 1
2 -1 NULL 1,3 -1
3 0 T2 4 -1 T2,T6,T3
4 1 T3 1,5 0
5 2 T4,T1 0 2
6 -1 NULL 0 -1
Triangle Behind
counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
triangle
1 2 T2 , T4 5 1
2 0 NULL 1,3 -1
3 1 T2 4 0 T2, T6
4 1 T3 1,5 1
5 2 T4,T1 0 2
6 0 NULL 0 -1
Triangle List of new
Behind
Counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
Triangle
1 1 T2 , T4 5 0
2 -1 NULL 1,3 -1
3 -1 T2 4 -1 T2,T6,T3,T4
4 0 T3 1,5 -1
5 2 T4,T1 0 1
6 -1 NULL 0 -1
Triangle List of new
Behind
Counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
Triangle
1 1 T2 , T4 5 1
2 -1 NULL 1,3 -1
3 0 T2 4 -1 T2,T6,T3
4 1 T3 1,5 0
5 2 T4,T1 0 2
6 -1 NULL 0 -1
Triangle List of new
Behind
Counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
Triangle
1 0 T2 , T4 5 -1
2 -1 NULL 1,3 -1
3 -1 T2 4 -1 T2,T6,T3,T4,
T1
4 -1 T3 1,5 -1
5 1 T4,T1 0 0
6 -1 NULL 0 -1
Triangle List of new
Behind
Counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
Triangle
1 1 T2 , T4 5 0
2 -1 NULL 1,3 -1
3 -1 T2 4 -1 T2,T6,T3,T4
4 0 T3 1,5 -1
5 2 T4,T1 0 1
6 -1 NULL 0 -1
Triangle List of new
Behind
Counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
Triangle
1 -1 T2 , T4 5 -1
2 -1 NULL 1,3 -1
3 -1 T2 4 -1 T2,T6,T3,T4,
T1,T5
4 -1 T3 1,5 -1
5 0 T4,T1 0 -1
6 -1 NULL 0 -1
Triangle List of new
Behind
Counter
Triangle
overlapped
List of
triangle in
front
List of new
Behind
Counter
Painted
Triangle
1 1 T2 , T4 5 0
2 -1 NULL 1,3 -1
3 -1 T2 4 -1 T2,T6,T3,T4
4 0 T3 1,5 -1
5 2 T4,T1 0 1
6 -1 NULL 0 -1
4
5
Thank You!!!

More Related Content

What's hot

Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer GraphicsSanu Philip
 
4. THREE DIMENSIONAL DISPLAY METHODS
4.	THREE DIMENSIONAL DISPLAY METHODS4.	THREE DIMENSIONAL DISPLAY METHODS
4. THREE DIMENSIONAL DISPLAY METHODSSanthiNivas
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithmPooja Dixit
 
GRPHICS06 - Shading
GRPHICS06 - ShadingGRPHICS06 - Shading
GRPHICS06 - ShadingMichael Heron
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingArvind Kumar
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithmKKARUNKARTHIK
 
hidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmhidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmrajivagarwal23dei
 
Visible Surface Detection
Visible Surface DetectionVisible Surface Detection
Visible Surface DetectionAmitBiswas99
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfacesAnkur Kumar
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer GraphicsLaxman Puri
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics FundamentalsMuhammed Afsal Villan
 
DDA algorithm
DDA algorithmDDA algorithm
DDA algorithmYash Patel
 
Polygon filling
Polygon fillingPolygon filling
Polygon fillingAnkit Garg
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsNanhen Verma
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unitaravindangc
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesOmprakash Chauhan
 
Frame buffer
Frame bufferFrame buffer
Frame bufferAparna Joshi
 

What's hot (20)

Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
4. THREE DIMENSIONAL DISPLAY METHODS
4.	THREE DIMENSIONAL DISPLAY METHODS4.	THREE DIMENSIONAL DISPLAY METHODS
4. THREE DIMENSIONAL DISPLAY METHODS
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
 
GRPHICS06 - Shading
GRPHICS06 - ShadingGRPHICS06 - Shading
GRPHICS06 - Shading
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithm
 
hidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithmhidden surface elimination using z buffer algorithm
hidden surface elimination using z buffer algorithm
 
Visible Surface Detection
Visible Surface DetectionVisible Surface Detection
Visible Surface Detection
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
 
Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
unit 4.pptx
unit 4.pptxunit 4.pptx
unit 4.pptx
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals
 
DDA algorithm
DDA algorithmDDA algorithm
DDA algorithm
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unit
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - Notes
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
 

Similar to Hidden surface removal

rural marketing ppt
rural marketing pptrural marketing ppt
rural marketing pptelaya1984
 
Visual surface detection i
Visual surface detection   iVisual surface detection   i
Visual surface detection ielaya1984
 
Computer Graphics - Hidden Line Removal Algorithm
Computer Graphics - Hidden Line Removal AlgorithmComputer Graphics - Hidden Line Removal Algorithm
Computer Graphics - Hidden Line Removal AlgorithmJyotiraman De
 
Unit 3 visual realism
Unit 3 visual realismUnit 3 visual realism
Unit 3 visual realismJavith Saleem
 
06 image features
06 image features06 image features
06 image featuresankit_ppt
 
Hidden line removal algorithm
Hidden line removal algorithmHidden line removal algorithm
Hidden line removal algorithmKKARUNKARTHIK
 
195706916 i journals-paper-template-2013
195706916 i journals-paper-template-2013195706916 i journals-paper-template-2013
195706916 i journals-paper-template-2013homeworkping3
 
visual realism Unit iii
 visual realism Unit iii visual realism Unit iii
visual realism Unit iiiArun Prakash
 
CS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptxCS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptxlara333479
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determinationPatel Punit
 
Image segmentation
Image segmentationImage segmentation
Image segmentationMd Shabir Alam
 
Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptx
Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptxVisible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptx
Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptxJeoJoyA
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphicsShaishavShah8
 
License plate recognition
License plate recognitionLicense plate recognition
License plate recognitionrahul bhambri
 
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath YogiTekendra Nath Yogi
 

Similar to Hidden surface removal (20)

rural marketing ppt
rural marketing pptrural marketing ppt
rural marketing ppt
 
Visual surface detection i
Visual surface detection   iVisual surface detection   i
Visual surface detection i
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
Computer Graphics - Hidden Line Removal Algorithm
Computer Graphics - Hidden Line Removal AlgorithmComputer Graphics - Hidden Line Removal Algorithm
Computer Graphics - Hidden Line Removal Algorithm
 
Unit 3 visual realism
Unit 3 visual realismUnit 3 visual realism
Unit 3 visual realism
 
06 image features
06 image features06 image features
06 image features
 
Hidden line removal algorithm
Hidden line removal algorithmHidden line removal algorithm
Hidden line removal algorithm
 
195706916 i journals-paper-template-2013
195706916 i journals-paper-template-2013195706916 i journals-paper-template-2013
195706916 i journals-paper-template-2013
 
visual realism Unit iii
 visual realism Unit iii visual realism Unit iii
visual realism Unit iii
 
UNIT-V
UNIT-VUNIT-V
UNIT-V
 
CS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptxCS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptx
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determination
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Clipping
ClippingClipping
Clipping
 
Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptx
Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptxVisible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptx
Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptx
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
 
UNIT-III
UNIT-IIIUNIT-III
UNIT-III
 
License plate recognition
License plate recognitionLicense plate recognition
License plate recognition
 
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
 

More from Ankit Garg

Introduction to computer graphics part 2
Introduction to computer graphics part 2Introduction to computer graphics part 2
Introduction to computer graphics part 2Ankit Garg
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1Ankit Garg
 
Curve clipping
Curve clippingCurve clipping
Curve clippingAnkit Garg
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformationAnkit Garg
 
Projection ppt
Projection pptProjection ppt
Projection pptAnkit Garg
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingAnkit Garg
 
Numerical unit 1
Numerical unit 1Numerical unit 1
Numerical unit 1Ankit Garg
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesAnkit Garg
 
Line clipping
Line clippingLine clipping
Line clippingAnkit Garg
 
Graphics software standards
Graphics software standardsGraphics software standards
Graphics software standardsAnkit Garg
 
Fractal introduction and applications modified version
Fractal introduction and applications modified versionFractal introduction and applications modified version
Fractal introduction and applications modified versionAnkit Garg
 
Digital image processing & computer graphics
Digital image processing & computer graphicsDigital image processing & computer graphics
Digital image processing & computer graphicsAnkit Garg
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination modelAnkit Garg
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithmAnkit Garg
 
Character generation
Character generationCharacter generation
Character generationAnkit Garg
 
Applications of cg
Applications of cgApplications of cg
Applications of cgAnkit Garg
 
2 d transformation
2 d transformation2 d transformation
2 d transformationAnkit Garg
 
3 d transformations
3 d transformations3 d transformations
3 d transformationsAnkit Garg
 

More from Ankit Garg (19)

Introduction to computer graphics part 2
Introduction to computer graphics part 2Introduction to computer graphics part 2
Introduction to computer graphics part 2
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
Unit 1
Unit 1Unit 1
Unit 1
 
Projection ppt
Projection pptProjection ppt
Projection ppt
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Numerical unit 1
Numerical unit 1Numerical unit 1
Numerical unit 1
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
 
Line clipping
Line clippingLine clipping
Line clipping
 
Graphics software standards
Graphics software standardsGraphics software standards
Graphics software standards
 
Fractal introduction and applications modified version
Fractal introduction and applications modified versionFractal introduction and applications modified version
Fractal introduction and applications modified version
 
Digital image processing & computer graphics
Digital image processing & computer graphicsDigital image processing & computer graphics
Digital image processing & computer graphics
 
Concept of basic illumination model
Concept of basic illumination modelConcept of basic illumination model
Concept of basic illumination model
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
Character generation
Character generationCharacter generation
Character generation
 
Applications of cg
Applications of cgApplications of cg
Applications of cg
 
2 d transformation
2 d transformation2 d transformation
2 d transformation
 
3 d transformations
3 d transformations3 d transformations
3 d transformations
 

Recently uploaded

CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage examplePragyanshuParadkar1
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Study on Air-Water & Water-Water Heat Exchange in a Finned ďťżTube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned ďťżTube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned ďťżTube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned ďťżTube ExchangerAnamika Sarkar
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
DATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage exampleDATA ANALYTICS PPT definition usage example
DATA ANALYTICS PPT definition usage example
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned ďťżTube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned ďťżTube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned ďťżTube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned ďťżTube Exchanger
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 

Hidden surface removal

  • 1. Visible Surface Detection and elemination and Visible Surface detection Algorithm (VSD algorithm) By Ankit Garg Amity University Haryana Total Slides(49)
  • 2. What is Visible surface Detection • For creating realistic view of any object we must draw those line which are visible to the user, not those lines which are not viewed by the user. • The identification and removal of these surface is called “Visible surface detection” and the algorithm used for this purpose are called “visible surface detection algorithm”
  • 3. Visible-Surface Detection Problem: Given a scene and a projection, what can we see?
  • 4. Visible Surface Detection Algorithms • Z-Buffer Algorithm • BSP Algorithm (Binary Space Partition Algorithm) • A buffer Algorithm • Scan-line Algorithm for VSD. • Painter’s or Depth sorting Algorithm.
  • 5. Right hand and Left hand Coordinate System Figure 1 Figure 2
  • 6. General Z-buffer Algorithm • In Z buffer algorithm we compare the Z values of the pixels which are overlapped with each other. • According to the direction of the user we take maximum Z value or minimum Z values to initialize the Z buffer. • No need to compare Z value of those pixels which are not overlapped with each other.
  • 7. TWO THING MUST BE CONSIDER IN CASE OF Z-BUFFER ALGORITHM 1. When user sits on positive z axis and looks towards negative z axis 2. When user sits on negative z axis and looks towards positive z axis Case-1: In first case the object with smaller Z value is far from user and object having more Z value is closer to the user.. Case 2: In second case the object with larger Z value is far from user and object having smaller z values are closer to the user. Hence Z buffer algorithm is depend upon the viewing direction of the user.
  • 8. 8 • Here user’s viewing direction is towards positive Z-direction • Hence object having minimum Z values are closer to user and objects having larger Z-values are away from user. When user sits on -z direction and looks towards +z direction
  • 9. In this figure we see three polygons in window, which are occluding each others. It means they are not separated out..
  • 10. Important Concept of Z-Buffer Algorithm Each (X,Y,Z) point on a polygon surface, 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) values.
  • 11. Buffers used in Z-Buffer Algorithm Two buffers are used : Z-Buffer: To store the depth values for each (X,Y) position, as surface are processed. Refresh Buffer: To store the intensity value at each position (X,Y).
  • 12. Two Case In Z-Buffer Algorithm 1. When Viewing direction is from + Z to –Z 2. When Viewing Direction is from –Z to +Z. In First Case Polygon having less Z value are on back side and other are on front side. In second Case polygon having more Z value are on backside and other are on front side.
  • 13. When View Direction is from –Z to +Z direction
  • 14. When View Direction is from +Z to -Z direction
  • 15. Example on Z-Buffer Algorithm (Viewing Direction from positive to Negative)
  • 19. Z-Buffer Algorithm (Refresh buffer and Depth buffer Together)
  • 20.
  • 21. Limitation of Z-buffer Algorithm • This algorithm do not work on transparent surface, this is only for opaque surface. • Hence here no method is available to compare the Z values of the surfaces which are transparent. • For working on transparent surface another method is available which is called A-buffer Algorithm. • Extra memory is required to store depth value.
  • 22. BSP (Binary Space Partitioning) Tree. The idea of this algorithm is to sort the polygon to display in back to front order or from front to back order. Method of BSP tree algorithm • Choose any polygon and compare all the others to it. •Split the surface in to two, those in front of the selected polygon and those who are in the back of the polygon. •Split any polygon lying on both sides. •This process is repetitive until polygon is not sorted. •The result of this sorting can be visualize in the form of binary tree. •In the resultant binary tree one subtree shows the polygon who are in front side and other subtree shows the polygon who are in the back. •To get the final result traverse final tree by inorder traversal method. 3 41 2 5 View of scene from above
  • 23. 19/10/200723 BSP Tree. •Choose polygon arbitrarily •Divide scene into front (relative to normal) and back half-spaces. •Split any polygon lying on both sides. •Choose a polygon from each side – split scene again. •Recursively divide each side until each node contains only 1 polygon. 3 3 41 2 5 5a 5b 1 2 5a 4 5b backfront
  • 24. BSP Tree. •Choose polygon arbitrarily •Divide scene into front (relative to normal) and back half-spaces. •Split any polygon lying on both sides. •Choose a polygon from each side – split scene again. •Recursively divide each side until each node contains only 1 polygon. 3 3 41 2 5 5a 5b 4 5b backfront 2 15a front
  • 25. BSP Tree. •Choose polygon arbitrarily •Divide scene into front (relative to normal) and back half-spaces. •Split any polygon lying on both sides. •Choose a polygon from each side – split scene again. •Recursively divide each side until each node contains only 1 polygon. •Result: In-order traversal of this tree is: 5a , 2 , 1 , 3 ,4, 5b 3 3 41 2 5 5a 5b backfront 2 15a front 5b 4
  • 26. Question? Find out front polygon and back polygon for polygon: P1
  • 27. A-Buffer Algorithm • Z-buffer algorithm is not sufficient to work on surfaces which are transparent in nature. • A buffer algorithm is used not only for transparent surface but also for opaque surface. Hence this algorithm is expansion of Z buffer algorithm. • In a buffer algorithm a link list is attached with each pixel positions. This link list contains intensity information of each surface associated with it.
  • 29. A buffer Algorithm • Each node in A buffer contain three field • Depth field • Intensity value • Pointer to next node For portion of surface which are not overlapped, we don’t need to compare the Z value. Hence node in link list will always contain the single intensity value.
  • 30. A Buffer Algorithm  When surfaces are overlapped we need to compare Z value same as Z buffer algorithm.  Hence for overlapping surfaces multiple intensity values are stored in the linked list.  Many other information can be stored in the link list such as: Transparency factor RGB values
  • 31. Scan-Line Method • Unlike z-buffer or A-buffer, scan-line method is also used to detect visible surface. • In this algorithm we maintain depth information for each scan line. • We do not compare the Z value where portion of surfaces are not overlapped but in case of overlapping surface we need to compare the Z value same as Z buffer and A buffer algorithm. In this algorithm we have to maintain following things: • Build table of edges of all polygons in scene. • Maintain active-edge-table as we visit each scan-line in scene. AET now contains edges for all polygons at that scan line. Just Like Scan line algorithm (Polygon Fill). • Must maintain flag for each surface to determine whether pixel on scan-line is inside that surface.
  • 32. Scan-Line Method Basic Example • Scan Line 1: – (A,B) to (B,C) only inside S1, so color from S1 (Flag1 will on and 2 will off) – (E,H) to (F,G) only inside S2, so color from S2 (Flag 2 will on 1 will off) • Scan Line 3: – (A,D) to (E,H) only inside S1, so color from S1 – (E,H) to (B,C) inside S1 and S2 , so compute & test depth. In this example we color from S1 – (B,C) to (F,G) only inside S2, so color from S2 B A D C G F E H S1 S2 Scan Line 1 Scan Line 2 Scan Line 3
  • 33. Painter’s or Depth sorting method • In this algorithm polygons are sorting according in ascending order. • In this algorithm we maintain “behind counter”. This behind counter is used to record number of polygons behind any polygon. • Polygon which has “behind counter” Zero are those polygon that have no other polygon behind them. • After painting the polygon we decrease behind counter of that polygon by one. • This algorithm terminates when “Behind counter” of all the polygon becomes -1.
  • 34. 34 Painter’s Algorithm Draw surfaces from back (farthest away) to front (closest): – Sort surfaces/polygons by their depth (z value) – Draw objects in order (farthest to closest) – Closer objects paint over the top of farther away objects
  • 36. Triangle Behind counter Triangle name Which is overlapped List of triangle in front 1 2 T2 , T4 5 2 0 NULL 1,3 3 1 T2 4 4 1 T3 1,5 5 2 T4,T1 0 6 0 NULL 0 Depth Order Table 6 2 4 1 5
  • 37. Triangle Behind counter Triangle overlapped List of triangle in front List of new Behind Counter Painted triangle 1 2 T2 , T4 5 1 2 0 NULL 1,3 -1 3 1 T2 4 0 T2, T6 4 1 T3 1,5 1 5 2 T4,T1 0 2 6 0 NULL 0 -1 Flow of Algorithm: Step -1 Triangle Behind counter Triangle overlapped List of triangle in front 1 2 T2 , T4 5 2 0 NULL 1,3 3 1 T2 4 4 1 T3 1,5 5 2 T4,T1 0 6 0 NULL 0
  • 38. Triangle List of new Behind Counter Triangle overlapped List of triangle in front List of new Behind Counter Painted Triangle 1 1 T2 , T4 5 1 2 -1 NULL 1,3 -1 3 0 T2 4 -1 T2,T6,T3 4 1 T3 1,5 0 5 2 T4,T1 0 2 6 -1 NULL 0 -1 Triangle Behind counter Triangle overlapped List of triangle in front List of new Behind Counter Painted triangle 1 2 T2 , T4 5 1 2 0 NULL 1,3 -1 3 1 T2 4 0 T2, T6 4 1 T3 1,5 1 5 2 T4,T1 0 2 6 0 NULL 0 -1
  • 39. Triangle List of new Behind Counter Triangle overlapped List of triangle in front List of new Behind Counter Painted Triangle 1 1 T2 , T4 5 0 2 -1 NULL 1,3 -1 3 -1 T2 4 -1 T2,T6,T3,T4 4 0 T3 1,5 -1 5 2 T4,T1 0 1 6 -1 NULL 0 -1 Triangle List of new Behind Counter Triangle overlapped List of triangle in front List of new Behind Counter Painted Triangle 1 1 T2 , T4 5 1 2 -1 NULL 1,3 -1 3 0 T2 4 -1 T2,T6,T3 4 1 T3 1,5 0 5 2 T4,T1 0 2 6 -1 NULL 0 -1
  • 40. Triangle List of new Behind Counter Triangle overlapped List of triangle in front List of new Behind Counter Painted Triangle 1 0 T2 , T4 5 -1 2 -1 NULL 1,3 -1 3 -1 T2 4 -1 T2,T6,T3,T4, T1 4 -1 T3 1,5 -1 5 1 T4,T1 0 0 6 -1 NULL 0 -1 Triangle List of new Behind Counter Triangle overlapped List of triangle in front List of new Behind Counter Painted Triangle 1 1 T2 , T4 5 0 2 -1 NULL 1,3 -1 3 -1 T2 4 -1 T2,T6,T3,T4 4 0 T3 1,5 -1 5 2 T4,T1 0 1 6 -1 NULL 0 -1
  • 41. Triangle List of new Behind Counter Triangle overlapped List of triangle in front List of new Behind Counter Painted Triangle 1 -1 T2 , T4 5 -1 2 -1 NULL 1,3 -1 3 -1 T2 4 -1 T2,T6,T3,T4, T1,T5 4 -1 T3 1,5 -1 5 0 T4,T1 0 -1 6 -1 NULL 0 -1 Triangle List of new Behind Counter Triangle overlapped List of triangle in front List of new Behind Counter Painted Triangle 1 1 T2 , T4 5 0 2 -1 NULL 1,3 -1 3 -1 T2 4 -1 T2,T6,T3,T4 4 0 T3 1,5 -1 5 2 T4,T1 0 1 6 -1 NULL 0 -1
  • 42. 4 5