SlideShare a Scribd company logo
1 of 8
A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 1
COMPUTER GRAPHICSCOMPUTER GRAPHICS
Visible Surface DetectionVisible Surface Detection
(Z-Buffer/Depth Buffer)(Z-Buffer/Depth Buffer)
A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 2
DEPTH-BUFFER METHODDEPTH-BUFFER METHOD
 Compares surface depth values throughout a scene
for each pixel position on the projection plane
 Usually applied to scenes only containing polygons
 Fast approach due to easy depth values computation
 Also often called the z-buffer method
(x2, y2) & z2
(x3, y3) & z3
(x1, y1) & z1
 (x1, y1), (x2, y2) &
(x3, y3) are the pixel
positions of surfaces
S1, S2, and S3
respectively.
 z1, z2 and z3 defines
the depth values
(distance) of surfaces
S1, S2, and S3
respectively from the
View Plane
A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 3
DEPTH-BUFFER METHOD (Cont…)DEPTH-BUFFER METHOD (Cont…)
1. Initialise the depth buffer and frame buffer so that for
all buffer positions (x, y)
depthBuff(x, y) = 1.0
frameBuff(x, y) = bgColour
2. Process each polygon in a scene, one at a time
– For each projected (x, y) pixel position of a
polygon, calculate the depth z (if not already
known)
– If z < depthBuff(x, y), compute the surface colour
at that position and set
depthBuff(x, y) = z
frameBuff(x, y) = surfColour(x, y)
 After all surfaces are processed depthBuff and frameBuff
will store correct values
A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 4
DEPTH CALCULATIONDEPTH CALCULATION
ExampleExample
A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 5
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
6 6 6 6 6 6 6
6 6 6 6 6 6
6 6 6 6 6
6 6 6 6
6 6 6
6 6
6
6 6 6 6 6 6 6 1
6 6 6 6 6 6 1 1
6 6 6 6 6 1 1 1
6 6 6 6 1 1 1 1
6 6 6 1 1 1 1 1
6 6 1 1 1 1 1 1
6 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
6 6 6 6 6 6 6 1
6 6 6 6 6 6 1 1
6 6 6 6 6 1 1 1
6 6 6 6 1 1 1 1
6 6 6 1 1 1 1 1
6 6 1 1 1 1 1 1
6 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
Surface-1
Depth Buffer
Depth Buffer Frame Buffer
ExampleExample
A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 6
6 6 6 6 6 6 6 1
6 6 6 6 6 6 1 1
6 6 6 6 6 1 1 1
6 6 6 6 1 1 1 1
6 6 6 7 1 1 1 1
6 6 7 7 7 1 1 1
6 7 7 7 7 7 1 1
1 1 1 1 1 1 1 1
6 6 6 6 6 6 6 1
6 6 6 6 6 6 1 1
6 6 6 6 6 1 1 1
6 6 6 6 1 1 1 1
6 6 6 1 1 1 1 1
6 6 1 1 1 1 1 1
6 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
7 1 1 1 1 1 1 1
7 1 1 1 1 1 1
7 1 1 1 1 1
7 1 1 1 1
7 1 1 1
7 1 1
1 1 1 1 1 1 1 1
7 7 7 7 7
7 7 7 7
7 7 7
7 7
7
6 6 6 6 6 6 6 1
6 6 6 6 6 6 1 1
6 6 6 6 6 1 1 1
6 6 6 6 1 1 1 1
6 6 6 1 1 1 1 1
6 6 1 1 1 1 1 1
6 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
Surface-2Depth Buffer
Depth Buffer Frame Buffer
A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 7
Iterative Calculations (cont…)Iterative Calculations (cont…)
top scan line
bottom scan line
y scan line
y - 1 scan line
x x’
A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 8
DISADVANTAGES OF DEPTH BUFFERDISADVANTAGES OF DEPTH BUFFER
This method only find out one visible surface
at each pixel position that means it deals
with only Opaque surface.
1
2
3
4
5
6
1 Red
2 Red
3 Green
4 Blue
5 Green
6 Red

More Related Content

What's hot

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
rajivagarwal23dei
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
Mohd Arif
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unit
aravindangc
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
Mohd Arif
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determination
Patel Punit
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
Ankit Garg
 

What's hot (20)

