SlideShare a Scribd company logo
4
Most read
6
Most read
9
Most read
SUBMITTED BY:
JYOTIRAMAN DE
M TECH (CAD/CAM)
Problem:
Given a scene and a projection,
what can we see?
Two main types of algorithms:
Object space: Determine which part of the object are
visible. Also called as World Coordinates
Image space: Determine per pixel which point of an
object is visible. Also called as Screen Coordinates
Object space Image space
Two main Hidden Surface Removal Algorithm
Techniques:
Object space: Hidden Surface Removal for all
objects
Image space:
Objects: 3 D Clipping
Transformed to Screen Coordinates
Hidden Surface Removal
ALGORITHMS WE ARE GOING TO DISCUSS:
• Z-buffer method
• Scan-line method
• Spanning scan-line method
• Floating horizon method
• Discrete data method
Z-BUFFER ALGORITHM:
• Its an extension of Frame Buffer
• Display is always stored on Frame Buffer
• Frame Buffer stores information of each and every
pixel on the screen
• Bits (0, 1) decide that the pixel will be ON or OFF
• Z- Buffer apart from Frame buffer stores the depth
of pixel
• After analyzing the data of the overlapping
polygons, pixel closer to the eye will be updated
• Resolution of X,Y => Array[X,Y]
Given set of polygon in image space
Z-Buffer Algorithm:
1. Set the frame buffer & Z-Buffer to a background
value
(Z-BUFFER=Zmin) where, Zmin is value
To display polygon decide=>color, intensity and depth
2. Scan convert each polygon
i.e, for each pixel, find depth at that point
If Z(X,Y)>Z-BUFFER(X,Y)
Update Z-BUFFER(X,Y)=Z(X,Y)
& FRAME BUFFER
This process will repeat for each pixel
• By this way we can remove hidden lines and display
those polygons which are closer to eye
• X*Y space required to maintain Z-Buffer=> X*Y times
will be scanned
• Expensive in terms of time and space as space is very
large
x
z display
S
S’
x
y S
S’
Pseudocode for the z-buffer algorithm
void zBuffer(void)
{
int x,y;
for(y=0;y<YMAX;y++) { /*Clear frame buffer and z-buffer*/
for(x=0;x<XMAX;x++) {
WritePixel(x,y,BACKGROUND_VALUE);
WriteZ(x,y,0);
}
}
for(each polygon) { /*Draw Polygons*/
for(each pixel in polygons projection) {
double pz=polygons z-value at pixel coords(x,y);
if(pz>=ReadZ(x,y)) { /*New point is not farther*/
WriteZ(x,y,pz);
WritePixel(x,y,polygons color at pixel coords(x,y));
}
}
}
}
SCAN LINE Z-BUFFER ALGORITHM:
• An image space method for identifying visible
surfaces
• Computes and compares depth values along the
various scan-lines for a scene
• Scanning takes place row by row
• To facilitate the search for surfaces crossing a given
scan-line an active list of edges is formed for each
scan-line as it is processed
• The active list stores only those edges that cross the
scan-line in order of increasing x
• Pixel positions across each scan-line are processed
from left to right
• We only need to perform depth calculations
• In Scan Line, Z-Buffer(X) whereas earlier it was X*Y
Use Z-Buffer for only 1 scan line / 1 row of pixel
• During scan conversion in the Active Edge List(AEL)=>
Calculate Z(X,Y)
i.e, -Pixel info between 1 & 2 active edges will only
be stored
-Next pixel will be stored as z=z1+∆z
-∆z will be constant but can change anywhere in
case of slope
• If Z(X,Y)>Z BUFFER(X) => Update
• If 2 polygons are present-along with Active Edge List,
Active Polygon List will also be included
• Active Polygon List=> List of polygons intersecting a
scan line
Pseudocode for the general scan line algorithm
Add surfaces to surface table;
Initialize active-surface table;
for(each scan line)
{
update active-surface table;
for(each pixel on scan line)
{
determine surfaces in active-surface table that project to pixel;
find closest such surface;
determine closest surface’s shade at pixel;
}
}
SPANNING SCAN LINE Z-BUFFER ALGORITHM:
• Z-Buffer is not applicable
• Scan conversion is not done
• Speed increases
1 2 3 4 5 6
Each span at
most one
polygon shall be
displayed
• For each polygon determine the highest scan line
intersected by it
• Place the polygon in the Y-Bucket of that scan line
[YB]
• For each scan line
-Examine YB for any new polygon
-Add new polygon to APL
-Update AEL
-Divide into spans
-In each span decide which polygon shall be displayed
-Increment Y, update AEL & APL
FLOATING HORIZON ALGORITHM:
• Used for displaying surface
• Take each plane & intersection
z=constant plane and get a curve
from F(x,y)=0 f(x,y,z)=0
Array HORIZONTAL[X]=Ymax
Curve in each plane=>f(x,y)=0
y=f(x,y)
z=constant curves
Family of curves
1. Sort all curves as per z-coordinates
2. Start by z=constant curve closest to eye
- If at any x-value Y=f(x,y)
Y<HORIZON(X)-curve is hidden
- If Y>HORIZON(X)-curve is visible &
update HORIZON(X)=Y
- If Y<HORIZON-L(X) : curve is visible &
update HORIZON L(X)=Y
- If Y>HORIZON-U(X) : HORIZON U(X)=Y
• Above Algorithm are applied on surfaces which is in
the form of mathematical equation
• If this curve is not a mathematical equation like this
but it is a set of discrete data points then this
algorithm might not be directly useful
• Maintain HORIZON[X] at each side
• While displaying next curve, it will be compared to 2
points i.e, Y(Xi) & Y(Xi+1)
• If both points are visible, then the complete curve is
visible
• Algorithm will be complex as the curve is in discrete
data form
Y(Xi) Y(Xi+1) Result
V V Curve is visible
V I Xi to Intersection -> Visible
Intersection to Xi+1 -> NOT Visible
I V Xi to Intersection -> NOT Visible
Intersection to Xi+1 -> Visible
I I NOT Visible
SUMMARY
• We need to make sure that we only draw
visible surfaces when rendering scenes
• There are a number of techniques for doing
this such as
– Z-buffer method
– Scan-line method
– Spanning scan-line method
– Floating horizon method
– Discrete data method
REFERENCES
• NPTEL Video Lectures: CAD by Dr. Anoop Chawla, Dept. of
Mechanical Engineering, Indian Institute of Technology, Delhi,
Lecture No. # 12,13,14
• Ibrahim Zeid, “CAD/CAM” TMH
• Hoschek J, Dieter L, “Fundamentals of Computer Aided
Geometric Design ”, A K Peters, 1997
• Rogers D F I and Adams J A, “Mathematical Elements for
Computer Graphics”, McGraw-Hill, 1996
• J.H. Hughes, J.D.F., A.V.M., S.K.F., “Computer Graphics
Principles And Practice”, Pearson Education Asia,2001
Computer Graphics - Hidden Line Removal Algorithm

