Review of Selected Surface Graphics Topics 1 Jian Huang CS 594 Spring 2002 Visible Light 3 Component Color The de facto representation of color on screen display is RGB Some printers use CMY K Why The color spectrum can not be represented by 3 basis functions But the cone receptors in human eye are of 3 types roughly sensitive to 430nm 560nm and 610nm RGB The de facto standard Raster Displays Display synchronized with CRT sweep Special memory for screen update Pixels are the discrete elements displayed Generally updates are visible Polygon Mesh Set of surface polygons that enclose an object interior polygon mesh De facto triangles triangle mesh Representing Polygon Mesh Vertex coordinates list polygon table and maybe edge table Auxiliary Per vertex normal Neighborhood information arranged with regard to vertices and edges Viewing Pipeline Object Space World Space Eye Space Clipping Space Canonical view volume Screen Space Object space coordinate space where each component is defined World space all components put together into the same 3D scene via affine transformation camera lighting defined in this space Eye space camera at the origin view direction coincides with the z axis Hither and Yon planes perpendicular to the z axis Clipping space do clipping here All point is in homogeneous coordinate i e each point is represented by x y z w 3D image space Canonical view volume a parallelpipied shape defined by 1 1 1 1 0 1 Objects in this space is distorted Screen space x and y coordinates are screen pixel coordinates Spaces Example Object Space and World Space eye Eye Space 3 Spaces Example Clip Space Image Space 1 2 3 4 5 6 Homogeneous Coordinates Matrix Vector format for translation Translation in Homogenous Coordinates There exists an inverse mapping for each function There exists an identity mapping Why these properties are important when these conditions are shown for any class of functions it can be proven that such a class is closed under composition i e any series of translations can be composed to a single translation Rotation in Homogeneous Space The two properties still apply Affine Transformation Property preserving parallel lines The coordinates of three corresponding points uniquely determine any Affine Transform Affine Transformations Translation Rotation Scaling Shearing T Affine Transformation in 3D Translation Rotate Scale Shear Viewing Object space to World space affine transformation World space to Eye space how Eye space to Clipping space involves projection and viewing frustum Pinhole Model Visibility Cone with apex at observer Reduce hole to a point the cone becomes a ray Pin hole focal point eye point or center of projection F P P Perspective Projection and Pin Hole Camera Image W F I World Projection point sees anything on ray through pinhole F Point W projects along the ray through F to appear at I intersection of WF with image plane Simple Perspective Camera camera looks along z axis focal point is the origin image plane is parallel to xy plane at distance d d is call focal length for historical reason Similar Triangles Y Y Z d Z Y d 0 0 Z 0 d Similar situation with x coordinate Similar Triangles point x y z projects to d z x d z y d View Volume Defines visible region of space pyramid edges are clipping planes Frustum truncated pyramid with near and far clipping planes Near Hither plane Don t care about behind the camera Far Yon plane define field of interest allows z to be scaled to a limited fixed point value for z buffering Why do clipping Clipping is a visibility preprocess In real world scenes clipping can remove a substantial percentage of the environment from consideration Clipping offers an important optimization Difficulty It is difficult to do clipping directly in the viewing frustum Canonical View Volume Normalize the viewing frustum to a cube canonical view volume Converts perspective frustum to orthographic frustum perspective transformation Perspective Transform The equations alpha yon yon hither beta yon hither hither yon s size of window on the image plane z alpha 1 yon hither z About Perspective Transform Some properties Perspective Projection Matrix AR aspect ratio correction ResX ResY s ResX Theta half view angle tan theta s d Camera Control and Viewing Focal length d image size shape and clipping planes included in perspective transformation Angle or Field of view FOV AR Aspect Ratio of view port Hither Yon Nearest and farthest vision limits WS eye Lookat coi Lookfrom eye coi hither yon View angle FOV Complete Perspective Specify near and far clipping planes transform z between znear and zfar on to a fixed range Specify field of view fov angle OpenGL s glFrustum and gluPerspective do these More Viewing Parameters Camera Eye or Observer lookfrom location of focal point or camera lookat point to be centered in image Camera orientation about the lookat lookfrom axis vup a vector that is pointing straight up in the image This is like an orientation Point Clipping Ymax Ymin Xmin x y Xmax is inside iff Xmin x Xmax AND Y y Y min max One Plane At a Time Clipping a k a Sutherland Hodgeman Clipping The Sutherland Hodgeman triangle clipping algorithm uses a divide and conquer strategy Clip a triangle against a single plane Each of the clipping planes are applied in succession to every triangle There is minimal storage requirements for this algorithm and it is well suited to pipelining It is often used in hardware implementations Sutherland Hodgman Polygon Clipping Algorithm Subproblem clip a polygon input vertex list against a single clip edges output the vertex list s for the resulting clipped polygon s Clip against all four planes generalizes to 3D 6 planes generalizes to any convex clip polygon polyhedron Used in viewing transforms Polygon Clipping At Work With Pictures 4DPolygonClip Use Sutherland Hodgman algorithm Use arrays for input and output lists There are six planes of course 4D Clipping Point A is inside Point B is outside Clip edge AB x Ax t Bx Ax y Ay t By Ay z Az t Bz Az w Aw t Bw Aw Clip boundary x w 1 i e x w 0 w x Aw Ax t Bw Aw Bx Ax 0 Solve for t Why Homogeneous Clipping Efficiency Uniformity A single clip procedure is typically provided in hardware optimized for canonical view volume The perspective projection canonical view volume can be transformed into a parallel projection view volume so the same clipping procedure can be used But for this clipping must be done in homogenous coordinates and not in 3D Some transformations
View Full Document
Unlocking...