Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 7. Three-Dimensional Viewing

Similar presentations


Presentation on theme: "Chapter 7. Three-Dimensional Viewing"— Presentation transcript:

1 Chapter 7. Three-Dimensional Viewing
2009-1학기 Chapter 7. Three-Dimensional Viewing

2 Overview of three-dimensional viewing concepts
three-dimensional scene을 디스플레이 하려면 camera를 위한 coordinate reference를 설정해야 함 camera film의 plane을 위한 position과 orientation 정의 object description이 camera reference coordinates로 전달되고 display plane에 투영되어, wireframe형태나 lighting and surface-rendering 으로 디스플레이 됨 그림7-1 2009-1학기 Chapter 7. Three-Dimensional Viewing

3 Chapter 7. Three-Dimensional Viewing
Projections Parallel Projection object surface의 점들을 평행선을 따라 display plane 에 투영시키는 것 different viewing position에 따라 한 물체에 대해 different two-dimensional views를 형성 Perspective Projection 물체의 점들을 converging path를 따라 display plane에 투영시키는 방법 viewing position에서 멀리 있는 물체를 가까이 있는 같은 크기의 물체보다 작게 표현함 more realistic v 2009-1학기 Chapter 7. Three-Dimensional Viewing

4 Chapter 7. Three-Dimensional Viewing
Depth cueing a particular viewing direction에서 디스플레이된 물체의 앞과 뒤를 구분할 수 있도록 depth information을 주는 방법 wireframe display에서 depth를 주는 간단한 방법으로 viewing position으로부터 거리에 따라 intensity를 변화시키는 방법이 있다. 다른 방법으로 effect of atmosphere (대기, 기압, 분위기): 멀리 있는 물체는 가까이에 있는 것보다 light scattering 으로 인해 희미하게 표현 v 2009-1학기 Chapter 7. Three-Dimensional Viewing

5 Ambiguity without depth information
(c) (Fig. 7-5) The wireframe representation of the pyramid (a) no depth information (b) viewing direction: downward (c) viewing direction: upward 2009-1학기 Chapter 7. Three-Dimensional Viewing

6 Visible line and surface identification
wireframe display에서 depth relationship을 구분할 때 visible lines을 표시하는 방법이 있다 visible lines을 highlight하거나 다른 색으로 표현 nonvisible lines을 제거하거나 dashed line으로 표현하기도 함 surface의 경우엔 hidden surface를 보이지 않게 함 visible surface algorithm에 따라 viewing plane에 대해 픽셀 하나 하나의 visibility를 첵크해 감 2009-1학기 Chapter 7. Three-Dimensional Viewing

7 Chapter 7. Three-Dimensional Viewing
Surface rendering scene의 light condition이나 surface characteristics에 따라 물체의 surface intensity를 조정함 물체의 surface property로는 transparency의 정도나 surface의 매끄러운 정도를 포함함 이러한 property에 따라 scene의 correct illumination과 shadow region을 표현함 2009-1학기 Chapter 7. Three-Dimensional Viewing

8 Chapter 7. Three-Dimensional Viewing
Exploded (분해) and cutaway (일부를 잘라냄) views 물체를 여러 부분들로 구성했을 경우 각 부분의 내부 구조나 관계를 표현하는데 이용 그림7-8 그림7-9 Three-dimensional and stereoscopic views three-dimensional views는 vibrating flexible mirror로부터 raster image를 반사하여 얻어짐. mirror의 진동에 의하여 scene안의 각 점들이 depth에 따라 다르게 투영된다. stereoscopic device는 scene을 two views로 표현하여 left eye, right eye에 대한 view를 각각 생성해냄- 이러한 two views가 raster monitor에 alternate refresh cycles로 디스플레이 됨 2009-1학기 Chapter 7. Three-Dimensional Viewing

9 Three-Dimensional Viewing Pipeline
공간의 어떤 위치에서도 물체를 바라볼 수 있다 (front, above, back, inside, ..) 3차원으로 기술된 물체를 출력장치의 평면으로 투영해야 한다. Clipping boundaries가 공간상의 한 용적(volume)을 에워싸며 이 용적의 모양은 투영의 타입에 따라 다르다. 2009-1학기 Chapter 7. Three-Dimensional Viewing

