virtual reality

34
VIRTUAL REALITY 3D COMPUTER GRAPHICS Bharat P. Patil M.Sc. C.S. Part II

Upload: bharat-patil

Post on 25-Jun-2015

301 views

Category:

Education


0 download

DESCRIPTION

Digital signatures are often used to implement electronic signatures, a broader term that refers to any electronic data that carries the intent of a signature, but not all electronic signatures use digital signatures. In some countries, including the United States, India, and members of the European Union, electronic signatures have legal significance.

TRANSCRIPT

Page 1: Virtual reality

VIRTUAL REALITY

3D COMPUTER GRAPHICS

Bharat P. PatilM.Sc. C.S. Part II64

Page 2: Virtual reality

`

Introduction

• 3 D computer Graphics is a large and complex subject.

• 3D computer graphics (in contrast to 2D computer graphics) are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for the purposes of performing calculations and rendering 2D images. Such images may be stored for viewing later or displayed in real-time.

Page 3: Virtual reality

`

The Virtual World Space

Page 4: Virtual reality

`

• The Cartesian system employs the set of 3D axes where each axis is a orthogonal to the other two.

• The above figure illustrates a scheme where a right handed set of axes is used to locate uniquely any point P with Cartesian co-ordinates (x, y, z).

• The right hand system requires that when using ones right hand, the outstretched thumb , first and the middle fingers align with x, y, z axes respectively.

The Virtual World Space (contd..)

Page 5: Virtual reality

`

Positioning the Virtual Observer

• The VO always has a specific location within the VE and will gaze along some line of sight.

• The VO has two eyes which, ideally, receive two different views of the environment to create a 3D stereoscopic image.

• To achieve this two perspective views, a standard computer graphic procedure is used to re-compute the VE’s co-ordinate geometry relative to the VO’s FOR.

Page 6: Virtual reality

`

Positioning the Virtual Observer (contd…)

Page 7: Virtual reality

`

• The procedure used depends upon y]the method employed to define the VO’s FOR within the VE which may involve the use of direction cosine, XYZ fixed angles, XYZ Euler angles or Quaternions.

Positioning the Virtual Observer (contd..)

Page 8: Virtual reality

`

Direction Cosines

• A unit 3D vector has three axial components which are also equal to the cosines of angle formed between the vector and 3 axes.

• These angles are known as direction cosines and can be computed by taking dot product of the vector and the axial unit vectors.

• These direction cosines enable any point P (x, y, z) in one FOR to be transformed into P’ (x’, y’, z’) in another FOR as follows:

Page 9: Virtual reality

`

Direction Cosines (contd…)

Page 10: Virtual reality

`

Direction Cosines (contd…)

Page 11: Virtual reality

`

Direction Cosines (contd…)

Page 12: Virtual reality

`

• r11, r12,r13 are the direction cosines of secondary x-axis.

• r21, r22,r23 are the direction cosines of secondary y-axis.

• r31, r32,r33 are the direction cosines of secondary z-axis.

Direction Cosines (contd…)

Page 13: Virtual reality

`

XYZ Fixed Angles

• The orientation involves the use of 3 separate rotations about a fixed FOR – these angles are frequently referred to as Yaw, Pitch, Roll.

• The roll, pitch, yaw angles can be defined as follows: Roll is the angle of rotation about the Z-axis, Pitch is the angle of rotation about the X-axis and Yaw is the angle of rotation about the Y-axis.

Page 14: Virtual reality

`

Rotate through an angle Roll about the Z-axis

Page 15: Virtual reality

`

Rotate through an angle Pitch about the X-axis

Page 16: Virtual reality

`

Rotate through an angle Yaw about the Y-axis

Page 17: Virtual reality

`

XYZ Euler Angles

• XYZ fixed angles are relative to fixed FOR while XYZ Euler angles are relative to the local rotating FOR.

• E.g.: A FOR is subjected to a pitch rotation and then a yaw rotation relative to the rotating FOR.

