Download presentation

Presentation is loading. Please wait.

Published byBrooklyn Barrow Modified over 3 years ago

1
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Visible Surface Determination

2
Computer Graphics Inf4/MSc 19/10/2007Lecture 92 Hidden surface removal Inventing renderers led to geometric models, a call for more realism and therefore lots of polygons. All this led to intense interest in finding efficient algorithms for hidden surface removal. Some algorithms are more correctly called visible surface algorithms but the two names are used interchangeably. Today we’ll look at several out of many generated during the period of intense interest (around late 60s to late 70s).

3
Computer Graphics Inf4/MSc 19/10/2007Lecture 93 Visibility of primitives We don’t want to waste time rendering primitives which don’t contribute to the final image. A scene primitive can be invisible for 3 reasons: –Primitive lies outside field of view –Primitive is back-facing (under certain conditions) –Primitive is occluded by one or more objects nearer the viewer How do we remove these efficiently? How do we identify these efficiently?

4
Computer Graphics Inf4/MSc 19/10/2007Lecture 94 The visibility problem. Two problems remain: (Clipping we have covered) Removal of faces facing away from the viewer. Removal of faces obscured by closer objects.

5
Computer Graphics Inf4/MSc 19/10/2007Lecture 95 Visible surface algorithms. Hidden/Visible Surface/Line Elimination/Determination Requirements – Handle diverse set of geometric primitives – Handle large number of geometric primitives Classification: Sutherland, Sproull, Schumacher (1974): Object Space –Geometric calculations involving polygons –Floating point precision: Exact –Often process scene in object order Image Space –Visibility at pixel samples –Integer precision –Often process scene in image order

6
Computer Graphics Inf4/MSc 19/10/2007Lecture 96 Back face culling. We saw in modelling, that the vertices of polyhedra are oriented in an anticlockwise manner when viewed from outside – surface normal N points out. Project a polygon. –Test z component of surface normal. If negative – cull, since normal points away from viewer. –Or if N. V > 0 we are viewing the back face so polygon is obscured. Only works for convex objects without holes, ie. closed orientable manifolds.

7
Computer Graphics Inf4/MSc 19/10/2007Lecture 97 Back face culling Back face culling can be applied anywhere in the pipeline: world or eye coords, NDC, image space. Where is the best point? What portion of the scene is eliminated, on average? –Depends on application If we clip our scene to the view frustrum, then remove all back-facing polygons – are we done? NO! Most views involve overlapping polygons.

8
Computer Graphics Inf4/MSc 19/10/2007Lecture 98 How de we handle overlapping? How about drawing the polygons in the “right order” so that we get the correct result ( eg. blue, then green, then peach)? Is it just a sorting problem ? Yes it is for 2D, but in 3D we can encounter intersecting polygons or groups of non-intersecting polygons which form a cycle where order is impossible (later).

9
Computer Graphics Inf4/MSc 19/10/2007Lecture 99 Simple Z-buffering Simple to include in scanline algorithm. Interpolate z during scan conversion. Maintain a depth (range) image in the frame buffer (16 or 24 bits common ). When drawing, compare with the currently stored z value. Pixel given intensity of nearest polygon.

10
Computer Graphics Inf4/MSc 19/10/2007Lecture 910 Implementation. Initialise frame buffer to background colour. Initialise depth buffer to z = max. value for far clipping plane, ie. LHCS Need to calculate value for z for each pixel –But only for polygons intersecting that pixel. –Could interpolate from values at vertices. Update both frame and depth buffer.

11
Computer Graphics Inf4/MSc 19/10/2007Lecture 911 Determining depth. -Only one subtraction needed -Depth coherence.

12
Computer Graphics Inf4/MSc 19/10/2007Lecture 912 Why is z-buffering so popular ? Advantage Simple to implement in hardware. –Add additional z interpolator for each primitive. –Memory for z-buffer is now not expensive Diversity of primitives – not just polygons. Unlimited scene complexity Don’t need to calculate object-object intersections. Disadvantage Extra memory and bandwidth Waste time drawing hidden objects Z-precision errors May have to use point sampling

13
Computer Graphics Inf4/MSc 19/10/2007Lecture 913 Z-compositing. Can use depth other than from polygons. Reflected laser power Laser range return. Colour photograph. Data courtesy of UNC.

14
Computer Graphics Inf4/MSc 19/10/2007Lecture 914 Ray casting. Sometimes referred to as Ray-tracing. Involves projecting an imaginary ray from the centre of projection (the viewers eye) through the centre of each pixel into the scene. Scene Window Eyepoint

15
Computer Graphics Inf4/MSc 19/10/2007Lecture 915 Computing ray-object intersections. The heart of ray tracing. E.g sphere ( the easiest ! ). Expand, substitute for x,y & z. Gather terms in t. Quadratic equation in t. Solve for t. -No roots – ray doesn’t intersect. - 1 root – ray grazes surface. - 2 roots – ray intersects sphere, (entry and exit)

16
Computer Graphics Inf4/MSc 19/10/2007Lecture 916 Ray-polygon intersection. Not so easy ! 1.Determine whether ray intersects polygon’s plane. 2.Determine whether intersection lies within polygon. Easiest to determine (2) with an orthographic projection onto the nearest axis and the 2D point-in-polygon test. Ray x y z

17
Computer Graphics Inf4/MSc 19/10/2007Lecture 917 Ray casting. Easy to implement for a variety of primitives – only need a ray-object intersection function. Pixel adopts colour of nearest intersection. Can draw curves and surfaces exactly – not just triangles ! Can generate new rays inside the scene to correctly handle visibility with reflections, refraction etc – recursive ray- tracing. Can be extended to handle global illumination. Can perform area-sampling using ray super-sampling. But… too expensive for real-time applications.