10 Chapter 7. Three-Dimensional Viewing
3차원 장면을 컴퓨터에 나타내는 방법은 사진을 찍는 것과 같은 과정을 거침 공간상의 특정 위치에 카메라를 놓는다. 카메라 방향을 조정한다. 셔터를 내려 사진을 찍으면, 3차원 장면은 카메라의 윈도우 크기로 잘라지고 눈에 보이는 표면으로부터의 빛이 카메라 필름에 투영된다. 한 장면을 기술한 world coordinates 를 device coordinates로 변환시키는 일반적 처리 방법 2009-1학기 Chapter 7. Three-Dimensional Viewing

11 General three-dimensional transformation pipeline
Normalized Transformation and Clipping Viewport Transformation Device Coordinates 2009-1학기 Chapter 7. Three-Dimensional Viewing

12 Three-dimensional Viewing-Coordinate Parameters
spatial position, orientation, aperture size of the “camera” 변화시킴 specifying the view plane (그림7-13) establish the viewing-coordinate system (called view reference coordinate system) view plane (projection plane): viewing Zv axis에 수직인 평면 (그림7-14) camera에서 필름 평면에 해당 world coordinate position이 viewing coordinates 로 변환되고 다시 viewing coordinates가 view plane에 투영된다. 2009-1학기 Chapter 7. Three-Dimensional Viewing

13 A right-handed viewing coordinate system
yw yv xv zv P0 = (x0, y0, z0) xw zw 2009-1학기 Chapter 7. Three-Dimensional Viewing

14 Chapter 7. Three-Dimensional Viewing
Figure 7-13 Orientations of the view plane for specified normal vector coordinates relative to the world origin yw yw View plane N xw zw xw zw (a) (b) 2009-1학기 Chapter 7. Three-Dimensional Viewing

15 Chapter 7. Three-Dimensional Viewing
Figure 7-14 Three possible positions for the view plane along the z-view axis yv xv zv 2009-1학기 Chapter 7. Three-Dimensional Viewing

16 viewing coordinate reference frame
view reference point(viewing coordinate system의 원점) 지정 보통 scene중 한 물체에 근접하거나 그 물체의 표면에 있는 점으로 정함. 혹은 물체의 중심이나 물체들로 구성된 그룹 내 한 점이 되기도 함 viewing Zv axis를 위한 positive direction과 view plane 방향 지정 view plane normal vector N 지정 world origin이나 viewing coordinate origin으로부터 선택된 한 점에 이르기까지의 선을 따라 N 방향 설정 (GKS, PHIGS의 경우) 혹은 viewing coordinate origin에 대한 look-at point로 지정된 coordinate position을 N의 방향으로 정함 (GL의 경우) (그림7-15) v 2009-1학기 Chapter 7. Three-Dimensional Viewing

17 Figure 7-15 Specifying the view-plane normal vector N as the direction
yw yv xv zv P0 N P xw zw 2009-1학기 Chapter 7. Three-Dimensional Viewing

18 Chapter 7. Three-Dimensional Viewing
view-up vector V 지정 positive Yv axis world-coordinate origin 에 대한 한 점을 선택하여 정의하며, 결국 원점에서 그 점에 이르는 view-up vector 가 된다. N에 정확하게 직각인 V 벡터를 구하는 일이 어려우므로 보통 유저가 정의하는 벡터 V를 normal vector에 수직인 평면에 투영하는 방법으로 조정하여 얻는다 (그림7-16) 따라서 view up vector V 는 N 과 평행하지 않는 어느 방향의 편리한 벡터로 정한다. N과 V vector를 이용하여 U vector를 계산하여 Xv axis를 정의한다. uvn viewing-coordinate reference system (그림7-17) 2009-1학기 Chapter 7. Three-Dimensional Viewing

19 Chapter 7. Three-Dimensional Viewing
Adjusting the input position of the view-up vector V to a position perpendicular to the normal vector N Adjusted V V Po N 2009-1학기 Chapter 7. Three-Dimensional Viewing