• Fig. shows the FOR are mutually aligned.

Page 18: Virtual reality

`

XYZ Euler Angles (contd…)

Page 19: Virtual reality

`

XYZ Euler Angles (contd…)

Page 20: Virtual reality

`

XYZ Euler Angles (contd…)

Page 21: Virtual reality

`

XYZ Euler Angles (contd…)

• Without developing the matrices for roll, pitch, yaw and translate again, we can state that if a VO is located in the VE using XYZ Euler angles, then any point (x, y, z) in the VE is equivalent to (x’, y’, z’) for the VO given the following –

Page 22: Virtual reality

`

XYZ Euler Angles (contd…)

• This too can be represented by the single homogenous matrix operation:

Page 23: Virtual reality

`

XYZ Euler Angles (contd…)

• Where,• T11 = cos yaw cos roll – sin yaw sin pitch sin roll

• T12 = cos yaw sin roll + sin yaw sin pitch cos roll

• T13 = -sin yaw cos pitch

• T14 = -(tx T11+ ty T12 + tz T13 )

• T21 = -cos pitch sin roll

• T22 = cos pitch cos roll

• T23 = sin pitch

• T24 = -(tx T21+ ty T22 + tz T23)

Page 24: Virtual reality

`

XYZ Euler Angles (contd…)

• T31 = sin yaw cos roll + cos yaw sin pitch sin roll

• T32 = sin yaw sin roll – cos yaw sin pitch cos roll

• T33 = cos yaw cos pitch

• T34 = - (tx T31+ ty T32 + tz T33 )

• T41 = 0

• T42 = 0

• T43 = 0

• T44 = 1

Page 25: Virtual reality

`

Quaternions

• It represents the rotation about an arbitrary axis.

• We use 4D rotation and hence termed as Quaternion. It is used to define the orientation of the VO relative to the VE FOR.

• A quaternion ‘q’ is a quadruple of the real nos. and defined as:

q = [s, v]Where, s Scalarv vector

Page 26: Virtual reality

`

Quaternions (contd…)

• q = [s + xi + yj + zk]• Here s, x, y and z are the real nos. and i, j and k

represents the unit vector in x, y and z direction respectively.

• The two quaternions are equal if and only if their corresponding terms are equal.

• q1 = [s1, v1] q2 = [s2, v2]

• q1 = [s1 + x1i + y1j + z1k]

• q2 = [s2 + x2i + y2j + z2k]

Page 27: Virtual reality

`

Quaternions (contd…)

q1 q2 = [(S1S2 - V1V2), S1V2 + S2V1 + V1 X V2]

Page 28: Virtual reality

`

Perspective projection

Page 29: Virtual reality

`

• Projection plane located at the xy plane.• The plane is used to capture Perspective

projection of objects located within the VO’s field of view.

• Any given line its intersection point with the projection plane identifies the corresponding position of the point in a Perspective projection .

Perspective projection (contd…)

Page 30: Virtual reality

`

Back –face removal

• Clipping is relatively computational expensive process any way the number of polygons to be clipped must be investigated and back face removal is one such technique.

• Using the relative orientation of the polygon with the observer, polygons divided into two classes visible and bon-visible.

• As the back-face removal strategy remove those polygon , the VE user will effectively see through the object.

• If this effect is not required , interiors of object will require modeling.

Page 31: Virtual reality

`

Back –face removal (contd…)

Page 32: Virtual reality

`

Back –face removal (contd…)

• From the above equation if cos is positive Ɵthen the surface is visible. If the VO is in such a position that all surface normals are pointing away from him then, the back-face removal technique removes this polygon so that the observer can view through the object

Page 33: Virtual reality

`

• Unless we allow for light to be reflected from one surface to another , there is a very good chance that some surface will not receive any illumination at all.

• Consequently , when this surface are rendered, they will appear black and unnatural.

• In anticipation of this happening , illumination schema allow the existence of some level of background light level called the ambient light.

Ambient light

Page 34: Virtual reality

`