3-D GEOMETRIC TRANSFORMATIONS, Essays (university) of Computer Graphics

UNIT -V 3-D GEOMETRIC TRANSFORMATIONS: Translation, rotation, scaling, reflection and shear transformation and composite transformations. Visible surface detection methods: Classification, back-face detection, depthbuffer, scan-line, depth sorting

Typology: Essays (university)

2019/2020

Uploaded on 04/29/2020

aravind-y
aravind-y 🇮🇳

4.4

(5)

6 documents

1 / 20

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MECH- III Year R16 Reg NGI
Y. N. D. Aravind Page 1
UNIT -V
3-D GEOMETRIC TRANSFORMATIONS: Translation, rotation, scaling, reflection and shear
transformation and composite transformations. Visible surface detection methods: Classification, back-face
detection, depthbuffer, scan-line, depth sorting
Three Dimensional Transformations
The geometric transformations play a vital role in generating images of three Dimensional objects with
the help of these transformations. The location of objects relative to others can be easily expressed.
Sometimes viewpoint changes rapidly, or sometimes objects move in relation to each other. For this
number of transformation can be carried out repeatedly.
Translation
It is the movement of an object from one position to another position. Translation is done using
translation vectors. There are three vectors in 3D instead of two. These vectors are in x, y, and z
directions. Translation in the x-direction is represented using Tx. The translation is y-direction is
represented using Ty. The translation in the z- direction is represented using Tz.
If P is a point having co-ordinates in three directions (x, y, z) is translated, then after translation its
coordinates will be (x1 y1 z1) after translation. Tx Ty Tz are translation vectors in x, y, and z directions
respectively.
x1=x+ Tx
y1=y+Ty
z1=z+ Tz
Three-dimensional transformations are performed by transforming each vertex of the object. If an
object has five corners, then the translation will be accomplished by translating all five points to new
locations. Following figure 1 shows the translation of point figure 2 shows the translation of the cube.
Matrix for translation
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download 3-D GEOMETRIC TRANSFORMATIONS and more Essays (university) Computer Graphics in PDF only on Docsity!

UNIT -V

3-D GEOMETRIC TRANSFORMATIONS: Translation, rotation, scaling, reflection and shear

transformation and composite transformations. Visible surface detection methods: Classification, back-face

detection, depthbuffer, scan-line, depth sorting

Three Dimensional Transformations

The geometric transformations play a vital role in generating images of three Dimensional objects with the help of these transformations. The location of objects relative to others can be easily expressed. Sometimes viewpoint changes rapidly, or sometimes objects move in relation to each other. For this number of transformation can be carried out repeatedly.

Translation

It is the movement of an object from one position to another position. Translation is done using translation vectors. There are three vectors in 3D instead of two. These vectors are in x, y, and z directions. Translation in the x-direction is represented using Tx. The translation is y-direction is represented using Ty. The translation in the z- direction is represented using Tz. If P is a point having co-ordinates in three directions (x, y, z) is translated, then after translation its coordinates will be (x^1 y^1 z^1 ) after translation. Tx Ty Tz are translation vectors in x, y, and z directions respectively. x^1 =x+ Tx y^1 =y+Ty z^1 =z+ Tz Three-dimensional transformations are performed by transforming each vertex of the object. If an object has five corners, then the translation will be accomplished by translating all five points to new locations. Following figure 1 shows the translation of point figure 2 shows the translation of the cube.

Matrix for translation

Matrix representation of point translation Point shown in fig is (x, y, z). It become (x^1 ,y^1 ,z^1 ) after translation. Tx Ty Tz are translation vector. Example: A point has coordinates in the x, y, z direction i.e., (5, 6, 7). The translation is done in the x-direction by 3 coordinate and y direction. Three coordinates and in the z- direction by two coordinates. Shift the object. Find coordinates of the new position. Solution: Co-ordinate of the point are (5, 6, 7) Translation vector in x direction = 3 Translation vector in y direction = 3 Translation vector in z direction = 2 Translation matrix is Multiply co-ordinates of point with translation matrix = [5+0+0+30+6+0+30+0+7+20+0+0+1] = [8 9 9 1] x becomes x^1 = y becomes y^1 = z becomes z^1 =

