Presentation is loading. Please wait.

Presentation is loading. Please wait.

Three-Dimensional Viewing

Similar presentations


Presentation on theme: "Three-Dimensional Viewing"— Presentation transcript:

1 Three-Dimensional Viewing
PPT6 - Intro to Computer Graphics Mehrad Eslami EEL

2 3D Viewing Concepts It is the field of computer graphics that deals with generating and displaying three dimensional objects in a two-dimensional space(eg: display screen) In addition to color and brightness, a 3-D pixels adds a depth property that indicates where the point lies on the imaginary z- axis. When many 3-D pixels are combined, each with its own depth value, the result is a 3-D surface called a texture. Objects are created on a 3-D stage where the current view is derived from the camera and light sources, similar to the real world.

3 3D Viewing Concepts

4 Three-Dimensional Display Methods
Parallel projection Project points on the object surface along parallel lines onto the display plane. Parallel lines are still parallel after projection. Used in engineering and architectural drawings. Perspective projection Project points to the display plane along converging paths. This is the way that our eyes and a camera lens form images and so the displays are more realistic.

5 Three-Dimensional Display Methods
Visible line and surface identification Highlight the visible lines or display them in different color Display nonvisible lines as dashed lines Remove the nonvisible lines Depth Cueing To easily identify the front and back of display objects. Depth information can be included using various methods. A simple method to vary the intensity of objects according to their distance from the viewing position. Eg: lines closest to the viewing position are displayed with the highest intensities and lines farther away are displayed with decreasing intensities.

6 Parallel projection By selecting different viewing positions, we can project visible points on the object onto the display plane to obtain different two-dimensional views of the object.

7 Perspective projection
It has two major characteristics Smaller as their distance from the observer increases. Foreshortened: the size of an object’s dimension along the line of sight are relatively shorter than dimensions across the line of sight.

8 Visible Line and Surface

9 Depth Cueing Application is modeling the effect of the atmosphere on the pixel intensity of objects. More distant objects appear dimmer to us than nearer objects due to light scattering by dust particles, smoke etc.

10 Wire frame The wireframe model is perhaps the oldest way of representing solids. A wireframe model consists of two tables, the vertex table and the edge table. Each entry of the vertex table records a vertex and its coordinate values, while each entry of the edge table has two components giving the two incident vertices of that edge. A wireframe model does not have face information. For example, to represent a cube defined by eight vertices and 12 edges. Because of wireframe models are ambiguous, their uses are limited. However, wireframe models are popular, because they are efficient (i.e., only vertices and edges are displayed and processed) when they work. For example, wireframe models can be used for preview purpose. Rendering a complex model or an animation sequence could be very time consuming if all objects are to be rendered. If wireframe models (usually including its face information) are available, one can easily obtain a general feeling of the final result without waiting for minutes or even hours before spotting a design flaw.

11 Wire frame 16 vertices and 32 edges on the right 8 vertices and 12 edges on the left

12 Projection Coordinates
3D Viewing Pipeline Process Construct World-Coordinate Scene From Modeling-Coordinate Transformations World Coordinates Modeling Coordinates Convert World- Coordinates to Viewing- Coordinates Coordinates Viewing Projection Transformation Projection Coordinates Transform Projection-Coordinates to Normalized-Coordinates Normalized Coordinates Map Normalized- Coordinates to Device-Coordinates Device Coordinates

13 3D Viewing pipeline Pipeline has +/ same structure as in 2D
Similar to making a photo Position and point virtuele camera, press button; Projection plane aka Viewing plane Pipeline has +/ same structure as in 2D

14 3D viewing coordinates P0, Pref , V: define viewing coordinate system
zvp Specification of projection: P0 : View or eye point Pref : Center or look-at point V: View-up vector (projection along vertical axis) zvp : positie view plane yw P0 N V Pref xw zw P0, Pref , V: define viewing coordinate system Several variants possible

15 3D viewing coordinates P0, Pref , V: define viewing coordinate system
xview yview zview yw P0 N V Pref xw zw P0, Pref , V: define viewing coordinate system Several variants possible

