Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chris Mayer & Nic Shulver Hidden Surface Wire frame drawings Wire frame drawings are quick to produce but are often confusing It is difficult to determine.

Similar presentations


Presentation on theme: "Chris Mayer & Nic Shulver Hidden Surface Wire frame drawings Wire frame drawings are quick to produce but are often confusing It is difficult to determine."— Presentation transcript:

1 Chris Mayer & Nic Shulver Hidden Surface Wire frame drawings Wire frame drawings are quick to produce but are often confusing It is difficult to determine which object lies in front of another The display looks cluttered

2 Chris Mayer & Nic Shulver Hidden Surface Hidden surface removal To produce realistic images we must first eliminate surfaces which are not visible to the viewer. There are many approaches to hidden surface/hidden line removal. No one method is best. Several methods may be used.

3 Chris Mayer & Nic Shulver Hidden Surface The simplest method will deal with a single object. Back face removal is a process that eliminates surfaces that face away from the viewer. The first problem is to determine the direction of a face Back face removal without back face removal with back face removal

4 Chris Mayer & Nic Shulver Hidden Surface Back face removal First calculate the face normal. This is perpendicular to the surface and can be calculated from 3 vertex points on the surface Then calculate the angle between the normal and the viewer If the angle is less than 90° then the face is visible If the angle is greater than 90° then the face is invisible

5 Chris Mayer & Nic Shulver Hidden Surface Back surface removal Back face removal only works on a single convex object More than one object or a single concave object may need further work The example shows a complex box, as it should appear And also the version with simple “back face” removal if a face is visible we don’t remove it, right?

6 Chris Mayer & Nic Shulver Hidden Surface Hidden surface removal Many algorithms exist Two well known algorithms are Painters algorithm Z buffer algorithm Hardware support for Z buffers requires a sizeable amount of RAM and was very expensive in the past Now RAM is relatively inexpensive, Z buffering is widespread in consumer-oriented video displays

7 Chris Mayer & Nic Shulver Hidden Surface Painters algorithm Start with object furthest from viewer (but how do we find this out?) Draw this object Move towards viewer drawing each object in turn As in an oil painting objects that are closer to the viewer obscure objects which are further away Simple to explain, harder to implement! Not terribly efficient!

8 Chris Mayer & Nic Shulver Hidden Surface Testing for overlap Test whether z extents overlap Test whether (projected) x extents overlap Test whether (projected) y extents overlap More complicated tests needed may overlap definitely no overlap

9 Chris Mayer & Nic Shulver Hidden Surface Algorithm Perform perspective projection but keep z value Sort surfaces into order Resolve ambiguities, if possible Draw and fill all surfaces starting with those furthest away a b c cannot be resolved

10 Chris Mayer & Nic Shulver Hidden Surface Z buffer Z buffer is an array with one entry for each display pixel Each element is initialised to a large value Each polygon is filled using a scan line algorithm z coordinate is compared to value in z buffer If new surface has value less than current value then it lies in front New value is put in z buffer and surface colour is put in display buffer

11 Chris Mayer & Nic Shulver Hidden Surface Summary Back face removal often done before more complex algorithm (removes half the faces) Painters algorithm is complex if surfaces penetrate each other – forces objects to be “decomposed” into smaller component parts Z buffer requires a lot of memory (often 24 bits per pixel element) but can be implemented in hardware Z buffering is quicker if surfaces are ordered and those closest to viewer filled first


Download ppt "Chris Mayer & Nic Shulver Hidden Surface Wire frame drawings Wire frame drawings are quick to produce but are often confusing It is difficult to determine."

Similar presentations


Ads by Google