Rotation

It is moving of an object about an angle. Movement can be anticlockwise or clockwise. 3D rotation is complex as compared to the 2D rotation. For 2D we describe the angle of rotation, but for a 3D angle of rotation and axis of rotation are required. The axis can be either x or y or z. Following figures shows rotation about x, y, z- axis

Following figure show rotation of the object about the Y axis Following figure show rotation of the object about the Z axis

Rotation about Arbitrary Axis

When the object is rotated about an axis that is not parallel to any one of co-ordinate axis, i.e., x, y, z. Then additional transformations are required. First of all, alignment is needed, and then the object is being back to the original position. Following steps are required

  1. Translate the object to the origin
  2. Rotate object so that axis of object coincide with any of coordinate axis.
  3. Perform rotation about co-ordinate axis with whom coinciding is done.
  4. Apply inverse rotation to bring rotation back to the original position.

For such transformations, composite transformations are required. All the above steps are applied on points P' and P".Each step is explained using a separate figure. Step1: Initial position of P' and P"is shown Step2: Translate object P' to origin Step3: Rotate P" to z axis so that it aligns along the z-axis Step4: Rotate about around z- axis

Step5: Rotate axis to the original position Step6: Translate axis to the original position. Inverse Transformations These are also called as opposite transformations. If T is a translation matrix than inverse translation is representing using T-^1. The inverse matrix is achieved using the opposite sign. Example1: Translation and its inverse matrix Translation matrix Inverse translation matrix

Shearing

It is change in the shape of the object. It is also called as deformation. Change can be in the x - direction or y - direction or both directions in case of 2D. If shear occurs in both directions, the object will be distorted. But in 3D shear can occur in three directions.

Hidden Surface Removal

  1. One of the most challenging problems in computer graphics is the removal of hidden parts from images of solid objects.
  2. In real life, the opaque material of these objects obstructs the light rays from hidden parts and prevents us from seeing them.
  3. In the computer generation, no such automatic elimination takes place when objects are projected onto the screen coordinate system.
  4. Instead, all parts of every object, including many parts that should be invisible are displayed.
  5. To remove these parts to create a more realistic image, we must apply a hidden line or hidden surface algorithm to set of objects.
  6. The algorithm operates on different kinds of scene models, generate various forms of output or cater to images of different complexities. Matrix for shear
  1. All use some form of geometric sorting to distinguish visible parts of objects from those that are hidden.
  2. Just as alphabetical sorting is used to differentiate words near the beginning of the alphabet from those near the ends.
  3. Geometric sorting locates objects that lie near the observer and are therefore visible.
  4. Hidden line and Hidden surface algorithms capitalize on various forms of coherence to reduce the computing required to generate an image.
  5. Different types of coherence are related to different forms of order or regularity in the image.
  6. Scan line coherence arises because the display of a scan line in a raster image is usually very similar to the display of the preceding scan line.
  7. Frame coherence in a sequence of images designed to show motion recognizes that successive frames are very similar.
  8. Object coherence results from relationships between different objects or between separate parts of the same objects.
  9. A hidden surface algorithm is generally designed to exploit one or more of these coherence properties to increase efficiency.
  10. Hidden surface algorithm bears a strong resemblance to two-dimensional scan conversions. Types of hidden surface detection algorithms
  11. Object space methods
  12. Image space methods Object space methods: In this method, various parts of objects are compared. After comparison visible, invisible or hardly visible surface is determined. These methods generally decide visible surface. In the wireframe model, these are used to determine a visible line. So these algorithms are line based instead of surface based. Method proceeds by determination of parts of an object whose view is obstructed by other object and draws these parts in the same color. Image space methods: Here positions of various pixels are determined. It is used to locate the visible surface instead of a visible line. Each point is detected for its visibility. If a point is visible, then the pixel is on, otherwise off. So the object close to the viewer that is pierced by a projector through a pixel is determined. That pixel is drawn is appropriate color. These methods are also called a Visible Surface Determination. The implementation of these methods on a computer requires a lot of processing time and processing power of the computer. The image space method requires more computations. Each object is defined clearly. Visibility of each object surface is also determined.

