1. Trang chủ
  2. » Công Nghệ Thông Tin

Advanced Graphics Programming Techniques Using OpenGL P1

30 467 0
Tài liệu đã được kiểm tra trùng lặp

Đ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

Tiêu đề Advanced Graphics Programming Techniques Using OpenGL
Tác giả Celeste Fowler, Simon Hui
Người hướng dẫn Tom McReynolds
Trường học Santa Clara University
Chuyên ngành Computer Graphics
Thể loại Course Abstract
Năm xuất bản 1998
Thành phố San Jose
Định dạng
Số trang 30
Dung lượng 229,78 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Advanced Graphics Programming Techniques Using OpenGLOrganizer: Tom McReynolds Silicon Graphics Copyright c 1998 by Tom McReynolds and David Blythe... David Blythe David Blythe is a Prin

Trang 1

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

i

Trang 2

David Blythe

David Blythe is a Principal Engineer with the Advanced Graphics Software group at Silicon ics David joined SGI in 1991 and has contributed to the development of RealityEngine and Infinite-Reality graphics He has worked extensively on implementations of the OpenGL graphics libraryand OpenGL extension specifications David is currently working on high-level toolkits which arebuilt on top of OpenGL as well as contributing to the continuing evolution of OpenGL

Graph-Prior to joining SGI, David was a visualization scientist at the Ontario Centre for Large Scale putation David received both a B.S and M.S degree in Computer Science from the University ofToronto

Com-Email: blythe@sgi.com

Brad Grantham

Brad Grantham currently contributes to the design and implementation of Silicon Graphics’ level graphics toolkits, including the Fahrenheit Scene Graph, a collaborative project with Microsoftand Hewlett-Packard Brad previously worked on OpenGL Optimizer, Cosmo 3D, and IRIS Per-former

high-Before joining SGI, Brad wrote UNIX kernel code and imaging codecs He received a ComputerScience B.S degree from Virginia Tech in 1992, and his previous claim to fame was MacBSD, BSDUNIX for the Macintosh

Email: grantham@sgi.com

Tom McReynolds

Tom McReynolds is a software engineer in the Core Rendering group at Silicon Graphics He’simplemented OpenGL extensions, done OpenGL performance work, and worked on IRIS Performer,

a real-time visualization library that uses OpenGL

Prior to SGI, he worked at Sun Microsystems, where he developed graphics hardware support ware and graphics libraries, including XGL

soft-Tom is also an adjunct professor at Santa Clara University, where he teaches courses in computergraphics 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

Trang 3

Scott R Nelson

Scott R Nelson is a senior staff engineer in the High Performance Graphics group at Sun tems He works in the development of new graphics accelerator architectures and contributed to thedevelopment of the GT, ZX, and Elite3D graphics accelerators

Microsys-Before joining Sun in 1988, Scott spent eight years at Evans & Sutherland developing graphics ware He received a B.S degree in Computer Science from the University of Utah

hard-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 Sheworked on the OpenGL imaging pipeline for the InfiniteReality graphics system and on the OpenGLdisplay list implementation for InfiniteReality and RealityEngine

Before coming to SGI, Celeste attended Princeton University where she did research on radiositytechniques and TA’d courses in computer graphics and programming systems

Email: celeste@sgi.com

Simon Hui (Author)

Simon Hui is a software engineer at 3Dfx Interactive, Inc He currently works on OpenGL and othergraphics libraries for PC and consumer platforms

Prior to joining 3Dfx, Simon worked on IRIS Performer, a realtime graphics toolkit, in the AdvancedSystems Division at Silicon Graphics He has also worked on OpenGL implementations for the Re-alityEngine and InfiniteReality Simon received a B.A in Computer Science from the University ofCalifornia at Berkeley

Email: simon@3dfx.com

Paula Womack (Author)

Paula Womack is a software engineer in the Advanced Systems Division at Silicon Graphics She hasmanaged 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 Shehas a B.S in Computer Engineering from the University of California at San Diego

Email: womack@sgi.com

iii

Trang 4

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 andphysical science courses and worked in marketing communications and technical training As co-author of two physics laboratory textbooks and author of several production manuals, Linda Rae hasmany years of experience in book production and production coordination

Prior to SGI, she was a production coordinator at ESL-TRW responsible for the TravInfo and sCal transportation project documentation and deliverables

Tran-Email: lindarae@sgi.com

Dany Galgani (Illustrator)

Dany Galgani has provided illustrations to Technical Publications at Silicon Graphics for over 9years He has illustrated hardware and software manuals, from user’s guides to programmer’s man-uals

