SlideShare a Scribd company logo
1 of 43
Computer Graphics
 Visible Surface Detection Methods
Learning Objectives
 Classification of Visible Surface Detection Algorithms
 Back-Face Detection
 Depth-Buffer Method
 A Buffer Method
 Scan-Line Method
 Depth-Sorting Method
 BSP – TREE Method
 Area Sub Division Method
 Octree Method
 Ray Casting Method
 Curved Surfaces
 Wire-Frame Visibility Methods
 Visibility Detection Functions
Visible Surface Detection
 A major consideration in the generatation of
realistic graphics is determining what is visible
within a scene from a chosen viewing position
 Algorithms to detect visible objects are referred
to as visible-surface detection methods
Classification of Visible Surface
Detection Algorithms
 Object-space methods
 Compares objects and parts of object to each other
within the scene definition to determine which
surfaces should be marked as visible
 Image-space methods
 Visibility is decided point by point at each pixel
position
Back-Face Detection
 A fast and simple object-space method for
locating back faces
 A point (x,y,z) is “inside” a polygon surface with
plane parameters A, B, C, D if :
Ax + By + Cz + D < 0
 When an inside point is along the line of sight to
the surface, the polygon must be a back face and
so cannot be seen
Back-Face Detection
 The test is simplified by considering the normal vector
N to the polygon and the viewing vector V
 This is back face if
V · N > 0
Back-Face Detection …
 V.N = Vz . C > 0
 In right handed viewing system, the polygon is a
back face
if C <= 0
Depth(Z) Buffer Method
 A commonly used image-space approach
 Each surface is processed separately, one point
at a time
 Also called the z-buffer method
 It is generally hardware implemented
Depth Buffer Method
 3 surfaces overlap at (x, y). S1 has the smallest
depth value
Depth Buffer Method
 Two buffers are needed
 Depth buffer (distance information)
 Frame buffer (intensity/color information)
Depth Buffer Method
 Depth-Buffer Algorithm
for all (x,y)
depthBuff(x,y) = 1.0, frameBuff(x,y)=backgndcolor
for each polygon P
for each position (x,y) on polygon P
calculate depth z
if z < depthBuff(x,y) then
depthBuff(x,y) =z
frameBuff(x,y)=surfColor(x,y)
Depth Calculation
 Calculate the z-value on the plane
 Incremental calculation
C
DByAx
zDCzByAx

 0