More Related Content

PPTX
3D transformation in computer graphics
PPT
Two dimensional geometric transformations
PDF
Graphics a buffer
PPTX
Frame buffer
PPTX
Cohen sutherland line clipping
PPT
2 d geometric transformations
PPTX
Hidden surface removal
PPTX
Cohen-Sutherland Line Clipping Algorithm
3D transformation in computer graphics
Two dimensional geometric transformations
Graphics a buffer
Frame buffer
Cohen sutherland line clipping
2 d geometric transformations
Hidden surface removal
Cohen-Sutherland Line Clipping Algorithm

What's hot (20)

PPTX
ANIMATION SEQUENCE
PPTX
sutherland- Hodgeman Polygon clipping
PPT
Liang barsky Line Clipping Algorithm
PPT
GRPHICS06 - Shading
PPTX
Depth Buffer Method
PPT
morphological image processing
PPTX
Computer animation Computer Graphics
PPTX
Scaling and shearing
PPTX
Computer graphics LINE DRAWING algorithm.pptx
PPT
Image processing9 segmentation(pointslinesedges)
PPTX
3 d transformation
PPTX
Bezeir curve na B spline Curve
PPTX
Part 2- Geometric Transformation.pptx
PPTX
Chapter 9 morphological image processing
PPTX
Projections.pptx
PPTX
Clipping computer graphics
PPT
Hidden surfaces
PDF
Computer graphics curves and surfaces (1)
PPTX
Animation graphics
PPT
Computer animation
ANIMATION SEQUENCE
sutherland- Hodgeman Polygon clipping
Liang barsky Line Clipping Algorithm
GRPHICS06 - Shading
Depth Buffer Method
morphological image processing
Computer animation Computer Graphics
Scaling and shearing
Computer graphics LINE DRAWING algorithm.pptx
Image processing9 segmentation(pointslinesedges)
3 d transformation
Bezeir curve na B spline Curve
Part 2- Geometric Transformation.pptx
Chapter 9 morphological image processing
Projections.pptx
Clipping computer graphics
Hidden surfaces
Computer graphics curves and surfaces (1)
Animation graphics
Computer animation
Ad

Viewers also liked (9)