Before that, he did commercial art for advertising agencies and book publishers, including ing books in Ortho’s “Do-It-Yourself” series

illustrat-Dany received his degree in the Arts from the University of Paris as well as a CPA

Email: danyg@sgi.com

iv

Trang 5

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 Points9: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 Lights10:00 Break

10:15 Interobject Realism (McReynolds)

4 Shadows

5 Reflections and Refractions

6 Transparency11:00 D Image Processing (Grantham)

1 OpenGL Image Processing

2 Image Warping with Textures

3 Accumulation Buffer Convolution

4 Antialiasing with Accumulation Buffer

5 Texture Synthesis and Procedural Texturing

v

Trang 6

12:00 Lunch

1:30 E CAD (Nelson)

1 Constructive Solid Geometry

2 Meshing and Tessellation

3 Numerical Instabilities and Their Cure

4 Antialiasing Geometry2: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 Compositing4:00 H Simulating Natural Phenomena (McReynolds)

vi

Trang 7

1.1 OpenGL Version 1

1.2 Course Notes and Slide Set Organization 1

1.3 Acknowledgments 2

1.4 Acknowledgments for 1997 Course Notes 2

1.5 Course Notes Web Site 3

2 About OpenGL 4 3 Modeling 5 3.1 Modeling Considerations 5

3.2 Decomposition and Tessellation 7

3.3 Generating Model Normals 8

3.3.1 Consistent Vertex Winding 11

3.3.2 Smooth Shading 12

3.4 Triangle-stripping 13

3.4.1 Greedy Tri-stripping 15

3.5 Capping Clipped Solids with the Stencil Buffer 15

3.6 Constructive Solid Geometry with the Stencil Buffer 16

4 Geometry and Transformations 25 4.1 Stereo Viewing 25

4.1.1 Fusion Distance 25

4.1.2 Computing the Transforms 26

4.2 Depth of Field 28

4.3 The Z Coordinate and Perspective Projection 28

4.3.1 Depth Buffering 30

4.4 Image Tiling 32

4.5 Moving the Current Raster Position 34

4.6 Preventing Clipping of Wide Lines and Points 34

4.7 Distortion Correction 35

5 Texture Mapping 39 5.1 Review 39

5.1.1 Filtering 39

5.1.2 Texture Environment 40

5.2 Mipmap Generation 41

vii

Trang 8

5.3 Texture Map Limits 43

5.4 Anisotropic Texture Filtering 44

5.5 Paging Textures 47

5.5.1 Texture Subloading 48

5.5.2 Paging Images in System Memory 49

5.6 Transparency Mapping and Trimming with Alpha 50

5.7 Billboards 51

5.8 Rendering Text 53

5.9 Texture Mosaicing 53

5.10 Texture Coordinate Generation 54

5.11 Color Coding and Contouring 54

5.12 Annotating Metrics 55

5.13 Projective Textures 55

5.13.1 How to Project a Texture 56

5.14 Environment Mapping 58

5.15 Image Warping and Dewarping 58

5.16 3D Textures 59

5.16.1 Using 3D Textures 59

5.16.2 3D Textures to Render Solid Materials 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 Convolution Procedure 64

5.17.4 Details 64

5.17.5 Maximizing Contrast 65

5.17.6 Going Farther 65

5.18 Detail Textures 66

5.18.1 Signed Intensity Detail Textures 68

5.18.2 Making Detail Textures 69

5.19 Gradual Cutaway Views 69

5.19.1 Steps to Generating a Cutaway Shell 70

5.19.2 Refinements 72

5.19.3 Rendering a Surface Textured Shell 72

5.19.4 Alpha Buffer Approach 72

5.19.5 No Alpha Buffer Approach 73

5.20 Procedural Texture Generation 74

5.20.1 Filtered Noise Functions 74

viii

Trang 9

5.20.2 Generating Noise Functions 74

5.20.3 High Resolution Filtering 75

5.20.4 Spectral Synthesis 76

5.20.5 Other Noise Functions 77

5.20.6 Turbulence 77

5.20.7 Example: Image Warping 78

5.20.8 Generating 3D Noise 78

5.20.9 Generating 2D Noise to Simulate 3D Noise 79

5.20.10 Trade-offs Between 3D and 2D Techniques 79

6 Blending 80 6.1 Compositing 80

6.2 Advanced Blending 80

6.3 Painting 81

6.4 Blending with the Accumulation Buffer 81

6.5 Blending Transitions 83

7 Antialiasing 84 7.1 Line and Point Antialiasing 84

7.2 Polygon Antialiasing 85

7.3 Multisampling 86

7.4 Antialiasing With Textures 86