16 3D view coordinates n xview yview u v yw zview P0 N V Pref xw zw

17 3D view coordinates xview yview u v zview yw n P0 N V Pref xw zw

18 Octagonal projections
Orthogonal projection is a means of representing a three- dimensional object in two dimensions. It is a form of parallel projection, where all the projection lines are orthogonal to the projection plane, resulting in every plane of the scene appearing in affine transformation on the viewing surface. It is further divided into multiview orthographic projections and axonometric projections. In computer graphics, one of the most common matrices used for orthographic projection can be defined by a 6-tuple, which defines the clipping planes. We’ll see in next slides how a orthogonal works in term of projecting 3D to 2D.

19 Orthogonal projections
The box is translated so that its center is at the origin, then it is scaled to the unit cube which is defined by having a minimum corner at (-1,-1,-1) and a maximum corner at (1,1,1). The orthographic transform can be given by the following matrix:

20 Orthogonal projections
Which can be given as a scaling followed by a translation of the form The inversion of the Projection Matrix, which can be used as the Unprojection Matrix is defined:

21 Orthogonal projections
Parallell projection: Projection lines are parallel Orthogonal projection: Projection lines are parallel and perpendicular to projection plane Isometric projection: Projection lines are parallel, perpendicular to projection plane, and have the same angle with axes. P’2 P1 P’1 P2 P1 P’2 P’1 z x y

22 Orthogonal projections

23 Orthogonal projections
View volume Clipping window yview Near plane Far plane xview zview

24 Orthogonal projections
(xwmax, ywmax, zfar) View volume yview xview zview (xwmin, ywmin, znear)

25 Orthogonal projections
(xwmax, ywmax, zfar) znorm xnorm ynorm Normalized View volume (1,1,1) (-1,-1,-1) yview xview zview (xwmin, ywmin, znear) View volume Translation Scaling From right- to left handed

26 Parallel Projection Point (x,y,z) is projected to position (xp,yp) on the view plane. Projector (oblique) from (x,y,z) to (xp,yp) makes an angle with the line (L) on the projection plane that joins (xp,yp) and (x,y). Line L is at an angle with the horizontal direction in the projection plane.

27 Parallel Projection

28 Parallel Projection Orthographic Projection:

29 Transformation When the human eye views a scene, objects in the distance appear smaller than objects close by - this is known as perspective. While orthographic projection ignores this effect to allow accurate measurements, perspective projection shows distant objects as smaller to provide additional realism. The standard way to represent 2D/3D transformations nowadays is by using homogeneous coordinates. [x,y,w] for 2D, and [x,y,z,w] for 3D. Since we have three axes in 3D as well as translation, that information fits perfectly in a 4x4 transformation matrix.

30 Transformation Transform your 3D points with the inverse camera matrix, followed with whatever transformations they need. If you have surface normal, transform them as well but with w set to zero, as you don't want to translate normal. The matrix you transform normal with must be isotropic; scaling and shearing makes the normal malformed. Transform the point with a clip space matrix. This matrix scales x and y with the field-of-view and aspect ratio, scales z by the near and far clipping planes, and plugs the 'old' z into w. After the transformation, you should divide x, y and z by w. This is called the perspective divide.

31 Transformation Now your vertices are in clip space, and you want to perform clipping so you don't render any pixels outside the viewport bounds. Sutherland-Hodgeman clipping is the most widespread clipping algorithm in use. Transform x and y with respect to w and the half-width and half-height. Your x and y coordinates are now in viewport coordinates. w is discarded, but 1/w and z is usually saved because 1/w is required to do perspective-correct interpolation across the polygon surface, and z is stored in the z-buffer and used for depth testing.

32 Perspective projection
View plane: z = zvp P2 P’2 P1 Projection reference point P’1 yview xview zview View plane: orthogonal to zview axis.

33 Perspective projection
View plane: z = zvp P = (x, y, z) R: Projection reference point (xp, yp, zp) (xr, yr, zr) yview To simplify, Assume R in origin xview zview Question: What is the projection of P on the view plane?