20 The uvn viewing-coordinate reference frame
view plane normal N zview axis 방향을 정의 view-up vector V yview axis 에 이용 N, V 를 이용하여 xview axis 방향을 결정 N n = = (nx, ny, nz) | N | V x n u = = (ux, uy, uz) | V | v = n x u = (vx, vy, vz) 2009-1학기 Chapter 7. Three-Dimensional Viewing

21 A right-handed viewing system defined with unit vectors u, v, and n.
yv v u xv n zv 2009-1학기 Chapter 7. Three-Dimensional Viewing

22 Chapter 7. Three-Dimensional Viewing
한 scene에 대해 여러 view를 얻기 위해서는 view reference point를 고정시키고 N 방향을 변화시킴 (그림 7-19)(그림7-20) => 책 그림 참고 normal vector N만을 변화시키면 V 방향을 제외한 어떤 방향에서도 Scene을 볼 수가 있다. 2009-1학기 Chapter 7. Three-Dimensional Viewing

23 Transformation from world to viewing coordinates
1) view reference point를 world-coordinate system의 원점으로 translate view reference point가 world position (x0, y0, z0)이면 x0 T = y0 z0 에 의해 view reference point를 이동시킴 v 2009-1학기 Chapter 7. Three-Dimensional Viewing

24 Chapter 7. Three-Dimensional Viewing
2) xv, yv, zv axes를 xw, yw, zw axes로 각각 맞추어지도록 rotate three coordinate axis rotations가 필요함 N이 하나의 world-coordinate axis 에 일치하지 않은 경우에 Rz  Ry  Rx 변환으로 Viewing and world systems를 일치시킨다. zv를 xw zw 평면으로 떨어뜨리도록 xw 축을 중심으로 rotate zw와 zv 를 일치시키도록 yw축을 중심으로 rotate v 2009-1학기 Chapter 7. Three-Dimensional Viewing

25 Chapter 7. Three-Dimensional Viewing
yw yw yw yv xv zv yv xv yv zv xw xw xw xv zv zw zw zw 2009-1학기 Chapter 7. Three-Dimensional Viewing

26 Chapter 7. Three-Dimensional Viewing
다른 방법으로 unit uvn vector를 계산하여 composite rotation matrix를 직접 구함 N n = = (n1, n2, n3) |N| V X N u = = (u1, u2, u3) |V X N | v = n X u = (v1, v2, v3) u1 u2 u3 0 R = v1 v2 v3 0 n1 n2 n3 0 2009-1학기 Chapter 7. Three-Dimensional Viewing

27 Chapter 7. Three-Dimensional Viewing
u는 xw axis, v는 yw axis, n은 zw axis로 변환됨 complete world-to-viewing coordinate transformation matrix Mwc,vc = R  T 2009-1학기 Chapter 7. Three-Dimensional Viewing

28 Projection Transformations
scene내 물체의 world-coordinates를 viewing coordinates로 바꾼 뒤에는 3D 물체를 2D view plane에 투영시켜야 한다. two basic projection methods parallel projection, perspective projection 2009-1학기 Chapter 7. Three-Dimensional Viewing

29 Chapter 7. Three-Dimensional Viewing
Parallel Projection object surface의 점들을 평행선을 따라 display plane 에 투영시키는 것 different viewing position에 따라 한 물체에 대해 different two-dimensional views를 형성 Perspective Projection 물체의 점들을 converging path를 따라 display plane에 투영시키는 방법 viewing position에서 멀리 있는 물체를 가까이 있는 같은 크기의 물체보다 작게 표현함 more realistic 2009-1학기 Chapter 7. Three-Dimensional Viewing

30 Chapter 7. Three-Dimensional Viewing
parallel projection coordinate position이 평행선을 따라 view plane으로 변환됨 (그림7-22) projection lines의 방향을 정의하는 projection vector 로 지정 orthographic parallel projection과 oblique parallel projection이 있음 2009-1학기 Chapter 7. Three-Dimensional Viewing