7.5 Antialiasing with Accumulation Buffer 87

8 Lighting 90 8.1 Phong Shading 90

8.1.1 Phong Highlights with Texture 90

8.1.2 Improved Highlight Shape 90

8.1.3 Spotlight Effects using Projective Textures 91

8.1.4 Phong Shading by Adaptive Tessellation 93

8.2 Light Maps 93

8.2.1 2D Texture Light Maps 94

8.2.2 3D Texture Light Maps 96

8.3 Other Lighting Models 97

8.4 Global Illumination 98

8.5 Bump Mapping with Textures 99

8.5.1 Tangent Space 100

8.5.2 Going for Higher Quality 104

ix

Trang 10

8.5.3 Blending 104

8.5.4 Why Does This Work? 104

8.5.5 Limitations 105

8.6 Choosing Material Properties 105

8.6.1 Modeling Material Type 105

8.6.2 Modeling Material Smoothness 107

9 Scene Realism 110 9.1 Motion Blur 110

9.2 Depth of Field 110

9.3 Reflections and Refractions 112

9.3.1 Planar Reflectors 113

9.3.2 Sphere Mapping 118

9.4 Creating Shadows 126

9.4.1 Projection Shadows 126

9.4.2 Shadow Volumes 128

9.4.3 Shadow Maps 131

9.4.4 Soft Shadows by Jittering Lights 133

9.4.5 Soft Shadows Using Textures 133

10 Transparency 135 10.1 Screen-Door Transparency 135

10.2 Alpha Blending 135

10.3 Sorting 136

10.4 Using the Alpha Function 137

10.5 Using Multisampling 137

11 Natural Phenomena 139 11.1 Smoke 139

11.2 Vapor Trails 140

11.3 Fire 140

11.4 Explosions 141

11.5 Clouds 141

11.6 Water 142

11.7 Light Points 144

11.8 Other Atmospheric Effects 144

11.9 Particle Systems 146

11.9.1 Representing Particles 146

x

Trang 11

11.9.2 Particle Sizes 147

11.9.3 Large and Small Points 148

11.9.4 Antialiasing 148

11.9.5 “Fat” Particles 148

11.9.6 Particle Systems in a Scene 149

11.10 Precipitation 149

12 Image Processing 152 12.1 Introduction 152

12.1.1 The Pixel Transfer Pipeline 152

12.1.2 Geometric Drawing and Texturing 153

12.1.3 The Framebuffer and Per-Fragment Operations 153

12.1.4 The Imaging Subset in OpenGL 1.2 154

12.2 Colors and Color Spaces 155

12.2.1 The Accumulation Buffer: Interpolation and Extrapolation 155

12.2.2 Pixel Scale and Bias Operations 157

12.2.3 Look-Up Tables 157

12.2.4 The Color Matrix Extension 160

12.3 Convolutions 163

12.3.1 Introduction 163

12.3.2 The Convolution Operation 163

12.3.3 Convolutions Using the Accumulation Buffer 165

12.3.4 The Convolution Extension 167

12.3.5 Useful Convolution Filters 168

12.3.6 Correlation and Feature Detection 171

12.4 Image Warping 172

12.4.1 The Pixel Zoom Operation 172

12.4.2 Warps Using Texture Mapping 173

13 Volume Visualization with Texture 174 13.1 Overview of the Technique 174

13.2 3D Texture Volume Rendering 175

13.3 2D Texture Volume Rendering 176

13.4 Blending Operators 177

13.4.1 Over 177

13.4.2 Attenuate 178

13.4.3 Maximum Intensity Projection 178

13.4.4 Under 178

xi

Trang 12

13.5 Sampling Frequency 178

13.6 Shrinking the Volume Image 179

13.7 Virtualizing Texture Memory 180

13.8 Mixing Volumetric and Geometric Objects 180

13.9 Transfer Functions 180

13.10Volume Cutting Planes 181

13.11 Shading the Volume 181

13.12Warped Volumes 182

14 Using the Stencil Buffer 183 14.1 Dissolves with Stencil 185

14.2 Decaling with Stencil 186

14.3 Finding Depth Complexity with the Stencil Buffer 189

14.4 Compositing Images with Depth 190

15 Line Rendering Techniques 192 15.1 Wireframe Models 192

15.2 Hidden Lines 192

15.2.1 glPolygonOffset 194

15.2.2 glDepthRange 195

15.3 Haloed Lines 195

15.4 Silhouette Edges 197

15.5 Preventing Smooth Wide Line Overlap 198

15.6 End Caps On Wide Lines 198

