940 likes | 1.3k Views
Advance topics :. UNIT - 6. Topics to cover :. visible surface detection concepts, back-face detection, depth buffer method , illumination, light sources, illumination methods ( ambient , diffuse reflection, specular reflection),
E N D
Advance topics : UNIT - 6
Topics to cover : • visible surface detection concepts, • back-face detection, • depth buffer • method, illumination, • light sources, • illumination methods (ambient, diffuse reflection, specular reflection), • Color models: properties of light, XYZ, RGB, YIQ and CMY color models
Introduction • Purpose • Identify the parts of a scene that are visible from a chosen viewing position. • Classification • Object-Space Methods • Compare objects and parts of objects to each other within the scene definition. • Image-Space Methods • Visibility is decided point by point at each pixel position on the projection plane. • Sorting : Facilitate depth comparisons • Coherence : Take advantage of regularities in a scene
Visible Surface Detection • A major consideration in the generation 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
visible surface detection concepts Object space algorithms: determine which objects are in front of others Resize doesn’t require recalculation Works for static scenes May be difficult to determine Image space algorithms: determine which object is visible at each pixel Resize requires recalculation Works for dynamic scenes
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 Culling • Back faces • Back-face removal expected to eliminate about half of the polygon surfaces in a scene. • A scene contains only nonoverlapping convex polyhedra
Depth-Buffer Method • Depth-buffer(z-buffer) Method • Object depth: Measured from the view plane along the z axis of a viewing system. • Each surface is processed separately. • Can be applied to planar and nonplanar surfaces • Require two buffers: depth and frame buffers • Basic concepts • Project each surface onto the view plane • For each pixel position covered, compare the depth values. • Keep the intensity value of the nearest surface
Depth-Buffer Method • Initial states • Depth buffer : Infinity • Frame buffer : Background color
Depth 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)
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
A-Buffer Method • Extension of Depth-buffer ideas • Drawback of the Depth-buffer method • Deal only with opaque surfaces • A-buffer • Reference a linked list of surfaces • Antialiased, Area-averaged, Accumulation-buffer • Each position has two fields • Depth field • Store a positive or negative real number • Intensity field • Store surface-intensity information or a pointer value
A-Buffer Method • Organization of an A-buffer • Single-surface overlap • Multiple-surface overlap
Scan-Line Method • An extension of scan-line polygon filling • Fill multiple surfaces at the same time • Across each scan line, depth calculations are made for each overlapping surface
Scan-Line Method • Surface tables • Edge table • Coordinate endpoints, inverse slop, pointers into polygon table • Polygon table • Coefficient, intensity, pointers into the edge table • Flag • Taking advantage of Coherence • Pass from one scan line to the next • Same active list • No need of depth calculation • Be careful • not cut through or cyclically overlap each other
Scan-Line Method • Overlapping polygon surfaces
Depth Sorting Method • Painter’s Algorithm • Surfaces are sorted in order of decreasing depth. • Surfaces are scan converted in order, starting with the surface of greatest depth. • Two surfaces with no depth overlap
Painter’s Algorithm Draw surfaces from back (farthest away) to front (closest): Sort surfaces/polygons by their depth (z value) Draw objects in order (farthest to closest) Closer objects paint over the top of farther away objects
Depth Sorting Method • Tests for each surface that overlaps with S in depth: • The bounding rectangles in the xy plane for the two surfaces do not overlap. • Surface S is completely behind the overlapping surface relative to the viewing position. • The overlapping surface is completely in front of S relative to the viewing position. • The projections of the two surfaces onto the view plane do not overlap. If one of these tests is true, no reordering is necessary
Depth Sorting Method Two surfaces with depth overlap but no overlap in the x direction.
Depth Sorting Method Surface S is completely behind the overlapping surface S’ Overlapping surface S’ is completely in front of surface S, but S is not completely behind S’
Depth Sorting Method Two surfaces with overlapping bounding rectangles in the xy plane.
Depth Sorting Method Three surfaces entered into the sorted surface list in the order S, S’, S” should be reordered S’, S”, S. Surface S has greater depth but obscures surface S’
BSP-Tree Method • Binary Space-Partitioning (BSP) tree • An efficient method for determining object visibility by painting surface onto the screen • Particularly useful when the view reference point changes, but the scene is fixed. • In VR applications, BSP is commonly used for visibility preprocessing. • Basic concepts • Identify surfaces that are “inside” and “outside” the partitioning plane, relative to the viewing direction
BSP-Tree Method • Partitioning planes • For polygonal objects, we may choose the planes of object facets. • Any intersected polygon is split into two parts • When the BSP tree is complete • Selecting the surfaces for display from back to front • Implemented as hardware for the construction and process of BSP tree.
Area Subdivision Method • Take advantage of area coherence in a scene • Locating those view areas that represent part of a single surface. • Recursively dividing the total viewing area into smaller and smaller rectangles. • Fundamental tests • Identify an area as part of a single surface • By comparing surfaces to the boundary of the area • It is too complex to analyze easily. • Subdivide this area into smaller rectangles.
Area Subdivision Method • Four possible relationships that a surface can have with a specified area boundary: • Surrounding surface • One that completely encloses the area. • Overlapping surface • One that is partly inside and partly outside the area. • Inside surface • One that is completely inside the area. • Outside surface • One that is completely outside the area.
Area Subdivision Method Surrounding Surface Overlapping Surface Inside Surface Outside Surface
Area Subdivision Method • No further subdivisions of a specified area are needed if one of the following conditions is true: • All surfaces are outside surfaces with respect to the area. • Check bounding rectangles of all surfaces • Only one inside, overlapping, or surrounding surface is in the area. • Check bounding rectangles first and other checks • A surrounding surface obscures all other surfaces within the area boundaries.
Area Subdivision Method • Obscuring Surround surfaces identification1 • Using depth sorting • Order surfaces according to their minimum depth from the view plane. • Compute the maximum depth of each surrounding surface.
Area Subdivision Method • Obscuring-surround surfaces identification-2 • Using plane equations • Calculate depth values at the four vertices of the area for all surrounding, overlapping, and inside surfaces. • If the calculated depths for one of the surrounding surfaces is less than those for all other surfaces, it is identified. • If both methods for identifying obscuring-surround surface are fail • It is faster to subdivide the area than to continue with more complex testing.
Area Subdivision Method • Subdivide areas along surface boundaries • Sort the surfaces according to the minimum depth • Use the surface with the smallest depth value to subdivide a given area.
Octree Methods • Octree representation • Projecting octree nodes onto the viewing surface in a front-to-back order
Ray-casting Method • Algorithm • Cast ray from viewpoint from each pixel to find front-most surface
Ray-casting Method • Comments • for p pixels • May (or may not) utilize pixel-to-pixel coherence • Conceptually simple, but not generally used
Curved Surfaces • Visibility detection for objects with curved surfaces • Ray casting • Calculating ray-surface intersection • Locating the smallest intersection distance • Octree • Approximation of a curved surface as a set of plane, polygon surface • Replace each curved surface with a polygon mesh • use one of the other hidden-surface methods
Curved Surfaces • Curved-Surface Representations • Explicit surface equation • Surface Contour Plots • Plotting the visible-surface contour lines • Eliminating those contour section that are hidden by the visible parts of the surface • One way • maintain a list of ymin and ymax • ymin <= y <= ymax: not visible
Wireframe Methods • Wireframe visibility methods • Visible-line detection, hidden-line detection method • Visibility tests are applied to surface edges • Direct Approach • Clipping line • For each line, depth values are compared to the surfaces • Hidden line removal • Using Scan-line methos • Depth sorting (interior : backgnd color)
Wireframe Methods (b) Penetrate a surface (a) Pass behind a surface
Properties of Light • What is light? • “light” = narrow frequency band of electromagnetic spectrum • The Electromagnetic Spectrum • Red: 3.8x1014 hertz • Violet: 7.9x1014 hertz
Spectrum of Light • Monochrome light can be described by frequency f and wavelength λ • c = λ f (c = speed of light) • Normally, a ray of light contains many different waves with individual frequencies • The associated distribution of wavelength intensities per wavelength is referred to as the spectrum of a given ray or light source
Psychological Characteristics of Color • Dominant frequency (hue, color) • Brightness (area under the curve), total light energy • Purity (saturation), how close a light appear to be a pure spectral color, such as red • Purity = ED − EW • ED = dominant energy density • EW = white light energy density • Chromaticity, used to refer collectively to the two properties describing color characteristics: purity and dominant frequency
Intuitive Color Concepts • Color mixing created by an artist • Shades, tints and tones in scene can be produced by mixing color pigments (hues) with white and black pigments • Shades • Add black pigment to pure color • The more black pigment, the darker the shade • Tints • Add white pigment to the original color • Making it lighter as more white is added • Tones • Produced by adding both black and white pigments
Color Matching Experiments • Observers had to match a test light by combining three fixed primaries • Goal: find the unique RGB coordinates for each stimulus