SlideShare a Scribd company logo
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

PPT
Hidden surfaces
Mohd Arif
 
PPTX
Hidden surface removal algorithm
KKARUNKARTHIK
 
PPT
Z buffer
AmitBiswas99
 
PPTX
Parallel projection
Prince Shahu
 
PPTX
2 d viewing computer graphics
KALESHWAR KUMAR
 
PPTX
Depth Buffer Method
Ummiya Mohammedi
 
PDF
3D Transformation
SwatiHans10
 
PPTX
3D transformation in computer graphics
SHIVANI SONI
 
Hidden surfaces
Mohd Arif
 
Hidden surface removal algorithm
KKARUNKARTHIK
 
Z buffer
AmitBiswas99
 
Parallel projection
Prince Shahu
 
2 d viewing computer graphics
KALESHWAR KUMAR
 
Depth Buffer Method
Ummiya Mohammedi
 
3D Transformation
SwatiHans10
 
3D transformation in computer graphics
SHIVANI SONI
 

What's hot (20)

PPTX
Overview of the graphics system
Kamal Acharya
 
PDF
Unit 3
ypnrao
 
PPT
Visible surface detection in computer graphic
anku2266
 
PPTX
3 d display methods
Shami Al Rahad
 
PPT
Three dimensional concepts - Computer Graphics
Kongunadu College of engineering and Technology, Namakkal
 
PPTX
Bresenham circle
Taher Barodawala
 
PPT
Visible Surface Detection
AmitBiswas99
 
PPTX
Back face detection
Pooja Dixit
 
PPTX
Cohen-Sutherland Line Clipping Algorithm
Maruf Abdullah (Rion)
 
PPTX
Curve and text clipping
Arvind Kumar
 
PPT
hidden surface elimination using z buffer algorithm
rajivagarwal23dei
 
PPTX
Clipping in Computer Graphics
Laxman Puri
 
PDF
Graphics a buffer
ajeela mushtaq
 
PPTX
Scan line method
Pooja Dixit
 
PPTX
Input of graphical data
Rajapriya82
 
PPT
Window to viewport transformation
Ankit Garg
 
PPT
Hidden lines & surfaces
Ankur Kumar
 
PPT
Composite transformations
Mohd Arif
 
PPT
Polygon clipping
Mohd Arif
 
PPTX
3 d viewing projection
Pooja Dixit
 
Overview of the graphics system
Kamal Acharya
 
Unit 3
ypnrao
 
Visible surface detection in computer graphic
anku2266
 
3 d display methods
Shami Al Rahad
 
Three dimensional concepts - Computer Graphics
Kongunadu College of engineering and Technology, Namakkal
 
Bresenham circle
Taher Barodawala
 
Visible Surface Detection
AmitBiswas99
 
Back face detection
Pooja Dixit
 
Cohen-Sutherland Line Clipping Algorithm
Maruf Abdullah (Rion)
 
Curve and text clipping
Arvind Kumar
 
hidden surface elimination using z buffer algorithm
rajivagarwal23dei
 
Clipping in Computer Graphics
Laxman Puri
 
Graphics a buffer
ajeela mushtaq
 
Scan line method
Pooja Dixit
 
Input of graphical data
Rajapriya82
 
Window to viewport transformation
Ankit Garg
 
Hidden lines & surfaces
Ankur Kumar
 
Composite transformations
Mohd Arif
 
Polygon clipping
Mohd Arif
 
3 d viewing projection
Pooja Dixit
 
Ad

Similar to Computer graphics iv unit (20)

PPT
visible surface detection
Balakumaran Arunachalam
 
PDF
Visual surface detection computer graphics
530BYManoj
 
PDF
Hidden Surface Removal using Z-buffer
Raj Sikarwar
 
PPTX
Visible surface determination
Patel Punit
 
PPT
rural marketing ppt
elaya1984
 
PPT
Visual surface detection i
elaya1984
 
PPTX
unit 4.pptx
PrabinNeupane8
 
PPTX
UNIT-V
VarthiniRamesh
 
PPTX
Visible surface identification
Pooja Dixit
 
PDF
Unit 3 visual realism
Javith Saleem
 
PPTX
visual realism Unit iii
Arun Prakash
 
PPT
7-Surface Detection Methods.ppt
MarkHark1
 
PDF
CG OpenGL surface detection+illumination+rendering models-course 9
fungfung Chen
 
PPTX
3 d display-methods-in-computer-graphics(For DIU)
Rajon rdx
 
PPTX
Hidden surface removal
Ankit Garg
 
PDF
posterfinal
Chengqian Che
 
PDF
Hazard Detection Algorithm for Safe Autonomous Landing
Aliya Burkit
 
PPT
Hidden Surfaces
HiteshJain007
 
PPTX
3D Graphics : Computer Graphics Fundamentals
Muhammed Afsal Villan
 
PPT
Chapter10 image segmentation
asodariyabhavesh
 
visible surface detection
Balakumaran Arunachalam
 
Visual surface detection computer graphics
530BYManoj
 
Hidden Surface Removal using Z-buffer
Raj Sikarwar
 
Visible surface determination
Patel Punit
 
rural marketing ppt
elaya1984
 
Visual surface detection i
elaya1984
 
unit 4.pptx
PrabinNeupane8
 
Visible surface identification
Pooja Dixit
 
Unit 3 visual realism
Javith Saleem
 
visual realism Unit iii
Arun Prakash
 
7-Surface Detection Methods.ppt
MarkHark1
 
CG OpenGL surface detection+illumination+rendering models-course 9
fungfung Chen
 
3 d display-methods-in-computer-graphics(For DIU)
Rajon rdx
 
Hidden surface removal
Ankit Garg
 
posterfinal
Chengqian Che
 
Hazard Detection Algorithm for Safe Autonomous Landing
Aliya Burkit
 
Hidden Surfaces
HiteshJain007
 
3D Graphics : Computer Graphics Fundamentals
Muhammed Afsal Villan
 
Chapter10 image segmentation
asodariyabhavesh
 
Ad

Recently uploaded (20)

PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
CDH. pptx
AneetaSharma15
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Virus sequence retrieval from NCBI database
yamunaK13
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
CDH. pptx
AneetaSharma15
 

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)