IntroductionComputer Graphics CS 470
Popular in Course
Popular in ComputerScienence
This 28 page Class Notes was uploaded by Abe Jones on Saturday September 12, 2015. The Class Notes belongs to CS 470 at West Virginia University taught by Timothy McGraw in Fall. Since its upload, it has received 28 views. For similar materials see /class/202762/cs-470-west-virginia-university in ComputerScienence at West Virginia University.
Reviews for IntroductionComputer Graphics
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/12/15
Computer Graphics CS 470 Computer Science and Electrical Engineering Dept West Virginia University 6th November 2006 39 Outline 0 Texture Mapping Applications 1 q r 39 Outline Texture Mapping Applications 0 The Sky Cube 0 Terrain 0 Water 0 Billboards 0 Particles 39 The kyCube Sky Cube or Sky Box a In a real scene there is incoming light from all directions 0 Outdoors this light may be coming from very far away a To simulate this place a textured box around the camera position Texture the box with an image of the environment a In out door scenes the image is the sky and far away terrain The texture images applied to 5 or 6 sides of a cube w Sky cube textures 5m Novemlyerllm 1 31 Theskycube Sky Cube or Sky BOX 0 Draw sky cube before anything else gt Can eliminate color buffer clearing a The sky won t occlude anything else in the scene gt Disable depth writes ngepthMask GLFALSE gt Disable depth test 9 Always centered at camera position gt Get modelview matrix zero the translation 0 Disable lighting don t send normals o The bottom face of the cube is not needed if there is a ground plane or terrain in the scene 731 Tmmmmrmmg gg mi mr Terrain Terrarrr usrrrg hergh rmaps 6th November 2006 9 31 Terrain using heightrnaps u hurtW411an CS 470 West Virginia University Computer Graphics Imam Terrain challenges a May not have data at regular grid points a Terrain may be huge LOD schemes 0 Lighting can be done as a preprocessing step Texture Mapping Applications Water Water rendering 0 Re ection o Refraction 0 Animation partial differential equations CS 470 West Virginia University 6th November 2006 1531 I ma Refraction Snell s law n1 sin 1 n2 sin 2 Refraction is usually computed on the GPU as a texture lockup operation alum 17 23 Texture Mapping Applications Re ection The Fresnel effect Fraction of light re ected depends on the angle of incidence 1939quot CS 470 West Virginia University Computer Graphics 39 Water Re ection Cube mapping The re ection effect is very common and is now supported in core OpenGL 0 Additional texture targets gt GL7TEXTURE7CUBE7MAP TEXTURE CUBE MAP POSITIVE X TEXTURE CUBE MAP NEGATIVE X and 4 more for each of the other cube faces 0 Texture coordinate generation modes V GLREFLECTIONMAP gt gt gt nglndTexture GLJEXTUREJUBEJAP TexID ngexImageZD GLiTEXTURELCUBELMAPiPOSITIVEiX GLJEXTUREJUBEJAP glEnable glEnableGL TEXTURE Gems R ngexGenlmLis GLiTEXTUREiGENiMODE GLiREFLECTIONiMAP GLiTEXTUREiGENiMODE GLiREFLECTIONiMAP GLiTEXTUREiGENiMODE GLiREFLECTIONiMAP m 8 h w 1 m gtlt 1 c x m o m z 21 31 I Re ection Cube mapping The cube map images can be low resolution version of the sky cube images 0 m swam unweiin Water 6111 November 2006 2331 Texture Mapping Applications Billboards Billboards Always appear to face the camera Viewing volume viewaligned look vector billboard 1 37 camera pos1t10n right vector Can construct billboards be extracting look right and up vectors from the camera view matrix Several variations 0 Viewplane aligned o Viewpoint aligned o Spherical o Cylindrical CS 470 West Virginia University Computer Graphics 6th November 2006 215 31 Texture Mapping Applications Billboards CS 470 W quotrginia Univer 39 39 Computer Graphics Texture Map Particles Particles Many physical phenomena are not wellrepresented by triangle meshes 0 Fire smoke 0 Liquid splashes and sprays 0 Explosions sparks reworks These things do not have wellde ned boundaries and evolve over time 6thNovember 2006 2931 Particles J piling Apia Par tiole Implemented as animated billboards o Physically based motion 0 Billboard size may change 0 Texture animation may be used 0 Usually alpha blended 6th November 2006 31 31 Computer Graphics CS 470 Computer Science and Electrical Engineering Dept West Virginia University September 17 2008 39 Outline 0 Review 9 Matrix operations 9 Matrix stacks 0 Matrix inverse 39 OpenGL Transformations o ngranslatef o gl S c ale f o glRotatef 0 Matrix concatenation combine several simple transformations to get a complex one I o 311 39 Matrix operations Recall o glMatriXlVlode GLiMODELVIEW GLiPROJECTION 0 glLoadMatrixf const GLfloat km Replace current matrix 0 glMultMatrixf const GLfloat km Postmultiply current matrix Matrices ordered by column GLfloat ml6 m0 m4 m8 m12 m1 m5 m9 m13 m2 m6 m10 m14 m3 m7 m11 m15 OpenGL matrix stacks a Stack data structure OpenGL maintains a stack for each of the matrix modes modelview projection 9 Push and Pop operations v t fig n Push matrix onto stack left pop matrix off of stack right a This allows the application programmer to easily restore previous matrices l I Application hierarchical models l A common display callback structure glclearc r r g1MatrixModeGLJIJODELVIEW set Viewing transformation orient and pOSition camera y glRotategt H ngranslatefrgtgt glPushMatr1x save VieWing matrix on stack ngranslatefrrr app1y modeling transformatlons glRotategt H glCallLlstl draw object 1 glPopMatr1x restore VieWing matrix from stack glPushMatr1x save VieWing m trix on stack apply modellng transformatlons draw object 2 1 M trix restore VieWing matrix from stack glutSwapBufferS l The identity matrix and the matrix inverse The identity matrix I performs no transformation 1p p Each of the transformationsA we have discussed has an inverse A 1 which undoes the transformation of A AA lp p V 1 3311 39 Translation The translation Tx7 y7 z is undone by applying another translation in the opposite direction T7x7 7y iz 100361007X 1000 010y 010732 0100 001z 0017z 0010 0001JL0001JL0001J SO Tx7 7 i Tx7y7z 1 I V L 91 Scale The scaling transformation S Bx By z is undone by applying another scaling operation S1Bx1 y1 z 5000 i000 1000 05x00 00070100 00510 ooio oolo 0001L0001j 0001 SO 51BX71 y71 z 8317 3317 3071 I L mM 39 Rotation The rotation transformation R09 is undone by applying another rotation operation R70 Using the fact that sin 70 7 sin0 and cos 70 cos 9 we can compute the inverse matrix for rotation about the z axis cos0 isin0 0 0 cos0 sin0 0 0 1 0 0 0 sin0 cos0 0 0 7 sin0 cos0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 So R70 R0 1 0 Also note that Rt9 1 R0T the matrix inverse equals the matrix transpose for rotation matrices o Rotation matrix is an orthogonal matrix I L M
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'