Similarity of object and Image space method In both method sorting is used a depth comparison of individual lines, surfaces are objected to their distances from the view plane. Considerations for selecting or designing hidden surface algorithms: Following three considerations are taken:

  1. Sorting
  2. Coherence
  3. Machine Sorting: All surfaces are sorted in two classes, i.e., visible and invisible. Pixels are colored accordingly. Several sorting algorithms are available i.e.
  4. Bubble sort
  5. Shell sort
  6. Quick sort
  7. Tree sort
  8. Radix sort Different sorting algorithms are applied to different hidden surface algorithms. Sorting of objects is done using x and y, z co-ordinates. Mostly z coordinate is used for sorting. The efficiency of sorting algorithm affects the hidden surface removal algorithm. For sorting complex scenes or hundreds of polygons complex sorts are used, i.e., quick sort, tree sort, radix sort. For simple objects selection, insertion, bubble sort is used. Coherence It is used to take advantage of the constant value of the surface of the scene. It is based on how much regularity exists in the scene. When we moved from one polygon of one object to another polygon of same object color and shearing will remain unchanged. Types of Coherence
  9. Edge coherence
  10. Object coherence
  11. Face coherence
  12. Area coherence
  13. Depth coherence
  14. Scan line coherence
  15. Frame coherence
  16. Implied edge coherence

1. Edge coherence: The visibility of edge changes when it crosses another edge or it also penetrates a visible edge. 2. Object coherence: Each object is considered separate from others. In object, coherence comparison is done using an object instead of edge or vertex. If A object is farther from object B, then there is no need to compare edges and faces. 3. Face coherence: In this faces or polygons which are generally small compared with the size of the image. 4. Area coherence: It is used to group of pixels cover by same visible face. 5. Depth coherence: Location of various polygons has separated a basis of depth. Depth of surface at one point is calculated, the depth of points on rest of the surface can often be determined by a simple difference equation. 6. Scan line coherence: The object is scanned using one scan line then using the second scan line. The intercept of the first line. 7. Frame coherence: It is used for animated objects. It is used when there is little change in image from one frame to another. 8. Implied edge coherence: If a face penetrates in another, line of intersection can be determined from two points of intersection. Algorithms used for hidden line surface detection 1. Back Face Removal Algorithm 2. Z-Buffer Algorithm 3. Painter Algorithm 4. Scan Line Algorithm 5. Subdivision Algorithm 6. Floating horizon Algorithm Back Face Removal Algorithm It is used to plot only surfaces which will face the camera. The objects on the back side are not visible. This method will remove 50% of polygons from the scene if the parallel projection is used. If the perspective projection is used then more than 50% of the invisible area will be removed. The object is nearer to the center of projection, number of polygons from the back will be removed. It applies to individual objects. It does not consider the interaction between various objects. Many polygons are obscured by front faces, although they are closer to the viewer, so for removing such faces back face removal algorithm is used. When the projection is taken, any projector ray from the center of projection through viewing screen to object pieces object at two points, one is visible front surfaces, and another is not visible back surface. This algorithm acts a preprocessing step for another algorithm. The back face algorithm can be represented geometrically. Each polygon has several vertices. All vertices are numbered in clockwise. The normal M 1 is generated a cross product of any two successive edge vectors. M 1 represent vector perpendicular to face and point outward from polyhedron surface N 1 =(v 2 - v 1 )(v 3 - v 2 ) If N 1 .P≥0 visible N 1 .P<0 invisible Advantage 1. It is a simple and straight forward method. 2. It reduces the size of databases, because no need of store all surfaces in the database, only the visible surface is stored.

  1. First, it requires a representation of all opaque surface in scene polygon in this case.
  2. These polygons may be faces of polyhedral recorded in the model of scene or may simply represent thin opaque 'sheets' in the scene.
  3. The IInd important feature of the algorithm is its use of a screen coordinate system. Before step 1, all polygons in the scene are transformed into a screen coordinate system using matrix multiplication. Limitations of Depth Buffer
    1. The depth buffer Algorithm is not always practical because of the enormous size of depth and intensity arrays.
    2. Generating an image with a raster of 500 x 500 pixels requires 2, 50,000 storage locations for each array.
    3. Even though the frame buffer may provide memory for intensity array, the depth array remains large.
    4. To reduce the amount of storage required, the image can be divided into many smaller images, and the depth buffer algorithm is applied to each in turn.
    5. For example, the original 500 x 500 faster can be divided into 100 rasters each 50 x 50 pixels.
    6. Processing each small raster requires array of only 2500 elements, but execution time grows because each polygon is processed many times.
    7. Subdivision of the screen does not always increase execution time instead it can help reduce the work required to generate the image. This reduction arises because of coherence between small regions of the screen. Painter Algorithm It came under the category of list priority algorithm. It is also called a depth-sort algorithm. In this algorithm ordering of visibility of an object is done. If objects are reversed in a particular order, then correct picture results. Objects are arranged in increasing order to z coordinate. Rendering is done in order of z coordinate. Further objects will obscure near one. Pixels of rear one will overwrite pixels of farther objects. If z values of two overlap, we can determine the correct order from Z value as shown in fig (a). If z objects overlap each other as in fig (b) this correct order can be maintained by splitting of objects. Depth sort algorithm or painter algorithm was developed by Newell, sancha. It is called the painter algorithm because the painting of frame buffer is done in decreasing order of distance. The distance is from view plane. The polygons at more distance are painted firstly. The concept has taken color from a painter or artist. When the painter makes a painting, first of all, he will paint the entire canvas with the background color. Then more distance objects like mountains,

