Theor behind Geometrical Transform
What does OpenGL do? So the user specifies a lot of information Ee Center Up Near, far, UP EE Left, right top, bottom, etc. f b CENTER left right top bottom
What does OpenGL do? What does a sstem programmer do with those numbers? Generate screen coordinates correctl and efficientl Inside/outside test Projection Here comes the part which contains math which ou ma not like But all ou need to know is matri operation
Arbitrar View Volume UP f b EE CENTER left right top bottom
Inside-Outside Test Intersection of A plane and A Line ) ( : t d c b a plane EE line of points end : ),, ( ),,, ( ) ( ) ( ) ( )] ( [ )] ( [ )] ( [ ) ( ) ( ) ( : t c b a d c b a t d t c t b t a t t t line
Clipping in Canonical Volumes 45^o - (A,B,C) - min near plane (A,B,C) - far planefilm -
Clipping with 6-bit outcode Perspective Above >- Below < Right >- Left < Behind <- In front >min Parallel Above > Below <- Right > Left <- Behind <- In front >
Projection Again, an intersection of A plane and A Line EE
Canonical Volumes - near plane (A/C,B/C) (A,B,C) (A,B) (A,B,C) 45^o min - - far planefilm -
Problem Both clipping and projection can be done efficientl in a canonical volume But we do not have a canonical volume in general Solution: Normaliation transform A single matri operation to bring objects in an arbitrar volume into a canonical volume Cannot change what the user sees
Case Stud:Normaliation Transform A transformation to facilitate clipping An arbitrar view volume: Epensive for clipping and projection
45 o The canonical view volume: Simple clipping (si-bit outcode) Simple projection (/, /) min
OpenGL Terminolog UP f b EE CENTER left right top bottom
PRP PHIGS Terminolog VUP f b VPN u min u ma v ma VRP v min
SideBar: Homogeneous Coordinates Inconsistent representation for translation Cannot be concatenated Homogeneous coordinates consistent representation for all three can be concatenated & pre-computed (,, ) ( w, w, w) ( w, w, w, w), w ( w/ w, w/ w, w/ w)
SideBar: Euler Angle Rotation ' ' ' cos sin sin cos θ θ θ θ ' ' ' cos sin sin cos θ θ θ θ sin cos cos sin ' ' ' θ θ θ θ
Sidebar: Rotation Matri An orthonormal matri Have orthogonal rows Have orthogonal columns Does not magnif or shrink sie of vector (eigen value is )
SideBar: Rotation From world to ee: Column vectors are the (,,), (,,), (,,) of the world frame in the ee frame From ee to world: Row vectors are the,, of the ee frame in world ee world ee camera world P R P R Row vectors are the,, of the ee frame in the world frame ' ' ' i j i j r r r R r r r R
SideBar: Rotation From world to ee j i r r r i i i r r r P r r r P ) ( (,,) world ee world ee camera world P R P R From ee to world ),, ( ) ( ' ' ' ' ' ' i j i i i r r r P r r r P r r r (,,) (,,) (,,) ' r ' r ' r
Comparison PHIGS PRP (projection reference point) VUP (viewup) VPN (view plane normal) VRP (view reference point) uma, umin, vma,vmin View plane F: front clipping distance B: back clipping distance OpenGL EE UP EE-CENTER (left, bottom, -near) right, left, top, bottom N/A (or back clipping) F B
Normaliation Transform Perspective - OpenGL Eternal parameters Translate EE into origin Rotate the EE coordinate sstem such that w (e-c) becomes u becomes v becomes Internal parameters Shear to have centerline of the view volume aligning with Scale into canonical truncated pramid
Eisting Rendering Pipeline graphics primitives modeling transform viewing transform clipping shading & teture transform Ee, lookat, Parallel or material, matri headup Perspective lights, volume surface color images on screen viewport transform images in Internal buffer projection viewport location
Rendering Pipeline with Normaliation Transform normaliation transform graphics primitives modeling transform viewing transform clipping shading & teture transform matri Ee, lookat, headup Parallel or Perspective volume material, lights, surface color images on screen viewport transform images in Internal buffer projection viewport location
Changes Modeling Viewing Normaliation get concatenated into ONE transform before appling to an primitives Confusion: normaliation does not just push the ee frame back to origin and line up with world frame, it pushes objects awa too Purpose: to make clipping and projection much more efficient
Viewing Normaliation Line up (--) and (U-V-W) Initiall, (U-V-W) are specified in (--) sstem (In fact, everthing is specified in -- sstem) Some point in time, want to specif things in (U-V-W) sstem, or U becomes (,,), V becomes (,,), W becomes (,,) Translation (eas) Rotation (hard)
Translate EE into the origin u v w u v w EE EE EE T
Viewing Normaliation Three rotations Rotate about Rotate about Rotate about
UP E-C rotation rotation rotation
Viewing Normaliation Figuring out [u, v, w] in [,, ] sstem Appling a rotation to transform [,, ] coordinates into [u, v, w] coordinates w e c e c u u p w u p w v w u u v w u u u v v v w w w
Rotate EE coordinate to align w. world sstem v u v w w u
Shear v v ),, ( near bottom top right left ),, ( near w u w u near bottom top b near right left a b a SH,, w
Scale into canonical volume top bottom - near far - 45 o - scale in and scale in top bottom near near S (, right left top bottom S (,, ) far far far,)
Eample EE (,,) CENTER (,,) UP (,,) ( right, left) (,) ( top, (,) ) F B bottom
Translate EE into the origin T Rotate EE to align with the world sstem 3 (,,) c e c e w R 6 6 6 3 3 3 ),, ( 6 ) (,, (,,) 6 ) (,, (,,) (,,) (,,) (,,) 3 u w v w UP w UP u c e
Shear, SH, near bottom top b near right left a
Scale into canonical volume scale in and S scale in S
Normaliation Transform Parallel (othographic) - OpenGL Eternal parameters Translate EE into origin Even though ee is not reall where the viewer is Rotate the EE coordinate sstem such that w (e-c) becomes u becomes v becomes Internal parameters Translate to have centerline of the view volume aligning with, and near plane at Scale into canonical rectangular piped
Viewing Normaliation Line up (--) and (U-V-W) Initiall, (U-V-W) are specified in (--) sstem (In fact, everthing is specified in -- sstem) Some point in time, want to specif things in (U-V-W) sstem, or U becomes (,,), V becomes (,,), W becomes (,,) Translation (eas) Rotation (hard)
Translate EE into the origin u v w u v w EE EE EE T
Viewing Normaliation Three rotations Rotate about Rotate about Rotate about
UP E-C rotation rotation rotation
Viewing Normaliation Figuring out [u, v, w] in [,, ] sstem Appling a rotation to transform [,, ] coordinates into [u, v, w] coordinates w e c e c u u p w u p w v w u u v w u u u v v v w w w
Rotate EE coordinate to align w. world sstem v u v w w u
Translation v v ),, ( near bottom top right left (,,) w u w u near c bottom top b right left a c b a T,,, w
Scale into canonical volume top bottom near Far-near near - - - top bottom scale in,, and S ( right left, top bottom, far ) near
Eample EE (,,) CENTER (,,) UP (,,) ( right, left) (,) ( top, (,) ) F B bottom
Translate EE into the origin T Rotate EE to align with the world sstem 3 (,,) c e c e w R 6 6 6 3 3 3 ),, ( 6 ) (,, (,,) 6 ) (,, (,,) (,,) (,,) (,,) 3 u w v w UP w UP u c e
Translation, SH, near bottom top b near right left a
Scale into canonical volume scale in,, and S 9