C
B
z
C
DyBAx
z
C
A
z
C
DByxA
z
yxyx
yxyx








),()1,(
),(),1(
)1(
)1(
),(positionofdepththe:),( yxz yx
Accumulation Buffer (A-Buffer)
 An extension of the depth-buffer for dealing
with anti-aliasing, area-averaging, transparency,
and translucency
 The depth-buffer method identifies only one
visible surface at each pixel position
 Cannot accumulate color values for more than one
transparent and translucent surfaces
 Even more memory intensive
 Widely used for high quality rendering
Accumulation Buffer (A-Buffer)
 Each position in the A-buffer has two
fields
 Depth field: Stores a depth value
 Surface data field
 RGB intensity components
 Opacity parameter (percent of transparency)
 Depth
 Percent of area coverage
 Surface identifier
Scan-Line Method
 Image space method
 Extension of scan-line algorithm for polygon
filling
 As each scan line is processed, all polygon
surface projections intersecting that line are
examined to determine which are visible
Scan-Line Method
 Example
Scan-Line Method (cont…)
Pixel positions across each scan-line are
processed from left to right
At the left intersection with a surface the surface
flag is turned on (S1flag, S2 flag – on/off)
At the right intersection point the flag is turned
off
We only need to perform depth calculations
when more than one surface has its flag turned on
at a certain scan-line position
Scan-Line Method (cont…)
Two important tables are maintained:
 The edge table
 The surface facet table
The edge table contains:
 Coordinate end points of reach line in the scene
 The inverse slope of each line
 Pointers into the surface facet table to connect
edges to surfaces
Scan-Line Method (cont…)
The surface facet tables contains:
 The plane coefficients
 Surface material properties
 Other surface data
 Maybe pointers into the edge table
Scan-Line Method Limitations
The scan-line method runs into trouble when
surfaces cut through each other or otherwise
cyclically overlap
Such surfaces need to be divided
ImagestakenfromHearn&Baker,“ComputerGraphicswithOpenGL”(2004)
Scan-Line Method Limitations
Depth-Sorting Method
 Both image-space and object-space operations
 Also called painter’s algorithm
 Surfaces sorted in order of increasing depth
 Surfaces scan-converted in order, starting with the surface of greatest
depth
B behind A as seen by viewer Fill B then A
Depth Sorting
 We make the following tests for each polygon that has
a depth overlap with S
 If any one of these tests is true, no reordering is
necessary for S and the polygon being tested
 Polygon S is completely behind the overlapping surface
relative to the viewing position
 The overlapping polygon is completely in front of S relative
to the viewing position
 The boundary-edge projections of the two polygons onto the
view plane do not overlap
Depth Sorting
Depth Sorting
Depth Sorting
 Example
BSP Trees
 Binary space partitioning is an efficient method
for determining object visibility
 Paint surfaces into the frame buffer from back
to front
 Particularly useful when the view reference point
changes, but the objects are at fixed positions
BSP Tree Construction
1. Choose a polygon T and compute the equation of the plane it
defines
2. Test all the vertices of all the other polygons to determine if
they are in front of, behind, or in the same plane as T.
3. If the plane intersects a polygon, divide the polygon at the
plane
4. Polygons are placed into a binary search three with T as the
root
5. Call the procedure recursively on the left and right subtree
BSP Tree Construction
Area Subdivision
 Four possible relationships between polygon surfaces
and a rectangular section of the viewing plane
 Terminating criteria
 Case 1: An area has no inside, overlapping, or surrounding
surfaces (all surfaces are ourside the area)
 Case 2: An area has only one inside, overlapping or
surrounding surfaces
 Case 3: An area has one surrounding surface that obscures all
Octrees
 Visible-surface identification is accomplished by
searching octree nodes in a front-to-back order
Ray Casting
 We consider the line of sight
from the a pixel position through
the scene
 Useful for volume data
 Ray casting is a special case of
ray tracing that we will study
later
Ray Casting Examples
Curved Surfaces
Surfaces are described using special curves;
representations for curves generalize to representations
for surfaces
 Explicit form:
 Implicit form:
 Parametric form:
),( yxfz 
0),,( zyxf
))(),(),((),,( tztytxzyx p
Surface contour plots
 Y = f(x,z)
 Identify visible curve section
maintain ymin to y max values previously
calculated for the pixel x
 Increment x by 1 and find y, if y in the range, y
not visible. Otherwise visible
 Similarlly find YZ plane and XZ plane to find
visible area
 Display all object edges – difficult to determine front and back
 Depth cueing – displayed intensity of a line is a function of its
distance from the viewer
Wire-Frame Visibility Methods
Wire-Frame Visibility Methods
 Detect hidden lines and display them differently
Wire-Frame Surface-Visibility
 Compare edge positions with surface positions
 Similar to line clipping, but we need to compare depths as well
Wire-Frame Depth Cueing
 Vary the brightness of objects in a scene as a function of
distance from the viewing position
minmax
max
)(
dd
dd
dfdepth



 Multiply each pixel color by:
Where d is the distance of a point
from the viewing position
Visibility Detection Functions
 Back-face removal:
glEnable(GL_CULL_FACE);
glCullFace(mode);
GL_BACK, GL_FRONT, GL_FRONT_AND_BACK
glDisable(GL_CULL_FACE);
default
 GL_BACK is default. Sometimes we want to see the back faces,
for example if we are in a room we can use GL_FRONT
Visibility Detection Functions
Depth-buffer functions:
 Request depth buffer when initializing:
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH);
 Clear depth buffer each time a new frame is displayed:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 OpenGL depth-buffer visibility-detection routines can be
activated with
glEnable(GL_DEPTH_TEST);
 and deactivated with
glDisable(GL_DEPTH_TEST);
Visibility Detection Functions
 Wire-frame surface visibility:
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
Visibility Detection Functions
 Depth cueing:
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_LINEAR);
 This applies the linear depth function to object colors using
dmin=0.0 and dmax=1.0. We can set different values for dmin and
dmax with the following function calls
glFogf(GL_FOG_START, minDepth);
glFogf(GL_FOG_END, maxDepth);
 Hidden line hidden surface removal(HLHSR) FUNCTION
setHLHSRidentifier(visibilityfunctionIndex)