16 Tuning Your OpenGL Application 199 16.1 What Is Pipeline Tuning? 199

16.1.1 Three-Stage Model of the Graphics Pipeline 199

16.1.2 Finding Bottlenecks in Your Application 200

16.2 Optimizing Your Application Code 201

16.2.1 Optimize Cache and Memory Usage 201

16.2.2 Store Data in a Format That is Efficient for Rendering 202

16.2.3 Per-Platform Tuning 203

16.3 Tuning the Geometry Subsystem 204

16.3.1 Use Expensive Modes Efficiently 204

16.3.2 Optimizing Transformations 204

16.3.3 Optimizing Lighting Performance 205

16.3.4 Advanced Geometry-Limited Tuning Techniques 207

xii

Trang 13

16.4 Tuning the Raster Subsystem 207

16.4.1 Using Backface/Frontface Removal 207

16.4.2 Minimizing Per-Pixel Calculations 208

16.4.3 Optimizing Texture Mapping 209

16.4.4 Clearing the Color and Depth Buffers Simultaneously 210

16.5 Rendering Geometry Efficiently 210

16.5.1 Using Peak-Performance Primitives 210

16.5.2 Using Vertex Arrays 211

16.5.3 Using Display Lists 212

16.5.4 Balancing Polygon Size and Pixel Operations 213

16.6 Rendering Images Efficiently 213

16.7 Tuning Animation 213

16.7.1 Factors Contributing to Animation Speed 214

16.7.2 Optimizing Frame Rate Performance 214

16.8 Taking Timing Measurements 215

16.8.1 Benchmarking Basics 215

16.8.2 Achieving Accurate Timing Measurements 216

16.8.3 Achieving Accurate Benchmarking Results 217

17 Portability Considerations 218 17.1 General Concerns 218

17.1.1 Handle Runtime Feature Availability Carefully 218

17.1.2 Extensions and OpenGL Versioning 219

17.1.3 Source Compatibility Across OpenGL SDKs 220

17.1.4 Characterize Platform Performance 220

17.2 Windows versus UNIX 221

17.3 3D Texture Portability 222

18 List of Demo Programs 223 19 GLUT, the OpenGL Utility Toolkit 228 20 Equations 229 20.1 Projection Matrices 229

20.1.1 Perspective Projection 229

20.1.2 Orthographic Projection 229

20.1.3 Perspective z-Coordinate Transformations 229

20.2 Lighting Equations 230

20.2.1 Attenuation Factor 230

xiii

Trang 14

20.2.2 Spotlight Effect 230

20.2.3 Ambient Term 231

20.2.4 Diffuse Term 231

20.2.5 Specular Term 231

20.2.6 Putting It All Together 232

xiv

Trang 15

List of Figures

1 T-intersection 5

2 Quadrilateral Decomposition 7

3 Octahedron with Triangle Subdivision 8

4 Computing a Surface Normal from Edges’ Cross Product 9

5 Computing Quadrilateral Surface Normal from Vertex Cross Product 10

6 Proper Winding for Shared Edge of Adjoining Facets 11

7 Splitting Normals for Hard Edges 12

8 Triangle Strip Winding 13

9 Triangle Fan Winding 13

10 A Mesh Made up of Multiple Triangle Strips 13

11 “Greedy” Triangle Strip Generation 15

12 An Example Of Constructive Solid Geometry 16

13 A CSG Tree in Normal Form 17

14 Thinking of a CSG Tree as a Sum of Products 19

15 Examples of n-convex Solids 20

16 Stereo Viewing Geometry 26

17 Windowzto EyezRelationship for near/far Ratios 29

18 Available WindowzDepth Values near/far Ratios 30

19 Polygon and Outline Slopes 31

20 Clipped Wide Primitives Can Still be Visible 34

21 A Complex Display Configuration 35

22 A Configuration with Off-Center Projector and Viewer 36

23 Distortion Correction Using Texture Mapping 36

24 Texture Tiling 41

25 Footprint in Anisotropically Scaled Texture 44

26 Creating a Set of Anisotropically Filtered Images 44

27 Geometry Orientation and Texture Aspect Ratio 45

28 Non Power-of-2 Aspect Ratio Using Texture Matrix 45

29 2D Image Roam 50

30 Billboard with Cylindrical Symmetry 51

31 Contour Generation Using TexGen 54

32 3D Textures as 2D Textures Varying with R 60

33 Line Integral Convolution 61

34 Line Integral Convolution with OpenGL 63

35 Detail Textures 66

36 Special Case Texture Magnification 67

xv

Ngày đăng: 28/10/2013, 00:15

TỪ KHÓA LIÊN QUAN