PPT
Bezier and Spline Curves and Surfaces
PPT
3 d viewing
PPTX
Geometric modelling
PDF
191483523 geometric-modeling
PPTX
Parametric modelling
PDF
5 geometric-modeling-ppt-university-of-victoria
PPT
Geometric modeling111431635 geometric-modeling-glad (1)
PPT
Geometric Modeling
PPT
Shading
Bezier and Spline Curves and Surfaces
3 d viewing
Geometric modelling
191483523 geometric-modeling
Parametric modelling
5 geometric-modeling-ppt-university-of-victoria
Geometric modeling111431635 geometric-modeling-glad (1)
Geometric Modeling
Shading
Ad

Similar to Computer Graphics - Hidden Line Removal Algorithm (20)

PPT
Visible surface detection in computer graphic
PPTX
Computer Graphics: Visible surface detection methods
PPTX
Visible surface identification
PPTX
Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptx
PPTX
Hidden surface removal
PPTX
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
PPTX
Visible Surface Detection Methods in Computer Graphics.pptx
PPTX
PPT
Computer graphics iv unit
PDF
Hidden Surface Removal using Z-buffer
PPTX
Visible surface determination
PPTX
Hidden surface removal algorithm
PPTX
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
PPTX
visual realism Unit iii
PDF
Visual surface detection computer graphics
PDF
Unit 3 visual realism
PPTX
PPT
hidden surface removal in computer graphics
PPT
2IV60_11_hidden_surfaces (6).ppt
PDF
Computer Aided Design visual realism notes
Visible surface detection in computer graphic
Computer Graphics: Visible surface detection methods
Visible surface identification
Visible Surfacte Detection Methods - Z-Buffer and Scanline methods.pptx
Hidden surface removal
B. SC CSIT Computer Graphics Unit 4 By Tekendra Nath Yogi
Visible Surface Detection Methods in Computer Graphics.pptx
Computer graphics iv unit
Hidden Surface Removal using Z-buffer
Visible surface determination
Hidden surface removal algorithm
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
visual realism Unit iii
Visual surface detection computer graphics
Unit 3 visual realism
hidden surface removal in computer graphics
2IV60_11_hidden_surfaces (6).ppt
Computer Aided Design visual realism notes

Recently uploaded (20)

PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Lecture Notes Electrical Wiring System Components
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Well-logging-methods_new................
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
web development for engineering and engineering
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Sustainable Sites - Green Building Construction
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
UNIT 4 Total Quality Management .pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Lecture Notes Electrical Wiring System Components
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Internet of Things (IOT) - A guide to understanding
Well-logging-methods_new................
Embodied AI: Ushering in the Next Era of Intelligent Systems
web development for engineering and engineering
CYBER-CRIMES AND SECURITY A guide to understanding
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Strings in CPP - Strings in C++ are sequences of characters used to store and...
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Sustainable Sites - Green Building Construction
Structs to JSON How Go Powers REST APIs.pdf
CH1 Production IntroductoryConcepts.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
UNIT 4 Total Quality Management .pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx

Computer Graphics - Hidden Line Removal Algorithm

  • 2. Problem: Given a scene and a projection, what can we see?
  • 3. Two main types of algorithms: Object space: Determine which part of the object are visible. Also called as World Coordinates Image space: Determine per pixel which point of an object is visible. Also called as Screen Coordinates Object space Image space
  • 4. Two main Hidden Surface Removal Algorithm Techniques: Object space: Hidden Surface Removal for all objects Image space: Objects: 3 D Clipping Transformed to Screen Coordinates Hidden Surface Removal
  • 5. ALGORITHMS WE ARE GOING TO DISCUSS: • Z-buffer method • Scan-line method • Spanning scan-line method • Floating horizon method • Discrete data method
  • 6. Z-BUFFER ALGORITHM: • Its an extension of Frame Buffer • Display is always stored on Frame Buffer • Frame Buffer stores information of each and every pixel on the screen • Bits (0, 1) decide that the pixel will be ON or OFF • Z- Buffer apart from Frame buffer stores the depth of pixel • After analyzing the data of the overlapping polygons, pixel closer to the eye will be updated • Resolution of X,Y => Array[X,Y]
  • 7. Given set of polygon in image space Z-Buffer Algorithm: 1. Set the frame buffer & Z-Buffer to a background value (Z-BUFFER=Zmin) where, Zmin is value To display polygon decide=>color, intensity and depth 2. Scan convert each polygon i.e, for each pixel, find depth at that point If Z(X,Y)>Z-BUFFER(X,Y) Update Z-BUFFER(X,Y)=Z(X,Y) & FRAME BUFFER This process will repeat for each pixel
  • 8. • By this way we can remove hidden lines and display those polygons which are closer to eye • X*Y space required to maintain Z-Buffer=> X*Y times will be scanned • Expensive in terms of time and space as space is very large x z display S S’ x y S S’
  • 9. Pseudocode for the z-buffer algorithm void zBuffer(void) { int x,y; for(y=0;y<YMAX;y++) { /*Clear frame buffer and z-buffer*/ for(x=0;x<XMAX;x++) { WritePixel(x,y,BACKGROUND_VALUE); WriteZ(x,y,0); } } for(each polygon) { /*Draw Polygons*/ for(each pixel in polygons projection) { double pz=polygons z-value at pixel coords(x,y); if(pz>=ReadZ(x,y)) { /*New point is not farther*/ WriteZ(x,y,pz); WritePixel(x,y,polygons color at pixel coords(x,y)); } } } }
  • 10. SCAN LINE Z-BUFFER ALGORITHM: • An image space method for identifying visible surfaces • Computes and compares depth values along the various scan-lines for a scene
  • 11. • Scanning takes place row by row • To facilitate the search for surfaces crossing a given scan-line an active list of edges is formed for each scan-line as it is processed • The active list stores only those edges that cross the scan-line in order of increasing x • Pixel positions across each scan-line are processed from left to right • We only need to perform depth calculations • In Scan Line, Z-Buffer(X) whereas earlier it was X*Y
  • 12. Use Z-Buffer for only 1 scan line / 1 row of pixel • During scan conversion in the Active Edge List(AEL)=> Calculate Z(X,Y) i.e, -Pixel info between 1 & 2 active edges will only be stored -Next pixel will be stored as z=z1+∆z -∆z will be constant but can change anywhere in case of slope • If Z(X,Y)>Z BUFFER(X) => Update • If 2 polygons are present-along with Active Edge List, Active Polygon List will also be included • Active Polygon List=> List of polygons intersecting a scan line
  • 13. Pseudocode for the general scan line algorithm Add surfaces to surface table; Initialize active-surface table; for(each scan line) { update active-surface table; for(each pixel on scan line) { determine surfaces in active-surface table that project to pixel; find closest such surface; determine closest surface’s shade at pixel; } }
  • 14. SPANNING SCAN LINE Z-BUFFER ALGORITHM: • Z-Buffer is not applicable • Scan conversion is not done • Speed increases
  • 15. 1 2 3 4 5 6 Each span at most one polygon shall be displayed • For each polygon determine the highest scan line intersected by it • Place the polygon in the Y-Bucket of that scan line [YB] • For each scan line -Examine YB for any new polygon -Add new polygon to APL -Update AEL -Divide into spans -In each span decide which polygon shall be displayed -Increment Y, update AEL & APL
  • 16. FLOATING HORIZON ALGORITHM: • Used for displaying surface • Take each plane & intersection z=constant plane and get a curve from F(x,y)=0 f(x,y,z)=0 Array HORIZONTAL[X]=Ymax Curve in each plane=>f(x,y)=0 y=f(x,y) z=constant curves Family of curves
  • 17. 1. Sort all curves as per z-coordinates 2. Start by z=constant curve closest to eye - If at any x-value Y=f(x,y) Y<HORIZON(X)-curve is hidden - If Y>HORIZON(X)-curve is visible & update HORIZON(X)=Y - If Y<HORIZON-L(X) : curve is visible & update HORIZON L(X)=Y - If Y>HORIZON-U(X) : HORIZON U(X)=Y
  • 18. • Above Algorithm are applied on surfaces which is in the form of mathematical equation • If this curve is not a mathematical equation like this but it is a set of discrete data points then this algorithm might not be directly useful
  • 19. • Maintain HORIZON[X] at each side • While displaying next curve, it will be compared to 2 points i.e, Y(Xi) & Y(Xi+1) • If both points are visible, then the complete curve is visible • Algorithm will be complex as the curve is in discrete data form Y(Xi) Y(Xi+1) Result V V Curve is visible V I Xi to Intersection -> Visible Intersection to Xi+1 -> NOT Visible I V Xi to Intersection -> NOT Visible Intersection to Xi+1 -> Visible I I NOT Visible
  • 20. SUMMARY • We need to make sure that we only draw visible surfaces when rendering scenes • There are a number of techniques for doing this such as – Z-buffer method – Scan-line method – Spanning scan-line method – Floating horizon method – Discrete data method
  • 21. REFERENCES • NPTEL Video Lectures: CAD by Dr. Anoop Chawla, Dept. of Mechanical Engineering, Indian Institute of Technology, Delhi, Lecture No. # 12,13,14 • Ibrahim Zeid, “CAD/CAM” TMH • Hoschek J, Dieter L, “Fundamentals of Computer Aided Geometric Design ”, A K Peters, 1997 • Rogers D F I and Adams J A, “Mathematical Elements for Computer Graphics”, McGraw-Hill, 1996 • J.H. Hughes, J.D.F., A.V.M., S.K.F., “Computer Graphics Principles And Practice”, Pearson Education Asia,2001