More Related Content

What's hot

3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphicsSHIVANI SONI
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clippingMani Kanth
 
Back face detection
Back face detectionBack face detection
Back face detectionPooja Dixit
 
Unit 3
Unit 3Unit 3
Unit 3ypnrao
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmMaruf Abdullah (Rion)
 
Polygon filling
Polygon fillingPolygon filling
Polygon fillingAnkit Garg
 
Production System in AI
Production System in AIProduction System in AI
Production System in AIBharat Bhushan
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmMani Kanth
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphicssabbirantor
 
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
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projectionPooja Dixit
 
Scan line method
Scan line methodScan line method
Scan line methodPooja Dixit
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesOmprakash Chauhan
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingArvind Kumar
 

What's hot (20)

3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
 
Back face detection
Back face detectionBack face detection
Back face detection
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Unit 3
Unit 3Unit 3
Unit 3
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
3 d display methods
3 d display methods3 d display methods
3 d display methods
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Z buffer
Z bufferZ buffer
Z buffer
 
Production System in AI
Production System in AIProduction System in AI
Production System in AI
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithm
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
Shading
ShadingShading
Shading
 
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
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S  LINE DRAWING ALGORITHMBRESENHAM’S  LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projection
 
Scan line method
Scan line methodScan line method
Scan line method
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - Notes
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 

Similar to Computer graphics iv unit

Hidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferHidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferRaj Sikarwar
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determinationPatel Punit
 
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
 
Visible Surface Detection
Visible Surface DetectionVisible Surface Detection
Visible Surface DetectionAmitBiswas99
 
Unit 3 visual realism
Unit 3 visual realismUnit 3 visual realism
Unit 3 visual realismJavith Saleem
 
visual realism Unit iii
 visual realism Unit iii visual realism Unit iii
visual realism Unit iiiArun Prakash
 
7-Surface Detection Methods.ppt
7-Surface Detection Methods.ppt7-Surface Detection Methods.ppt
7-Surface Detection Methods.pptMarkHark1
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9fungfung Chen
 
3 d display-methods-in-computer-graphics(For DIU)
3 d display-methods-in-computer-graphics(For DIU)3 d display-methods-in-computer-graphics(For DIU)
3 d display-methods-in-computer-graphics(For DIU)Rajon rdx
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithmKKARUNKARTHIK
 
Hazard Detection Algorithm for Safe Autonomous Landing
Hazard Detection Algorithm for Safe Autonomous LandingHazard Detection Algorithm for Safe Autonomous Landing
Hazard Detection Algorithm for Safe Autonomous LandingAliya Burkit
 
Hidden lines & surfaces
Hidden lines & surfacesHidden lines & surfaces
Hidden lines & surfacesAnkur Kumar
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics FundamentalsMuhammed Afsal Villan
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentationasodariyabhavesh
 
Module-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdfModule-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdfvikasmittal92
 

Similar to Computer graphics iv unit (20)

Hidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-bufferHidden Surface Removal using Z-buffer
Hidden Surface Removal using Z-buffer
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determination
 
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
 
unit 4.pptx
unit 4.pptxunit 4.pptx
unit 4.pptx
 
UNIT-V
UNIT-VUNIT-V
UNIT-V
 
Visible Surface Detection
Visible Surface DetectionVisible Surface Detection
Visible Surface Detection
 
Unit 3 visual realism
Unit 3 visual realismUnit 3 visual realism
Unit 3 visual realism
 
visual realism Unit iii
 visual realism Unit iii visual realism Unit iii
visual realism Unit iii
 
7-Surface Detection Methods.ppt
7-Surface Detection Methods.ppt7-Surface Detection Methods.ppt
7-Surface Detection Methods.ppt
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9
 
3 d display-methods-in-computer-graphics(For DIU)
3 d display-methods-in-computer-graphics(For DIU)3 d display-methods-in-computer-graphics(For DIU)
3 d display-methods-in-computer-graphics(For DIU)
 
posterfinal
posterfinalposterfinal
posterfinal
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithm
 
Hazard Detection Algorithm for Safe Autonomous Landing
Hazard Detection Algorithm for Safe Autonomous LandingHazard Detection Algorithm for Safe Autonomous Landing
Hazard Detection Algorithm for Safe Autonomous Landing
 