18
Computer Graphics Inf4/MSc 19/10/2007Lecture 918 Examples of Ray-traced images.

19
Computer Graphics Inf4/MSc 19/10/2007Lecture 919 Painters algorithm (object space). Draw surfaces in back to front order – nearer polygons “paint” over farther ones. Supports transparency. Key issue is order determination. Doesn’t always work – see image at right.

20
Computer Graphics Inf4/MSc 19/10/2007Lecture 920 BSP (Binary Space Partitioning) Tree. One of class of “list-priority” algorithms – returns ordered list of polygon fragments for specified view point (static pre-processing stage). Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon. 3 4 1 2 5 View of scene from above

21
Computer Graphics Inf4/MSc 19/10/2007Lecture 921 BSP Tree. Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon. 3 3 4 1 2 5 5a 5b 1 2 5a 4 5b back front

22
Computer Graphics Inf4/MSc 19/10/2007Lecture 922 BSP Tree. Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon. 3 3 4 1 2 5 5a 5b 4 5b back front 2 15a front

23
Computer Graphics Inf4/MSc 19/10/2007Lecture 923 BSP Tree. Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon. 3 3 4 1 2 5 5a 5b back front 2 15a front 5b 4

24
Computer Graphics Inf4/MSc 19/10/2007Lecture 924 BSP Tree. Choose polygon arbitrarily Divide scene into front (relative to normal) and back half-spaces. Split any polygon lying on both sides. Choose a polygon from each side – split scene again. Recursively divide each side until each node contains only 1 polygon. 3 3 4 1 2 5 back 2 1 front 5 4 back Alternate formulation starting at 5

25
Computer Graphics Inf4/MSc 19/10/2007Lecture 925 Displaying a BSP tree. Once we have the regions – need priority list BSP tree can be traversed to yield a correct priority list for an arbitrary viewpoint. Start at root polygon. –If viewer is in front half-space, draw polygons behind root first, then the root polygon, then polygons in front. –If polygon is on edge – either can be used. –Recursively descend the tree. If eye is in rear half-space for a polygon – then can back face cull.

26
Computer Graphics Inf4/MSc 19/10/2007Lecture 926 BSP Tree. A lot of computation required at start. –Try to split polygons along good dividing plane –Intersecting polygon splitting may be costly Cheap to check visibility once tree is set up. Can be used to generate correct visibility for arbitrary views. Efficient when objects don’t change very often in the scene.

27
Computer Graphics Inf4/MSc 19/10/2007Lecture 927 Warnock’s Algorithm Elegant hybrid of object-space and image-space. Uses standard graphics solution:- if situation too complex then subdivide problem. Start with root window: –If zero or one intersecting, contained or surrounding polygon then scan convert window –Else subdivide window as quadtree –Recurse until zero or one polygon, or some set depth –Depth may be pixel resolution, display nearest polygon

28
Computer Graphics Inf4/MSc 19/10/2007Lecture 928 Warnock’s example

29
Computer Graphics Inf4/MSc 19/10/2007Lecture 929 Warnock performance measure Warnock’s algorithm: –Screen-space subdivision (screen resolution, r = w*h) hybrid object-space & image-space algorithm good for relatively few static primitives, precise. –Working set size (memory requirement): O(n) –Storage overhead (over & above model): O(n lg r) –Time to resolve visibility to screen precision: O(n*r) –Overdraw (depth complexity – how often a typical pixel is written by rasterization process): none

30
Computer Graphics Inf4/MSc 19/10/2007Lecture 930 BSP performance measure Tree construction and traversal (object-space ordering algorithm – good for relatively few static primitives, precise) Working set size (depends on application): O(1), O(lg n) Storage overhead: O(n 2 ) Time to resolve visibility to screen precision: O(n 2 ) Overdraw: maximum

31
Computer Graphics Inf4/MSc 19/10/2007Lecture 931 Z-buffer performance Brute-force image-space algorithm scores best for complex scenes – not very accurate but is easy to implement and is very general. Working set size: O(1) Storage overhead: O(1) Time to resolve visibility to screen precision: O(n) Overdraw: maximum But even O(n) is now intolerable!

32
Computer Graphics Inf4/MSc 19/10/2007Lecture 932 Ex. Architectural scenes Here there can be an enormous amount of occlusion

33
Computer Graphics Inf4/MSc 19/10/2007Lecture 933 Occlusion at various levels

34
Computer Graphics Inf4/MSc 19/10/2007Lecture 934 Cells & Portals (object-space) Model scene as a graph: Nodes: Cells (or rooms) Edges: Portals (or doors) Graph gives us: Potentially visible set Superset of visible polygons Room to room visibility Not a complete solution ! A BC D E F G A B DCE

35
Computer Graphics Inf4/MSc 19/10/2007Lecture 935 What about other applications? Outdoor environments: –Urban regions, forests, natural scenes in general Or very complex assemblies: mechanical CAD parts (Boeing 777 engine block) Molecular visualization Very hard and still not solved problem

36
Computer Graphics Inf4/MSc 19/10/2007Lecture 936 References for this lecture Foley et al. Chapter 15, all of it. Introductory text, Chapter 13, all of it Or equivalents in other texts, look out for: –(as well as the topics covered today) –Depth sort – Newell, Newell & Sancha –Scan-line algorithms –Weiler-Atherton subdivision on polygon edges

Similar presentations

OK

Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Dentist appt on your birthday Ppt on electric meter testing michigan Ppt on intel core i3 processor Ppt on bond length table Ppt on network marketing Download ppt on turbo generator for cars Download ppt on human eye and colourful world Ppt on e waste recycling Ppt on sports day japan Ppt on review of literature outline