1. Trang chủ
  2. » Giáo án - Bài giảng

advanced graphics programming techniques using opengl

322 308 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 322
Dung lượng 8,17 MB

Nội dung

Programming with OpenGL: Advanced Rendering Advanced Graphics Programming Techniques Using OpenGL Organizer: Tom McReynolds Silicon Graphics Copyright c 1998 by Tom McReynolds and David Blythe. All rights reserved April 26, 1998 SIGGRAPH ‘98 Course Abstract This advanced course demonstrates sophisticated and novel computer graphics programming techniques, implemented in C using the widely available OpenGL library. By explaining the concepts and demonstrating the techniques required to generate images of greater realism and utility, the course helps students achieve two goals: they gain a deeper in- sight into OpenGL functionality and computer graphics concepts, while expanding their “tool- box” of useful OpenGL techniques. i Programming with OpenGL: Advanced Rendering Speakers David Blythe David Blythe is a Principal Engineer with the Advanced Graphics Software group at Silicon Graph- ics. David joined SGI in 1991 and has contributedto thedevelopment of RealityEngineand Infinite- Reality graphics. He has worked extensively on implementations of the OpenGL graphics library and OpenGL extension specifications. David is currently working on high-level toolkits which are built on top of OpenGL as well as contributing to the continuing evolution of OpenGL. Prior to joining SGI, David was a visualization scientist at the Ontario Centre for Large Scale Com- putation. David received both a B.S. and M.S. degree in Computer Science from the University of Toronto. Email: blythe@sgi.com Brad Grantham Brad Grantham currently contributes to the design and implementation of Silicon Graphics’ high- levelgraphics toolkits,includingthe FahrenheitScene Graph, a collaborativeproject withMicrosoft and Hewlett-Packard. Brad previously worked on OpenGL Optimizer, Cosmo 3D, and IRIS Per- former. Before joining SGI, Brad wrote UNIX kernel code and imaging codecs. He received a Computer Science B.S. degree from VirginiaTech in 1992, and his previous claim to fame was MacBSD, BSD UNIX for the Macintosh. Email: grantham@sgi.com Tom McReynolds Tom McReynolds is a software engineer in the Core Rendering group at Silicon Graphics. He’s implementedOpenGLextensions,doneOpenGLperformance work,andworkedonIRIS Performer, a real-time visualization library that uses OpenGL. Prior to SGI, he worked at Sun Microsystems, where he developed graphics hardware support soft- ware and graphics libraries, including XGL. Tom is also an adjunct professor at Santa Clara University, where he teaches courses in computer graphics using the OpenGL library. He has also presented at the X Technical Conference, SIG- GRAPH ’96 and ’97, SGI’s 1996 Developer Forum, and at SGI’s 1997 OpenGL Developer’s Work- shop. Email: tomcat@sgi.com ii Programming with OpenGL: Advanced Rendering Scott R. Nelson Scott R. Nelson is a senior staff engineer in the High Performance Graphics group at Sun Microsys- tems. He works in the development of new graphics accelerator architectures and contributed to the development of the GT, ZX, and Elite3D graphics accelerators. Before joiningSun in 1988,Scott spenteightyears at Evans & Sutherland developinggraphics hard- ware. He received a B.S. degree in Computer Science from the University of Utah. Email: Scott.Nelson@eng.sun.com Other Contributers Celeste Fowler (Author) Celeste Fowler is a software engineer in the Advanced Systems Division at Silicon Graphics. She worked on the OpenGL imaging pipelinefor the InfiniteRealitygraphics systemand on the OpenGL display list implementation for InfiniteReality and RealityEngine. Before coming to SGI, Celeste attended Princeton University where she did research on radiosity techniques and TA’d courses in computer graphics and programming systems. Email: celeste@sgi.com Simon Hui (Author) Simon Hui is a softwareengineer at 3Dfx Interactive, Inc. He currently works on OpenGL and other graphics libraries for PC and consumer platforms. Priorto joining3Dfx, SimonworkedonIRIS Performer, a realtime graphicstoolkit,inthe Advanced Systems Division at Silicon Graphics. He has also worked on OpenGL implementations for the Re- alityEngineand InfiniteReality. Simon received a B.A. in Computer Science from the University of California at Berkeley. Email: simon@3dfx.com Paula Womack (Author) Paula Womackisa softwareengineerintheAdvancedSystemsDivisionatSiliconGraphics. Shehas managed the OpenGL group at Silicon Graphics, and was also a member of the OpenGL Architec- tural Review Board (the OpenGL ARB) which is responsible for defining and enhancing OpenGL. Prior to joining Silicon Graphics, Paula worked on OpenGL at Kubota and Digital Equipment. She has a B.S. in Computer Engineering from the University of California at San Diego. Email: womack@sgi.com iii Programming with OpenGL: Advanced Rendering Linda Rae Sande (Production Editor) Linda Rae Sande is a production editor in Technical Publications at Silicon Graphics. A graduate of Northern Arizona University (B.S. in Physics-Astronomy), she has taught college algrebra and physical science courses and worked in marketing communications and technical training. As co- authorof twophysics laboratory textbooksand authorofseveral productionmanuals, Linda Rae has many years of experience in book production and production coordination. Prior to SGI, she was a productioncoordinator at ESL-TRW responsible for the TravInfo and Tran- sCal transportation project documentation and deliverables. Email: lindarae@sgi.com Dany Galgani (Illustrator) Dany Galgani has provided illustrations to Technical Publications at Silicon Graphics for over 9 years. He has illustrated hardware and software manuals, from user’s guides to programmer’s man- uals. Before that, he did commercial art for advertisingagencies and book publishers, including illustrat- ing books in Ortho’s “Do-It-Yourself” series. Dany received his degree in the Arts from the University of Paris as well as a CPA. Email: danyg@sgi.com iv Programming with OpenGL: Advanced Rendering Course Syllabus 8:30 A Introduction (McReynolds) 8:35 B Visual Simulation (McReynolds) 1. Tiling Large Textures 2. Anisotropic Texturing 3. Developing LOD Models for Geometry 4. Billboarding 5. Light Points 9:20 C Adding Realism (Blythe and McReynolds) 9:20 Object Realism (Blythe) 1. Phong Shading 2. Bump Mapping with Textures 3. Complex BDRFs Using Multiple Phong Lights 10:00 Break 10:15 Interobject Realism (McReynolds) 4. Shadows 5. Reflections and Refractions 6. Transparency 11:00 D Image Processing (Grantham) 1. OpenGL Image Processing 2. Image Warping with Textures 3. Accumulation Buffer Convolution 4. Antialiasingwith Accumulation Buffer 5. Texture Synthesis and Procedural Texturing v Programming with OpenGL: Advanced Rendering 12:00 Lunch 1:30 E CAD (Nelson) 1. Constructive Solid Geometry 2. Meshing and Tessellation 3. Numerical Instabilities and Their Cure 4. AntialiasingGeometry 2:15 F Scientific Visualization (Blythe) 1. Volume Rendering 2. Textures as Multidimensional Functions 3. Visualizing Flow Fields (line integral convolution) 3:00 Break 3:15 G Graphics Special Effects (Grantham) 1. Stencil Dissolves 2. Color Space Operations 3. Photographic Techniques (depth of field, motion blur) 4. Compositing 4:00 H Simulating Natural Phenomena (McReynolds) 1. Smoke 2. Fire 3. Clouds 4. Water 5. Fog 5:00 I Summary, Questions and Answers (variable) All vi Programming with OpenGL: Advanced Rendering Contents 1 Introduction 1 1.1 OpenGLVersion 1 1.2 CourseNotesandSlideSetOrganization 1 1.3 Acknowledgments 2 1.4 Acknowledgments for 1997 Course Notes 2 1.5 CourseNotesWebSite 3 2 About OpenGL 4 3 Modeling 5 3.1 ModelingConsiderations 5 3.2 Decomposition and Tessellation 7 3.3 GeneratingModelNormals 8 3.3.1 ConsistentVertexWinding 11 3.3.2 SmoothShading 12 3.4 Triangle-stripping 13 3.4.1 GreedyTri-stripping 15 3.5 CappingClippedSolidswiththeStencilBuffer 15 3.6 ConstructiveSolidGeometrywiththeStencilBuffer 16 4 Geometry and Transformations 25 4.1 StereoViewing 25 4.1.1 FusionDistance 25 4.1.2 ComputingtheTransforms 26 4.2 DepthofField 28 4.3 TheZCoordinateandPerspectiveProjection 28 4.3.1 DepthBuffering 30 4.4 Image Tiling 32 4.5 Moving the Current Raster Position 34 4.6 PreventingClippingofWideLinesandPoints 34 4.7 DistortionCorrection 35 5 Texture Mapping 39 5.1 Review 39 5.1.1 Filtering 39 5.1.2 TextureEnvironment 40 5.2 MipmapGeneration 41 vii Programming with OpenGL: Advanced Rendering 5.3 TextureMapLimits 43 5.4 Anisotropic Texture Filtering . 44 5.5 PagingTextures 47 5.5.1 TextureSubloading 48 5.5.2 PagingImagesinSystemMemory 49 5.6 TransparencyMappingandTrimmingwithAlpha 50 5.7 Billboards 51 5.8 RenderingText 53 5.9 TextureMosaicing 53 5.10TextureCoordinateGeneration 54 5.11ColorCodingandContouring 54 5.12 Annotating Metrics 55 5.13ProjectiveTextures 55 5.13.1 HowtoProjectaTexture 56 5.14EnvironmentMapping 58 5.15ImageWarpingandDewarping 58 5.163DTextures 59 5.16.1 Using3DTextures 59 5.16.2 3DTexturestoRenderSolidMaterials 60 5.16.3 3D Textures as Multidimensional Functions 60 5.17 Line Integral Convolution (LIC) with Texture . . . 61 5.17.1 Sampling 62 5.17.2 Using OpenGL to Create Line Integral Convolution (LIC) Images 63 5.17.3 Line Integral ConvolutionProcedure 64 5.17.4 Details 64 5.17.5 MaximizingContrast 65 5.17.6 GoingFarther 65 5.18DetailTextures 66 5.18.1 SignedIntensityDetailTextures 68 5.18.2 MakingDetailTextures 69 5.19GradualCutawayViews 69 5.19.1 StepstoGeneratingaCutawayShell 70 5.19.2 Refinements 72 5.19.3 RenderingaSurfaceTexturedShell 72 5.19.4 AlphaBufferApproach 72 5.19.5 NoAlphaBufferApproach 73 5.20ProceduralTextureGeneration 74 5.20.1 Filtered Noise Functions 74 viii Programming with OpenGL: Advanced Rendering 5.20.2 GeneratingNoiseFunctions 74 5.20.3 High Resolution Filtering 75 5.20.4 SpectralSynthesis 76 5.20.5 OtherNoiseFunctions 77 5.20.6 Turbulence 77 5.20.7 Example:ImageWarping 78 5.20.8 Generating3DNoise 78 5.20.9 Generating2DNoisetoSimulate3DNoise 79 5.20.10Trade-offsBetween3Dand2DTechniques 79 6 Blending 80 6.1 Compositing 80 6.2 AdvancedBlending 80 6.3 Painting 81 6.4 BlendingwiththeAccumulationBuffer 81 6.5 BlendingTransitions 83 7 Antialiasing 84 7.1 LineandPointAntialiasing 84 7.2 Polygon Antialiasing 85 7.3 Multisampling 86 7.4 AntialiasingWithTextures 86 7.5 AntialiasingwithAccumulationBuffer 87 8 Lighting 90 8.1 Phong Shading 90 8.1.1 Phong Highlights with Texture 90 8.1.2 ImprovedHighlightShape 90 8.1.3 SpotlightEffectsusingProjectiveTextures 91 8.1.4 Phong Shading by Adaptive Tessellation . 93 8.2 LightMaps 93 8.2.1 2DTextureLightMaps 94 8.2.2 3DTextureLightMaps 96 8.3 OtherLightingModels 97 8.4 GlobalIllumination 98 8.5 BumpMappingwithTextures 99 8.5.1 TangentSpace 100 8.5.2 Going for Higher Quality 104 ix Programming with OpenGL: Advanced Rendering 8.5.3 Blending 104 8.5.4 WhyDoesThisWork? 104 8.5.5 Limitations 105 8.6 Choosing Material Properties . 105 8.6.1 ModelingMaterialType 105 8.6.2 ModelingMaterialSmoothness 107 9 Scene Realism 110 9.1 MotionBlur 110 9.2 DepthofField 110 9.3 ReflectionsandRefractions 112 9.3.1 PlanarReflectors 113 9.3.2 SphereMapping 118 9.4 CreatingShadows 126 9.4.1 ProjectionShadows 126 9.4.2 ShadowVolumes 128 9.4.3 ShadowMaps 131 9.4.4 Soft Shadows by Jittering Lights 133 9.4.5 SoftShadowsUsingTextures 133 10 Transparency 135 10.1Screen-DoorTransparency 135 10.2AlphaBlending 135 10.3Sorting 136 10.4UsingtheAlphaFunction 137 10.5 Using Multisampling 137 11 Natural Phenomena 139 11.1Smoke 139 11.2VaporTrails 140 11.3Fire 140 11.4Explosions 141 11.5 Clouds . . 141 11.6Water 142 11.7LightPoints 144 11.8OtherAtmosphericEffects 144 11.9ParticleSystems 146 11.9.1 RepresentingParticles 146 x [...]... by Computer Graphics Forum 2 Programming with OpenGL: Advanced Rendering 1.5 Course Notes Web Site We’ve created a webpage for this course in SGI’s OpenGL web site It contains an HTML version of the course notes and downloadable source code for the demo programs mentioned in the text The web address is: http://www.sgi.com/Technology /OpenGL /advanced sig98.html 3 Programming with OpenGL: Advanced Rendering... vice-versa Think of OpenGL as a graphics assembly language”: the pieces of OpenGL functionality can be combined as building blocks to create innovative techniques and produce new graphics capabilities A second aspect of OpenGL is that the specification is not pixel exact This means that two different OpenGL implementations are very unlikely to render exactly the same image This allows OpenGL to be implemented... details of the OpenGL implementation you are using 4 Programming with OpenGL: Advanced Rendering T-intersection at A A Figure 1 T-intersection 3 Modeling Rendering is only half the story Great computer graphics starts with great images and geometric models This section describes some modeling rules and describes a high-performance method of performing CSG operations 3.1 Modeling Considerations OpenGL is... possible to turn a corner in a triangle strip by using redundant vertices and degenerate triangles as described in [17] 13 Programming with OpenGL: Advanced Rendering 0 1 6 2 5 3 4 Figure 9 Triangle Fan Winding Start of first strip Start of second strip Start of third strip Figure 10 A Mesh Made up of Multiple Triangle Strips 14 Programming with OpenGL: Advanced Rendering 11 9 7 12 5 8 3 1 6 10 4 2 0... Performance 16.3.4 Advanced Geometry-Limited Tuning Techniques xii Programming with OpenGL: Advanced Rendering 16.4 Tuning the Raster Subsystem 16.4.1 Using Backface/Frontface... Introduction Since its first release in 1992, OpenGL has been rapidly adopted as the graphics API of choice for real-time interactive 3D graphics applications The OpenGL state machine is easy to understand, but its simplicity and orthogonality enable a multitude of interesting effects The goal of this course is to demonstrate how to generate more satisfying images using OpenGL There are three general areas... Cylindrical Symmetry Contour Generation Using TexGen 3D Textures as 2D Textures Varying with R Line Integral Convolution Line Integral Convolution with OpenGL Detail Textures Special Case Texture Magnification xv Programming with OpenGL: Advanced Rendering ... Slicing a 3D Texture to Render Volume Slicing a 3D Texture with Spherical Shells Using Stencil to Dissolve Between Images Using Stencil to Render Co-planar Polygons Haloed Line xvi Programming with OpenGL: Advanced Rendering ... is: http://www.sgi.com/Technology /OpenGL /advanced sig98.html 3 Programming with OpenGL: Advanced Rendering 2 About OpenGL Before getting into the intricacies of using OpenGL, we begin with a few comments about the philosophy behind the OpenGL API and some of the caveats that come with it OpenGL is a procedural rather than descriptive interface In order to generate a rendering of a red sphere the programmer... intersected by the clipping plane A capping polygon is embedded in the clipping plane and the stencil buffer is used to trim the polygon to the interior of the solid 15 Programming with OpenGL: Advanced Rendering For more information on the techniques using the stencil buffer, see Section 14 If some care is taken when constructing the object, solids that have a depth complexity greater than 2 (concave or shelled . Programming with OpenGL: Advanced Rendering Advanced Graphics Programming Techniques Using OpenGL Organizer: Tom McReynolds Silicon Graphics Copyright c 1998 by Tom. is: http://www.sgi.com/Technology /OpenGL /advanced sig98.html 3 Programming with OpenGL: Advanced Rendering 2 About OpenGL Before getting into the intricacies of using OpenGL, we begin with a few comments. their “tool- box” of useful OpenGL techniques. i Programming with OpenGL: Advanced Rendering Speakers David Blythe David Blythe is a Principal Engineer with the Advanced Graphics Software group at

Ngày đăng: 28/04/2014, 15:48