31 Window specification on the view plane
(xwmax, ywmax) View plane Projection window (xwmin, ywmin) 2009-1학기 Chapter 7. Three-Dimensional Viewing

32 Figure 7-22 Parallel projection of an object to the view plane
2009-1학기 Chapter 7. Three-Dimensional Viewing

33 Figure 7-23 Perspective projection of an object to the view plane
Projection reference point p1’ p1 2009-1학기 Chapter 7. Three-Dimensional Viewing

34 orthographic parallel projection
view plane이 zv axis를 따라 zvp 위치에 있다고 하면 viewing coordinates (x, y, z)는 xp = x, yp = y 의 projection coordinates로 바뀜 (그림7-26) v 2009-1학기 Chapter 7. Three-Dimensional Viewing

35 Chapter 7. Three-Dimensional Viewing
Figure 7-26 Orthogonal projection of a spatial position onto a view plane yv (x, y, z) xv (x, y) zv 2009-1학기 Chapter 7. Three-Dimensional Viewing

36 oblique parallel projection (그림7-32)
(그림 7-33) transformation matrix L1cosφ 0 Mparallel = L1sinφ 0 v 2009-1학기 Chapter 7. Three-Dimensional Viewing

37 Oblique Parallel Projection
xv yv plane zv window window (a) orthographic- projection view volume (side view) (b) orthographic-projection view volume (top view) xv yv plane zv window window (c) oblique-projection view volume (side view) (d) oblique-projection view volume (top view) 2009-1학기 Chapter 7. Three-Dimensional Viewing

38 Oblique Parallel Projection
f zv xv yv (x, y, z) (x, y) (xp, yp) View plane L xp = x + L cos f yp = y + L sin f z tan a = L z L = tan a = z L1 xp = x + z (L1 cos f ) yp = y + z (L1 sin f ) v 2009-1학기 Chapter 7. Three-Dimensional Viewing

39 Perspective projection
projection reference point 에서 만나는 projection lines을 따라 점들을 변환시킴 (그림7-40) (그림7-41) 2009-1학기 Chapter 7. Three-Dimensional Viewing

40 Chapter 7. Three-Dimensional Viewing
Figure 7-40 Perspective projection of two equal-length line segments at different distances from the view plane p2 p2’ p2 Projection reference point p1’ p1 p1 2009-1학기 Chapter 7. Three-Dimensional Viewing

41 Perspective projection of a point P
P = (x, y, z) (xp, yp, zp) zvp zprp Projection line위에 있는 모든 점(x’, y’, z’) x’ = x – (x - xprp)u y’ = y – (y - yprp)u z’ = z - (z - zprp) u zprp - zvp dp xp = x = x zprp - z zprp - z zvp - z zprp - zvp dp u = yp = y = y zprp - z zprp - z zprp - z 2009-1학기 Chapter 7. Three-Dimensional Viewing

42 Chapter 7. Three-Dimensional Viewing
Vanishing point 그림7-44 3차원 객체가 perspective transformation을 이용하여 view plane 에 투영될 때 plane 과 평행하지 않는 평행선들은 converging lines으로 투영될 것이다. View plane 에 평행하는 평행선들은 평행선들로 투영될 것이다. 투영된 평행선들이 수렴하는 한 점을 vanishing point (소멸점)이라고 한다. Principal vanishing point: Vanishing point를 구성하는 선들이 물체의 좌표축에 평행하는 경우를 말함. Principal vanishing point의 수는 view plane과 교차하는 좌표축의 수에 의해 결정된다. 2009-1학기 Chapter 7. Three-Dimensional Viewing

43 Principal vanishing points
y Vanishing point x z One point perspective projection (view plane 이 z-axis 만을 교차할 경우) Two point perspective projection (view plane 이 z-axis 와 x-axis 를 동시에 교차할 경우) 2009-1학기 Chapter 7. Three-Dimensional Viewing