trees are added. Then rear or foreground objects are added to picture. Similar approach we will use. We will sort surfaces according to z values. The z values are stored in the refresh buffer. Steps performed in-depth sort

  1. Sort all polygons according to z coordinate.
  2. Find ambiguities of any, find whether z coordinate overlap, split polygon if necessary.
  3. Scan convert each polygon in increasing order of z coordinate. Painter Algorithm Step1: Start Algorithm Step2: Sort all polygons by z value keep the largest value of z first. Step3: Scan converts polygons in this order. Test is applied
  4. Does A is behind and non-overlapping B in the dimension of Z as shown in fig (a)
  5. Does A is behind B in z and no overlapping in x or y as shown in fig (b)
  6. If A is behind B in Z and totally outside B with respect to view plane as shown in fig (c)
  7. If A is behind B in Z and B is totally inside A with respect to view plane as shown in fig (d) The success of any test with single overlapping polygon allows F to be painted.

Area Subdivision Algorithm It was invented by John Warnock and also called a Warnock Algorithm. It is based on a divide & conquer method. It uses fundamental of area coherence. It is used to resolve the visibility of algorithms. It classifies polygons in two cases i.e. trivial and non-trivial. Trivial cases are easily handled. Non trivial cases are divided into four equal subwindows. The windows are again further subdivided using recursion until all polygons classified trivial and non trivial. Classification of Scheme It divides or classifies polygons in four categories:

  1. Inside surface
  2. Outside surface
  3. Overlapping surface
  4. Surrounding surface

1. Inside surface: It is surface which is completely inside the surrounding window or specified boundary as shown in fig (c) 2. Outside surface: The polygon surface completely outside the surrounding window as shown in fig (a)

3. Overlapping surface: It is polygon surface which completely encloses the surrounding window as shown in fig (b) 4. Overlapping surface: It is surface partially inside or partially outside the surface area as shown in fig (c)