Hidden lines & surfaces
Hidden lines & surfacesHidden lines & surfaces
Hidden lines & surfaces
 
Hidden Surfaces
Hidden SurfacesHidden Surfaces
Hidden Surfaces
 
3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals3D Graphics : Computer Graphics Fundamentals
3D Graphics : Computer Graphics Fundamentals
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
 
Module-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdfModule-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdf
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 

Computer graphics iv unit

  • 1. Computer Graphics  Visible Surface Detection Methods
  • 2. Learning Objectives  Classification of Visible Surface Detection Algorithms  Back-Face Detection  Depth-Buffer Method  A Buffer Method  Scan-Line Method  Depth-Sorting Method  BSP – TREE Method  Area Sub Division Method  Octree Method  Ray Casting Method  Curved Surfaces  Wire-Frame Visibility Methods  Visibility Detection Functions
  • 3. Visible Surface Detection  A major consideration in the generatation of realistic graphics is determining what is visible within a scene from a chosen viewing position  Algorithms to detect visible objects are referred to as visible-surface detection methods
  • 4. Classification of Visible Surface Detection Algorithms  Object-space methods  Compares objects and parts of object to each other within the scene definition to determine which surfaces should be marked as visible  Image-space methods  Visibility is decided point by point at each pixel position
  • 5. Back-Face Detection  A fast and simple object-space method for locating back faces  A point (x,y,z) is “inside” a polygon surface with plane parameters A, B, C, D if : Ax + By + Cz + D < 0  When an inside point is along the line of sight to the surface, the polygon must be a back face and so cannot be seen
  • 6. Back-Face Detection  The test is simplified by considering the normal vector N to the polygon and the viewing vector V  This is back face if V · N > 0
  • 7. Back-Face Detection …  V.N = Vz . C > 0  In right handed viewing system, the polygon is a back face if C <= 0
  • 8. Depth(Z) Buffer Method  A commonly used image-space approach  Each surface is processed separately, one point at a time  Also called the z-buffer method  It is generally hardware implemented
  • 9. Depth Buffer Method  3 surfaces overlap at (x, y). S1 has the smallest depth value
  • 10. Depth Buffer Method  Two buffers are needed  Depth buffer (distance information)  Frame buffer (intensity/color information)
  • 11. Depth Buffer Method  Depth-Buffer Algorithm for all (x,y) depthBuff(x,y) = 1.0, frameBuff(x,y)=backgndcolor for each polygon P for each position (x,y) on polygon P calculate depth z if z < depthBuff(x,y) then depthBuff(x,y) =z frameBuff(x,y)=surfColor(x,y)
  • 12. Depth Calculation  Calculate the z-value on the plane  Incremental calculation C DByAx zDCzByAx   0 C B z C DyBAx z C A z C DByxA z yxyx yxyx         ),()1,( ),(),1( )1( )1( ),(positionofdepththe:),( yxz yx
  • 13. Accumulation Buffer (A-Buffer)  An extension of the depth-buffer for dealing with anti-aliasing, area-averaging, transparency, and translucency  The depth-buffer method identifies only one visible surface at each pixel position  Cannot accumulate color values for more than one transparent and translucent surfaces  Even more memory intensive  Widely used for high quality rendering
  • 14. Accumulation Buffer (A-Buffer)  Each position in the A-buffer has two fields  Depth field: Stores a depth value  Surface data field  RGB intensity components  Opacity parameter (percent of transparency)  Depth  Percent of area coverage  Surface identifier
  • 15. Scan-Line Method  Image space method  Extension of scan-line algorithm for polygon filling  As each scan line is processed, all polygon surface projections intersecting that line are examined to determine which are visible
  • 17. Scan-Line Method (cont…) Pixel positions across each scan-line are processed from left to right At the left intersection with a surface the surface flag is turned on (S1flag, S2 flag – on/off) At the right intersection point the flag is turned off We only need to perform depth calculations when more than one surface has its flag turned on at a certain scan-line position
  • 18. Scan-Line Method (cont…) Two important tables are maintained:  The edge table  The surface facet table The edge table contains:  Coordinate end points of reach line in the scene  The inverse slope of each line  Pointers into the surface facet table to connect edges to surfaces
  • 19. Scan-Line Method (cont…) The surface facet tables contains:  The plane coefficients  Surface material properties  Other surface data  Maybe pointers into the edge table
  • 20. Scan-Line Method Limitations The scan-line method runs into trouble when surfaces cut through each other or otherwise cyclically overlap Such surfaces need to be divided ImagestakenfromHearn&Baker,“ComputerGraphicswithOpenGL”(2004)
  • 22. Depth-Sorting Method  Both image-space and object-space operations  Also called painter’s algorithm  Surfaces sorted in order of increasing depth  Surfaces scan-converted in order, starting with the surface of greatest depth B behind A as seen by viewer Fill B then A
  • 23. Depth Sorting  We make the following tests for each polygon that has a depth overlap with S  If any one of these tests is true, no reordering is necessary for S and the polygon being tested  Polygon S is completely behind the overlapping surface relative to the viewing position  The overlapping polygon is completely in front of S relative to the viewing position  The boundary-edge projections of the two polygons onto the view plane do not overlap
  • 27. BSP Trees  Binary space partitioning is an efficient method for determining object visibility  Paint surfaces into the frame buffer from back to front  Particularly useful when the view reference point changes, but the objects are at fixed positions
  • 28. BSP Tree Construction 1. Choose a polygon T and compute the equation of the plane it defines 2. Test all the vertices of all the other polygons to determine if they are in front of, behind, or in the same plane as T. 3. If the plane intersects a polygon, divide the polygon at the plane 4. Polygons are placed into a binary search three with T as the root 5. Call the procedure recursively on the left and right subtree
  • 30. Area Subdivision  Four possible relationships between polygon surfaces and a rectangular section of the viewing plane  Terminating criteria  Case 1: An area has no inside, overlapping, or surrounding surfaces (all surfaces are ourside the area)  Case 2: An area has only one inside, overlapping or surrounding surfaces  Case 3: An area has one surrounding surface that obscures all
  • 31. Octrees  Visible-surface identification is accomplished by searching octree nodes in a front-to-back order
  • 32. Ray Casting  We consider the line of sight from the a pixel position through the scene  Useful for volume data  Ray casting is a special case of ray tracing that we will study later
  • 34. Curved Surfaces Surfaces are described using special curves; representations for curves generalize to representations for surfaces  Explicit form:  Implicit form:  Parametric form: ),( yxfz  0),,( zyxf ))(),(),((),,( tztytxzyx p
  • 35. Surface contour plots  Y = f(x,z)  Identify visible curve section maintain ymin to y max values previously calculated for the pixel x  Increment x by 1 and find y, if y in the range, y not visible. Otherwise visible  Similarlly find YZ plane and XZ plane to find visible area
  • 36.  Display all object edges – difficult to determine front and back  Depth cueing – displayed intensity of a line is a function of its distance from the viewer Wire-Frame Visibility Methods
  • 37. Wire-Frame Visibility Methods  Detect hidden lines and display them differently
  • 38. Wire-Frame Surface-Visibility  Compare edge positions with surface positions  Similar to line clipping, but we need to compare depths as well
  • 39. Wire-Frame Depth Cueing  Vary the brightness of objects in a scene as a function of distance from the viewing position minmax max )( dd dd dfdepth     Multiply each pixel color by: Where d is the distance of a point from the viewing position
  • 40. Visibility Detection Functions  Back-face removal: glEnable(GL_CULL_FACE); glCullFace(mode); GL_BACK, GL_FRONT, GL_FRONT_AND_BACK glDisable(GL_CULL_FACE); default  GL_BACK is default. Sometimes we want to see the back faces, for example if we are in a room we can use GL_FRONT
  • 41. Visibility Detection Functions Depth-buffer functions:  Request depth buffer when initializing: glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH);  Clear depth buffer each time a new frame is displayed: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  OpenGL depth-buffer visibility-detection routines can be activated with glEnable(GL_DEPTH_TEST);  and deactivated with glDisable(GL_DEPTH_TEST);
  • 42. Visibility Detection Functions  Wire-frame surface visibility: glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  • 43. Visibility Detection Functions  Depth cueing: glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_LINEAR);  This applies the linear depth function to object colors using dmin=0.0 and dmax=1.0. We can set different values for dmin and dmax with the following function calls glFogf(GL_FOG_START, minDepth); glFogf(GL_FOG_END, maxDepth);  Hidden line hidden surface removal(HLHSR) FUNCTION setHLHSRidentifier(visibilityfunctionIndex)