44 View Volumes and General Projection Transformations
view window가 주어지면 window boundary를 이용하여 구해짐 view volume내에 있는 물체만 디스플레이에 나타나고 나머지는 clip됨 view volume의 크기는 window size에 따라 다르고 view volume의 모양은 projection 타입에 따라 다르다 parallel projection의 경우에는 view volume의 네 변이 무한의 평행사변형을 형성 perspective projection의 경우에는 projection reference point를 정점으로 하는 피라미드를 형성(그림7-46) 2009-1학기 Chapter 7. Three-Dimensional Viewing

45 Figure 7-46 A perspective projection view volume
Rectangular Frustum View volume clipping window Near clipping plane Far clipping plane Projection Reference point 2009-1학기 Chapter 7. Three-Dimensional Viewing

46 Figure 7-29 A finite orthogonal view volume
Orthogonal projection view volume Far plane Near plane Clipping window 2009-1학기 Chapter 7. Three-Dimensional Viewing

47 Examples of a perspective-projection view volume
reference point xv yv plane xv yv plane window zv zv window window Projection reference point 2009-1학기 Chapter 7. Three-Dimensional Viewing

48 General Parallel-Projection Transformations
parallel projection의 방향은 projection reference point 에서 view window의 중간으로 향하는 projection vector로 지정 oblique projection transformation을 regular parallel projection으로 하기 위해선 shear transformation 필요 projection vector를 viewing coordinates로 표시하면 vp = (px, py, pz)일때 vp를 view plane normal vector N과 일치시키는 shear matrix가 필요 v’p = Mparallel vp = pz 2009-1학기 Chapter 7. Three-Dimensional Viewing

49 Chapter 7. Three-Dimensional Viewing
zv zv window window vp vp’ regular parallelpiped view volume obtained by shearing the view volume oblique projection vector and associated view volume 2009-1학기 Chapter 7. Three-Dimensional Viewing

50 Chapter 7. Three-Dimensional Viewing
Mparallel= b 0 => z axis shear 0 = px + a pz 0 = py + b pz =>    a = - px / pz b = - py / pz px/pz 0 Mparallel= py/pz 0 2009-1학기 Chapter 7. Three-Dimensional Viewing

51 Chapter 7. Three-Dimensional Viewing
Relationships between the parallel-projection vector vp and parameters L, a , ø yv (xp’, yp’, 0) a vp L py px ø pz xv (x, y, 0) zv 2009-1학기 Chapter 7. Three-Dimensional Viewing

52 Chapter 7. Three-Dimensional Viewing
General shape for the perspective view volume with a projection reference point that is not on the zv axis View volume zv View plane Center of window (xprp’, yprp’, zprp) 2009-1학기 Chapter 7. Three-Dimensional Viewing

53 Chapter 7. Three-Dimensional Viewing
Shearing a general perspective view volume to center it on the projection window (x”, y”, z) (x’, y’, z) View plane (z = zvp) Center of window (xprp’, yprp’, zprp) 2009-1학기 Chapter 7. Three-Dimensional Viewing

54 Chapter 7. Three-Dimensional Viewing
General Perspective Projection Transformations 책참고 2009-1학기 Chapter 7. Three-Dimensional Viewing

55 OpenGL Three-Dimensional Viewing Functions
OpenGL 의 기본 라이브러리와 GLU(OpenGL Utility Library)에 viewing 함수 포함 OpenGL Viewing-Tranformation Function glMatrixMode (GL_MODELVIEW); world coordinates 를 viewing coordinates 로 변환하기 위한 matrix 설정 gluLookAt(x0, y0, z0, xref, yref, zref, Vx, Vy, Vz); viewing parameter 설정 viewing reference origin 을 world coordinate position인 p0 = (x0, y0, z0) 로 지정하고, reference position을 Pref = (xref, yref, zref) 로 지정하고, view-up vector를 V = (Vx, Vy, Vz) 로 나타내고, viewing frame의 zview-axis를 N = P0 – Pref 가 되도록 함 gluLookAt function을 부르지 않으면 default viewing parameter 는 다음과 같다: P0 = (0, 0, 0), Pref = (0, 0, -1), V = (0, 1, 0) 2009-1학기 Chapter 7. Three-Dimensional Viewing