Spline representations
Spline representationsSpline representations
Spline representations
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 
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
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithm
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unit
 
3d transformation computer graphics
3d transformation computer graphics 3d transformation computer graphics
3d transformation computer graphics
 
Raster scan systems with video controller and display processor
Raster scan systems with video controller and display processorRaster scan systems with video controller and display processor
Raster scan systems with video controller and display processor
 
Back face detection
Back face detectionBack face detection
Back face detection
 
Curve and text clipping
Curve and text clippingCurve and text clipping
Curve and text clipping
 
Computer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methodsComputer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methods
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determination
 
Graphics a buffer
Graphics a bufferGraphics a buffer
Graphics a buffer
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 
Unit 3
Unit 3Unit 3
Unit 3
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

Z buffer

  • 1. A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 1 COMPUTER GRAPHICSCOMPUTER GRAPHICS Visible Surface DetectionVisible Surface Detection (Z-Buffer/Depth Buffer)(Z-Buffer/Depth Buffer)
  • 2. A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 2 DEPTH-BUFFER METHODDEPTH-BUFFER METHOD  Compares surface depth values throughout a scene for each pixel position on the projection plane  Usually applied to scenes only containing polygons  Fast approach due to easy depth values computation  Also often called the z-buffer method (x2, y2) & z2 (x3, y3) & z3 (x1, y1) & z1  (x1, y1), (x2, y2) & (x3, y3) are the pixel positions of surfaces S1, S2, and S3 respectively.  z1, z2 and z3 defines the depth values (distance) of surfaces S1, S2, and S3 respectively from the View Plane
  • 3. A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 3 DEPTH-BUFFER METHOD (Cont…)DEPTH-BUFFER METHOD (Cont…) 1. Initialise the depth buffer and frame buffer so that for all buffer positions (x, y) depthBuff(x, y) = 1.0 frameBuff(x, y) = bgColour 2. Process each polygon in a scene, one at a time – For each projected (x, y) pixel position of a polygon, calculate the depth z (if not already known) – If z < depthBuff(x, y), compute the surface colour at that position and set depthBuff(x, y) = z frameBuff(x, y) = surfColour(x, y)  After all surfaces are processed depthBuff and frameBuff will store correct values
  • 4. A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 4 DEPTH CALCULATIONDEPTH CALCULATION
  • 5. ExampleExample A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 1 6 6 6 6 6 6 1 1 6 6 6 6 6 1 1 1 6 6 6 6 1 1 1 1 6 6 6 1 1 1 1 1 6 6 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 6 6 6 6 6 6 1 6 6 6 6 6 6 1 1 6 6 6 6 6 1 1 1 6 6 6 6 1 1 1 1 6 6 6 1 1 1 1 1 6 6 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Surface-1 Depth Buffer Depth Buffer Frame Buffer
  • 6. ExampleExample A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 6 6 6 6 6 6 6 6 1 6 6 6 6 6 6 1 1 6 6 6 6 6 1 1 1 6 6 6 6 1 1 1 1 6 6 6 7 1 1 1 1 6 6 7 7 7 1 1 1 6 7 7 7 7 7 1 1 1 1 1 1 1 1 1 1 6 6 6 6 6 6 6 1 6 6 6 6 6 6 1 1 6 6 6 6 6 1 1 1 6 6 6 6 1 1 1 1 6 6 6 1 1 1 1 1 6 6 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 7 1 1 1 1 1 1 7 1 1 1 1 1 7 1 1 1 1 7 1 1 1 7 1 1 1 1 1 1 1 1 1 1 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 6 6 1 6 6 6 6 6 6 1 1 6 6 6 6 6 1 1 1 6 6 6 6 1 1 1 1 6 6 6 1 1 1 1 1 6 6 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Surface-2Depth Buffer Depth Buffer Frame Buffer
  • 7. A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 7 Iterative Calculations (cont…)Iterative Calculations (cont…) top scan line bottom scan line y scan line y - 1 scan line x x’
  • 8. A. K. Biswas, Dept. Of Computer Apllication, B.I.T., Durg 8 DISADVANTAGES OF DEPTH BUFFERDISADVANTAGES OF DEPTH BUFFER This method only find out one visible surface at each pixel position that means it deals with only Opaque surface. 1 2 3 4 5 6 1 Red 2 Red 3 Green 4 Blue 5 Green 6 Red