# ©Larry F. Hodges (modified by Amos Johnson) 1 Arbitrary 3-D View-Plane.

## Presentation on theme: "©Larry F. Hodges (modified by Amos Johnson) 1 Arbitrary 3-D View-Plane."— Presentation transcript:

©Larry F. Hodges (modified by Amos Johnson) 1 Arbitrary 3-D View-Plane

©Larry F. Hodges (modified by Amos Johnson) 2 Specifying An Arbitrary 3-D View Two coordinate systems World reference coordinate system (WRC) Viewing reference coordinate system (VRC) First specify a viewplane and coordinate system (WRC) View Reference Point (VRP) View Plane Normal (VPN) View Up Vector (VUP) Specify a window on the view plane (VRC) Max and min u,v values ( Center of the window (CW)) Projection Reference Point (PRP) Front (F) and back (B) clipping planes (hither and yon)

©Larry F. Hodges (modified by Amos Johnson) 3 Specifying A View

©Larry F. Hodges (modified by Amos Johnson) 4 Normalizing Transformation 1.Translate VRP to origin 2.Rotate the VRC system such that the VPN (n-axis) becomes the z-axis, the u-axis becomes the x-axis and the v-axis becomes the y-axis 3.Translate so that the CoP given by the PRP is at the origin 4.Shear such that the center line of the view volume becomes the z-axis 5.Scale so that the view volume becomes the canonical view volume: y = z, y = -z, x=z, x = -z, z = z min, z = z max

©Larry F. Hodges (modified by Amos Johnson) 5 1. Translate VRP to origin (100-VRPx) (010-VRPy) (001-VRPz) (000 1)

©Larry F. Hodges (modified by Amos Johnson) 6 2. Rotate VRC We want to take u into (1, 0, 0) v into (0, 1, 0) n into (0, 0, 1) First derive n, u, and v from user input: n = VPN / ||VPN|| u = (Vup x n) / ||Vup x n|| v = n x u

©Larry F. Hodges (modified by Amos Johnson) 7 2. Rotate VRC (cont.) (uxuyuz0)(vxvyvz0)(nxnynz0)(0001)(uxuyuz0)(vxvyvz0)(nxnynz0)(0001)

©Larry F. Hodges (modified by Amos Johnson) 8 3. Translate so that the CoP given by the PRP is at the origin (100-PRP u ) (010-PRP v ) (001-PRP n ) (0001)

©Larry F. Hodges (modified by Amos Johnson) 9 4. Shear such that the center line of the view volume becomes the z-axis Center line of window lies along the vector [CW - PRP], this is the direction of projection, DoP. PRP

©Larry F. Hodges (modified by Amos Johnson) 10 Shear (cont.) ((umax + umin)/2 )(PRPu) CW =((vmax + vmin)/2 )PRP=(PRPv) (0)(PRPn) (1)(1) ((umax + umin)/2 - PRPu) DoP = [CW-PRP] = ((vmax + vmin)/2 - PRPv) (0 - PRPn) (1) The shear matrix must take this direction of projection and shear it to the z-axis, DoP' = [0, 0, DoPz].

©Larry F. Hodges (modified by Amos Johnson) 11 Shear (cont.) (10SHx0 ) We want SH*DoP =DoP' SH =(01SHy0 ) (0010 ) (0001 ) (10SHx0 ) ((umax + umin)/2 - PRPu ) (0) (01SHy0 ) ((vmax + vmin)/2 - PRPv )= (0) (0010 ) (0 - PRPn ) (DoPz) (0001 ) ( 1 ) (1) SHx = -DoPx/DoPz, SHy = -DoPy/DoPz

©Larry F. Hodges (modified by Amos Johnson) 12 5. Scale z=-PRP n z= -PRP n + Bz=-PRP n + F y = -v + v maxmin 2 y = v - v max min 2 Y axis +1 -Z Back Clipping Plane z=-1 Front Clipping Plane y= -z y= z Before Scale After Scale View plane

©Larry F. Hodges (modified by Amos Johnson) 13 5. Scale (cont.) Scale is done in two steps: 1. First scale in x and y xscale = -2PRPn/(umax - umin) yscale = -2PRPn/(vmax - vmin) 2. Scale everything uniformly such that the back clipping plane becomes z = -1 xscale = -1 / (-PRPn + B) yscale = -1 / (-PRPn + B) zscale = -1 / (-PRPn + B)

©Larry F. Hodges (modified by Amos Johnson) 14 5. Scale (cont.) (Sx000 ) (0Sy00 ) (00Sz0 ) (0001 ) Sx = 2PRPn / [(umax - umin) (-PRPn + B)] Sy = 2PRPn / [(vmax - vmin) (-PRPn + B)] Sz = -1 / [(vmax - vmin) (-PRPn + B)]

©Larry F. Hodges (modified by Amos Johnson) 15 Total Composite Transformation Nper = [Sper ][SHper ][T(-PRP) ][R ][T(-VRP)]