56 Chapter 7. Three-Dimensional Viewing
OpenGL Orhtogonal-Projection Function glMaxtrixMode (GL_Projections); Projection matrix 설정 glOrtho (xwmin, xwmax, ywmin, ywmax, dnear, dfar); orthogonal projection parameter 설정, clipping window 선택, default clipping window는 (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0)으로 symmetric normalized square OpenGL Symmetric Perspective-projection Function gluPerspective (theta, aspect, dnear, dfar); theta, aspect: near plane 의 size, position 을 나타냄, aspect 는 clipping window의 aspect ratio 의미 dnear, dfar: view point 로부터 두 clipping plane까지의 거리 2009-1학기 Chapter 7. Three-Dimensional Viewing

57 Chapter 7. Three-Dimensional Viewing
OpenGL General Perspective-Projection Function glFrustrum (xwmin, xwmax, ywmin, ywmax, dnear, dfar); symmetric frustum view volume 혹은 oblique frustum view volume 의 perspective projection 설정 OpenGL Viewports and Display Windows glViewport (xvmin, yvmin, vpWidth, vpHeight); normalized coordinates 에 clipping routines을 적용한 후에 screen coordinates 로 변환 2009-1학기 Chapter 7. Three-Dimensional Viewing

58 Three-Dimensional Clipping Algorithms
view-volume clipping boundary: projection타임에 따라 방향이 다른 평면들로 구성됨 front and back clipping planes는 view plane과 평행하며 constant z-coordinate value를 갖는다. 그 외 다른 네 평면은 임의의 방향을 가짐 view volume의 coordinate values를 orthographic parallel coordinates로 변환하는 projection transformation후에 clipping calculations가 필요 Normalized View Volume normalized projection coordinates: 사각형내 점들을 지정된 3D viewport 내 한 위치로 변환시킨 후에 device coordinates로 변환시킴 normalized view volume은 xwmin = xwmax = 1 ywmin = ywmax = 1 zwmin = zwmax = 1 2009-1학기 Chapter 7. Three-Dimensional Viewing

59 Dimensions of the view volume and three-dimensional viewport
y (xvmax, yvmax, zvmax) x (xvmin, yvmin, zvmin) z (xwmax, ywmax, zback) (xwmin’, ywmin’, zfront) 3D viewport Unit cube (a) Parallelpiped view volume 2009-1학기 Chapter 7. Three-Dimensional Viewing

60 Chapter 7. Three-Dimensional Viewing
viewport clipping 2차원에서와 비슷하게 처리되며 2차원에서 clipping edges에 대한 처리가 clipping planes에 대해 처리된다는 것이 다르다. 6 bits로 구성된 region code 이용 한 선분의 끝점 (x, y, z)에 대해 6 비트중 오른쪽비트부터 bit 1 = 1 if x < xvmin (left) bit 2 = 1 if x > xvmax (right) bit 3 = 1 if y < yvmin (below) bit 4 = 1 if y > yvmax (above) bit 5 = 1 if z < zvmin (front) bit 6 = 1 if z > zvmax (back) 2009-1학기 Chapter 7. Three-Dimensional Viewing

61 Chapter 7. Three-Dimensional Viewing
 양 끝점의 region code가 이면 completely inside 두 점이 다 이 아니면 두 점에 대한 logical and operation값이 nonzero이면 두 점은 six outside region에 있다. 1), 2)의 경우가 아닌 경우 bounding plane 과의 intersection test를 한다. 2009-1학기 Chapter 7. Three-Dimensional Viewing

62 Chapter 7. Three-Dimensional Viewing
011000 011001 011010 00001 000001 000000 100001 bit 1 = 1 if x < xvmin (left) bit 2 = 1 if x > xvmax (right) bit 3 = 1 if y < yvmin (below) bit 4 = 1 if y > yvmax (above) bit 5 = 1 if z < zvmin (front) bit 6 = 1 if z > zvmax (back) 2009-1학기 Chapter 7. Three-Dimensional Viewing


Download ppt "Chapter 7. Three-Dimensional Viewing"

Similar presentations


Ads by Google