1 / 32

Synthesis of Image Calculation of Visibility

Synthesis of Image Calculation of Visibility. Graphics Systems / Computer Graphics and Interfaces. Synthesis of Image.

adila
Download Presentation

Synthesis of Image Calculation of Visibility

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Synthesis of ImageCalculation of Visibility Graphics Systems / Computer Graphics and Interfaces COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  2. Synthesis of Image The image synthesis (English rendering) Is to create images with a high degree of realism from the description of the objects it contains (geometry and interaction with light), light sources and positioning of the observer. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  3. Synthesis of Image Index • Models Lighting • Model Elementary • Phong model • Improved model (attenuation with distance, atmospheric attenuation ...) • Improving image Shading (shading, smooth shading) Texture Mapping; "Bump Textures" "Antialiasing" • Projection of Shadows • Calculation of Visibility (This chapter) • Algorithms in the image space • Algorithms in object space • Algorithm type Priorities List • Global illumination algorithms COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  4. Synthesis of Image- Calculation of Visibility - Objective: from a set of 3D objects, which lines or surfaces of the objects that are visible both from the center of projection (perspective projection) or along the projection direction (for parallel projection), so that show only lines or visible surfaces. Two possible approaches: • For each pixel determining which image object visible (Image Area) is (Each pixel in the image) {Determine the object closer to the observer, given the projection ray; draw the pixel with the appropriate color; } • Compare objects between themselves in order to select the visible part of each (Subject Area) is (Each subject of the "world") {Determine the parts of the object not obstructed by him or other objects; Draw the visible parts in the appropriate color; } COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  5. Synthesis of Image- Calculation of Visibility - Backface culling COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  6. Photo Synthesis - Calculation of Visibility Alg space object Algorithms in space subject to determination of visible lines: The volume: Algorithm Roberts To the edge: Algorithm Appel, Loutrel, Galimberti and Montanari In these algorithms all edges are tested to produce a list of visible segments all edges. By Volume: It is assumed that an edge may be hidden by volume of an object. To the Edge: The test is performed edge against edge noting that the visibility of an edge enjoys consistency, which allows to determine the invisibility of an edge from the invisibility of other edge having with it a common vertex. Consistency edge: Only one edge changes its profile where it crosses behind a visible edge. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  7. Synthesis of Image- Calculation of Visibility - Alg space object By Volume - Algorithm Roberts (1963) Requirement: Each edge must belong to one face of a polyhedron convex. Concave polyhedra must be broken into several convex in order to apply the algorithm. • Remove all rear faces of objects (Backface culling) and corresponding edges • Compare the remaining edges against each volume (Polyhedron) of the scene; 4 of this test situations may occur: • Edge completely hidden by volume. • Edge does not hide • A part of the edge is not hidden • Two parts of the edge are not hidden COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  8. Synthesis of Image- Calculation of Visibility - Alg space object At the edge - Algorithm Appel, Loutrel, Galimberti and Montanari (1967/9, 1970) Unlike alg. Roberts comes to the polygon level. • Determine the faces oriented to the observer (Backface culling). • Calculate "Quantitative Invisibility"A vertex for each object. "Quantitative Invisibility"IQ one point: the number of polygons oriented observer who conceal that. When passing behind an edge of a polygon, their IQ is incremented by 1, and when it is no longer obscured decremented to 1. • When it reaches the end vertex of an edge, the value IQ this vertex is the initial value for the edges emanating from that vertex. Contour line: Is defined as an edge shared by a polygon back-facing with another front-facing, or polygon front-facing isolated. Contour lines: AB, CD, DF, KL EC, EF, JK are not (because they are shared by polygons front-facing) COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  9. Synthesis of Image- Calculation of Visibility - Alg space object TheIQ changes when the edge passes behind a contour line. In the figure the points indicate the intersections of the projection of the edge AB with the projections of contour lines. In the end only the segments with value IQ equal to zero are visible. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  10. Synthesis of Image- Calculation of Visibility - Alg space object Determination of visible faces: Atherton & Weiller (1977) Algorithm oriented area like Warnock, but subdivides the screen area by the border of the polygons instead of rectangular areas. Requirement: Requires the application of a sophisticated algorithm clipping polygons capable of effecting clippinga concave polygons with holes against any other. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  11. Photo Synthesis - Calculation of VisibilityAlg space object - Atherton & Weiller Procedure: Sort polygons by coordinated Z • The polygon nearest the observer is used to perform clipping the other, resulting two lists containing the polygons (or part thereof) that are within and outside the region clipping. • The polygons farther inland than the current list are marked as invisible. • In cases of mutual occlusion, as shown below, the internal list will contain polygons that are hiding at present. These are used to perform the initial polygon clipping about (recursive call) In these cases one stack is used so that the program does not call the algorithm with the same polygon that initially caused the recursive call again. • The polygon is drawn before returning. The exterior of this phase list containing only the outer part of the initial polygon returns as internal list. So to return the visible part of the initial polygon is drawn. • Back to 2, to process the list of outer polygons. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  12. Photo Synthesis - Calculation of VisibilityAlg space object - Atherton & Weiller Note: the clipping is performed with a copy of the original polygon to be a more efficient operation. As a result, the polygon is placed in its own internal list since it coincides in part with the polygon clipping. In the figure the values ​​indicate the Z coordinate of each vertex. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  13. Synthesis of Image- Calculation of Visibility - Alg space image • Oriented area: Algorithm Warnock (1969) • Walked the Line: Line Scanning • Oriented pixel: Z-buffer, Ray Casting Algorithm Warnock • The algorithm successively divides the projected image into rectangular areas. • If easy to decide which polygons visible in the area, then these are shown; otherwise, the area is divided into smaller areas to which the rating is applied recursively. • The smaller areas are fewer polygons are overlapping in these areas and can more easily decide which polygon drawing. The algorithm uses the concept of coherence area: A group of adjacent pixels is usually covered by the same visible surface. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  14. Photo Synthesis - Calculation of Visibility Alg image space: alg. Warnock Procedure alg. Warnock: • Division of the area into 4 equal blocks. At each stage of division, the projection of each polygon will have one of four situations for each field: The four situations in which the decision is possible, with no more subdivision: • All polygons are outside the area  Paint the area to the background color. • Only a polygon that intersects or is fully in the (case b., And c.). Filling the area with the background color of paint and then the part of the polygon which overlaps this area. • If a), ie only one polygon that covers the entire area, without any further projected that area. Paint the area to the color of the polygon. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  15. Photo Synthesis - Calculation of Visibility Alg image space: alg. Warnock • More than one polygon intersects, or is contained surrounds the area but the surrounding area and is ahead of all others. Paint the area with the color of the latter. Case a) in the figure below. In case b) the area is subdivided, resulting in each case one of the 4 previous situations. And if not checked any of the 4 situations? The division is done recursively, not down below the pixel size. In this limiting case, it appears that the closest polygon and is painted with the corresponding color. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  16. Photo Synthesis - Calculation of Visibility Alg image space: alg. Warnock An example of the application of the algorithm. The figures indicate that the situation found for each area. Area indicates that no number was not verified any of the conditions. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  17. Photo Synthesis - Calculation of VisibilityAlg space image: scan line Algorithm Line Scanning The image is created line by line, similar to filler 2D regions algorithm, called the list of active edges algorithm. It uses the concept of consistency of scan line or vertical coherence: The set of visible objects for a certain scan line in an image, differs little from the whole of the previous line. And coherence edge: Only one edge changes its profile where it crosses behind a visible when it enters one edge or face. Data structures used: Table (new) Edges (ET), Table of Polygons (EN) List of Active and Edges (AEL). COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  18. Photo Synthesis - Calculation of VisibilityAlg space image: scan line (Note: descriptors with more information than given in the book, in red) Table Edges (ET): keeps track of all edges whose projection in the view plane is not horizontal. The table entries are ordered by increasing smallest value of Y form, and initially contain: • Coordinates (X, Z) With a lower vertex of Y • Y coordinate of the other end of the edge (or edge height Y1-Y0) • Increments  x /  Y= ∂ X / ∂ Y, Z / Y = ∂ Z / ∂ Y, Used to update the X and Z in the transition to the next scan line • Identification(S) polygon(S) it belongs to the edge (pointer) Table Polygon (PT): information of all the polygons for each containing: • Coefficients of the plane equation (at least  Z / X = ∂ Z / ∂ X) • Color information • Coordinate Z, Recalculating each pixel • Flag in-out, Started False, Is used to control whether processing is inside or outside the polygon Active Edge List (AEL): controls which active edges in the current scan line. Reduces the time to find the edges to be processed at the current scan line. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  19. Photo Synthesis - Calculation of VisibilityAlg space image: scan line To expedite the processing is necessary to maintain a list of polygons that are with flag in-out equal to TRUE. When checking the overlapping polygons, as in line c, More than one polygon has a flag in-out the true. Using equation of each polygon plane is determined by the coordinate Z of each to know which one is closest to the observer. The problem is thus reduced to two dimensions: X and Z c +2 c +1 c b the the b c, c +1 c +2 COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  20. Photo Synthesis - Calculation of VisibilityAlg space image: scan line • Incremental update of an edge to change a scan line: • Initialization of the depth of a polygon when in-out changes to TRUE: • Update Zpolyafter Δx pixels: COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  21. Photo Synthesis - Calculation of VisibilityAlg space image: Z-Buffer Z-Buffer Algorithm One of the simplest algorithms implemented either in hardware or in software. Does not require any pre-processing or sorting performs compared subject-object. Requirements: A frame buffer to the final image and a second buffer to save the Z value corresponding to each pixel, called the Z-Buffer. Procedure: • Fill with zeroes Z-Buffer and frame buffer with the background color (background). The higher value of Z Z-Buffer will correspond to the frontal plane of clipping. • Browsing each polygon (Scan-convert), in any order. • If the point (x, y) of the current polygon processing, is closer to the observer than the current point of the Z-Buffer, then this replaces the previous point. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  22. Photo Synthesis - Calculation of VisibilityAlg space image: Z-Buffer Z-Buffer Algorithm / * Initialize buffers * / is(y = 0; y <YMAX; y + +) is(X = 0, X <XMAX and x + +) BufferIm {(x, y) = background_color; bufferZ (x, y) = 0; } is (Each polygon) { is (Each pixel in the projection of the polygon) {/ * Calculate for Z (x, y) in the polygon * / PolygonZ pz = (x, y); if (Pz> bufferZ (x, y)) BufferZ {(x, y) = pz; bufferIm (x, y) = cor_poligono (); } } } COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  23. Photo Synthesis - Calculation of VisibilityAlg space image: Z-Buffer Optimization in processing: The value z point (X + 1, Y) in the polygon can be obtained from the value z in (X, y) if we consider that the polygon is flat. For z we must solve the equation Ax + By + Cz + D = 0 in order to z: On (X, y) the equation has the value z1 then in (X + 1, Y) the value of z can be calculated: COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  24. Photo Synthesis - Calculation of VisibilityAlg space image: Ray-casting Ray-casting algorithm The visible surface at each pixel of the image is determined by tracing a ray of light from the imaginary center of projection (observer), passing through the center of the pixel to the 3D scene. The color at each pixel is defined by the intersection with the closest object. Set Design and Center window the view plane is(Each line of the image) is(Each pixel Line) {Set the radius from the center of projection passes the pixel is (Each object in the scene) { if ((Intersected object) and (closer than the previous record)) register intercept the object and reference } assigning to the pixel color closest interception } COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  25. Photo Synthesis - Calculation of Visibility Alg type priority list Type algorithms Priorities List • Alg Newel Newel & Sancha • Binary Space-Partitioning Trees Objective: Determining the order of visibility for objects (polygons), ensuring that the image will be created correctly if the objects are drawn by a certain order: 1. Paint the furthest faces the observer first 2. As other, closer, are being painted, downplaying earlier. (Algorithm "Painter") COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  26. Photo Synthesis - Calculation of Visibility Alg type priority list -Alg Newel Newel & Sancha Alg Newel Newel & Sancha(Depth-sort algorithm) Procedure: paint the polygons in order of decreasing distance to the observer. For this 3 steps are performed: • Sort the polygons in order of increasing z (The farthest to closest) • Resolve any ambiguity in the ordering, especially if there are overlapping polygons on coordinate z. It may be necessary splitting polygons. • Paint the polygons in order of farthest to nearest. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  27. Photo Synthesis - Calculation of Visibility Alg priority list type - -Alg Newel Newel & Sancha Kind of ambiguities that can arise in the ordering of polygons: c) b) a) Preprocessing: Sort polygons by coordinated Z farthest vertex Processing: For the last polygon Pthe list, check if there is any polygon Qwhose greatest Z is further away than the lowest Z of PAnd that is being obstructed by P. If not, then Pcan be drawn. Are made to 5 tests for each polygon Qunder the above conditions. If one is found then Pcan be drawn before Q. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  28. Photo Synthesis - Calculation of Visibility Alg priority list type - Binary Space-Partitioning Trees Binary Space-Partitioning Trees Effective for calculating visibility in static scenes where there variation of the viewpoint. Principle of operation: if we can define a plane that separates two sets of polygons (cluster1 andcluster2)Then we can say that the cluster1, which is the same side of the observer, can block, but not be obstructed by cluster2 the other side of the plane. If the latter is drawn first, we obtain an accurate representation of the scene. Each cluster can also be divided recursively, until we get to the polygon level. Algorithm to construct the binary tree: • Choose one of the polygons to the root of the binary tree. • The root is used to divide the space into 2: one of the spaces containing the polygons that are ahead of him in relation to normal; the other part contains them behind. • Recursively divide each of the subspaces obtained in the previous iteration. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  29. Photo Synthesis - Calculation of Visibility Alg priority list type - Binary Space-Partitioning Trees Example tree to create a set of polygons. b) a) d) c) d) Tree obtained if the first polygon is the 5 COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  30. Photo Synthesis - Calculation of Visibility Alg priority list type - Binary Space-Partitioning Trees Pseudo-code for the list of correct polygons, given the observation point: void BSP_displayTree (BSP_tree * tree) if (Tree! = Null) { if (Viewer is in front of tree-> root) { / * Display back child, root, and front child * / BSP_displayTree (tree-> backChild); displayTree (tree-> root); BSP_displayTree (tree-> frontChild); } else { / * Display front child, root, and back child * / BSP_displayTree (tree-> frontChild); displayTree (tree-> root); / * If back-face culling off * / BSP_displayTree (tree-> backChild); } } } Note: If the backface culling is active, the polygons that are not facing the observer are not drawn. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  31. Photo Synthesis - Calculation of Visibility Alg priority list type - Binary Space-Partitioning Trees Result of the query tree for two different points of observation: b) a) COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

  32. Photo Synthesis - Calculation of Visibility Alg priority list type - Binary Space-Partitioning Trees Note: this algorithm can assist in the operation of clipping. Any polygon whose plane does not intersect the viewing volume (VV), has a subtree that is totally out of VV, and therefore not investigated. Choose the node root each sub-tree: the algorithm works whatever polygon However, the best is the one which leads to a smaller number of divisions of the remaining polygons. Heuristics: Randomly test some polygons (eg 6) and choose to root to give the lowest number of divisions. COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 2003

More Related