34 Perspective projection
View plane: z = zvp P = (x, y, z) yview (xp, yp, zp) xview zview R= (0,0, 0)

35 Perspective projection
P = (x, y, z) View plane yview y zvp yp R zview z Viewed from the side

36 Perspective projection
Clipping window in View plane Ratio between W=wmaxwmin and zvp determines strenght perspective P = (x, y, z) wmax yview R zview W zvp wmin Viewed from the side

37 Perspective projection
Clipping window in View plane Ratio between W=wmaxwmin and zvp determines strenght perspective. This ratio is 2tan(/2), with  the view angle. yview R zview Viewed from the side

38 Perspective projection
yview R zview

39 Perspective projection
yview R zview

40 Perspective projection

41 Perspective projection
Option 1: Specify view angle . yview R zview W zvp How to specify the ratio between W en zvp? How to specify ‘how much’ perspective I want to see?

42 Perspective projection
yview f (mm) 24 mm R zview W zvp Use camera as metaphor. User specifies focal length f . (20 mm – wide angle, 50 mm – normal, 100 mm – tele). Application adjusts W and/or zvp, such that W/zvp = 24/f. For x: W/zvp = 36/f.

43 Perspective projection
ynorm yview Side view Front view znorm R zview Perspective transformation: Distort space, such that perpendicular projection gives an image in perspective.

44 Perspective projection
ynorm yview znorm 2r R zview zn zf Simplest case: Square window, clipping plane coincides with view plane: zn=zvp

45 Perspective projection
(-r, -r, zn) ((zf /zn)r, (zf /zn)r, zf ) ynorm (-1,-1,-1) (1,1,1) yview znorm 2r R zview zn zf

46 Perspective projection
(r,  r, zn) (rzf /zn, rzf /zn, zf ) ynorm (1, 1, 1) (1,1,1) yview znorm R zview Earlier: How to put this transformation in the pipeline? How to process division by z?

47 Perspective projection
(r, r, zn) (rzf /zn, rzf /zn, zf ) (1, 1, 1) (1,1,1) ynorm yview znorm R zview

48 Perspective projection
(r, r, zn) (rzf /zn, rzf /zn, zf ) (1, 1, 1) (1,1,1) ynorm yview znorm R zview

49 Perspective projection

50 View volume perspective
Clipping window yview xview Far clipping plane zview R Near clipping plane

51 Normalizing view volume
(1,1,1) zview xview yview R ynorm znorm xnorm (1, 1, 1) Normalized View volume Rectangular frustum View Volume

52 Normalized view volume
Normalize Matrix Normalizing formula Dx= Dy= Dz= Kx= Ky= Kz=

53 References Chen, Jim X. "Foundations of 3D Graphics Programming - Using JOGL and Java3D | Jim X. Chen | Springer.” Foundations of 3D Graphics Programming - Using JOGL and Java3D | Jim X. Chen | Springer. Springer, n.d. Web. 06 Oct Wijk, Jack Van. "2IV60 Computer Graphics 2014/2015.” 2IV60 Computer Graphics. N.p., n.d. Web. 06 Oct Younesi, and Malaek, Dr. "Three Diminutionals Viewing." N.p., n.d. Web. Luebke, David. "UVA Computer Graphics: Courses.”UVA Computer Graphics: Courses. N.p., n.d. Web. 06 Oct Wimer, Shmuel. "Computer Graphics Viewing." N.p., May Web. "3D Computer Graphics.” Wikipedia. Wikimedia Foundation, n.d. Web. 06 Oct "Computer Graphics.” Wikipedia. Wikimedia Foundation, n.d. Web. 06 Oct Sung, K., P. Shirley, and S. Baer. "Essentials of Interactive Computer Graphics Concepts and Implementation." N.p., n.d. Web. 06 Oct *some pictures and formulas have copied from the references

54 Thank You


Download ppt "Three-Dimensional Viewing"

Similar presentations


Ads by Google