Ebook Interactive computer graphics (5th edition) Part 2

377 360 0
Ebook Interactive computer graphics (5th edition) Part 2

Đ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

(BQ) Computer animation and graphics–once rare, complicated, and comparatively expensive–are now prevalent in everyday life from the computer screen to the movie screen. This book is suitable for undergraduate students in computer science and engineering, for students in other disciplines who have good programming skills, and for professionals.

-, -V / \" -' ,\342\200\242 \302\273,< \342\200\242 '-'-,'' - , developing In has a fixed the pipeline, graphics functionality \\ ' -, \342\200\242 - , l we assumed that each when we wanted - : -\34 :\342\200\242'fi> l -\342\200\242 1\342\200\242'\\\\\342\200\242\342\ l Consequently, colors of an ' !- > i v i - ,;i \342\200\242- in the pipeline light-material to the modified the fixed-function box to use interactions to determine the object, we were limited Phong model becauseit was the only lighting model supported by pipeline in the OpenGL specification and, until recently, the only model supported to having model available, lighting by mo st hardware In addition only one hghting calculations were doneonlyfor each vertex The resulting vertex colorswere then inr agmen t processor If w e wanted over the primitive terpolated by thefixed-functionf to use some other lighting or shading model, we had to resort to an off-line renderer Over the past few years, graphics processors have changed dramatically Both the vertex processor and fragment are now user We can processor programmable called vertex shaders and fragment shaders to achieve complexvisual writeprograms i p elin e effects at the same rate as the standardfixed-functionp In this we introduce the concept of programmable shaders First, we chapter, review some of the efforts to develop languages to describe shaders.These efforts in the OpenGLShadingLanguage (GLSL), culminated which is now a standard part of OpenGL We t he n use GLSL t o develop a variety of vertex shaders that compute vertex properties, including their and colors Finally, we develop positions fragment shaders that let us program the calculations on each fragment and ultiperformed Our discussion of fragment shaders will mately determine the color of each pixel alsointroduce many new ways of using texture mapping 9.1 PROGRAMMABLE PIPELINES we developed the Phong and modified 6, Phong hghting models in Chapter we placed great emphasis on their efficiency but much less on how well they modeled model is remarkable in physical light-material interactions The modified Phong that while it has a very loose with it yields images that coupling physical reality, When are adequatefor architectures of OpenGL most developed, and was purposes it was implemented Hence, as graphics natural that this in commodity and especially pipeline was built into the specification hardware model hardware 451 452 Ch a p t e r9Pr ogr Shaders a m m a ble Normalized Object coordinates Vertices \342\200\224\342\200\242? C l ip coord i n a te s JC d evice coor d in a tes lippin g and ^fta^rizer |_ ^F ragm ent ^Pixe| s assemph primitive FIGURE 9.1 j Window coor a in a re s Pipeline architecture The modified model is adequate for simulating smooth surfaces, such Phong as plastic or metal, which have an isotropic BDRF That is, the properties of the material are the same in all directions Often, however, we need a more physically realistic model th at can model materials with BDRFs that asymmetric (anisotropic) and fluids When we skin, fabrics, many real world materials, including with translucent materials, we wan t to incorporate refraction, the bending of light as it passes through materials with different properties We mi ght also want to account for the fact that howlight isbentbyrefraction is a function ofth e wavelength characterize work of the light effects For example, we might situations, we want nonphotorealistic the brush strokes ofa painter or we might want to create cartoonlike effects can be achieved onlybyworking with shading Many ofth ese effects fragments in ways that are not possible-with i p elin e For example, in bump afixed-functionp a topic that we consider in Section for each 9.12, we change the normal mapping, to the of a surface with that fragment give appearance great complexity appears correct aseither the lights or the surface move Many of these algorithms and effects were developed more than 20 years ago but were only available non-realthrough time Tenderers, such as RenderMan Recent advances in graphics architectures have altered this situation dramatically in Figure 9.1 This figure Consider the pipeline architecture illustrated represents the same architecture we have been discussing since Chapter First, we vertices Note that because both the model-view and transforprocess projection in eye mations are applied vertex processing, the representation of vertices during coordinates occurs only within the vertex processer At the end of vertex processeach vertex has had its loca tion transformed ing, by the model-viewand projection has been a and on which options are matrices, usually assigned color, depending such as texture coordinates have been Vertices enabled,other attributes assigned are then assembled into primitives that are clipped.The potentially visible primitives that are not clipped out are rasterized, generating the fragments Ultimately, the final display What has changed is that the fragments are processedto generate r o cessor are now programmable vertex processorand thefragmentp by applicationcalled shaders that are compiled and loaded into the graphics specific programs In other want to simulate processor ' 9.2 Shading 9.2 LANGUAGES SHADING we can develop a programming model for shaders, we need a method to deAn approach that was inspired scribe lighting models and shaders by the RenderMan shading lang uag e is to look at shaders as mathematical expressions in a language that Before involves variables, constants, and operations among these entities Such expressions can also be expressedin the form of tree data structures, and these trees can be traversedby a variety of algorithms to evaluate the expression represented by the tree between th at describe and Hence,there is a dir ect relationship languages expressions these algorithms to evaluate expressions Shade Trees 9.2 the Consider original Phong shading model from 6, without Chapter the distance term: I = kdLdl-n a When +KLaIa- +ksLs(*-y)a evaluates system graphics OpenGLstate, and r is computedby r=2(1\342\200\242n)n -1 of these Both ducting equations exponentiation, resent theseequations type are known nal nodes and all the child n are and known from the inthat involve bot h arithmetic expressions operations, vector operations, such as the dot product We can rep2 a tree data structure as shown in Figure 9.2 Treesof using trees Variables and constants expression appear at the termiare and as internal nodes represent operations.Because tree is a bina ry tree in which all internal resulting this binary, this expression, operators are have exacdy two all our nodes nodes to traversing the correspondEvaluating an arithmetic expression is equivalent that node and out the tree, is, visiting every ing carrying requisite mathematical In at the internal nodes this trees and their associated traversal sense, operations and implementing mathematical algorithms provide a means of both representing expressions,such as that for the Phong shader The more interesting of expression trees is in designing new shaders application in a graphics system and Given a setof variables that might be available operations that are supported by the system, we can form collectionsof trees; each collection of one or more treesdefines a different method for shading a surface This approach is taken in the RenderMan shading language Variables, such as normals * wherethefactor/ max(0,1 \342\200\242 n) and max(0, r \342\200\242v) 1.Thecomputationactuallyuses/ positive and otherwise to guard against the effects of negative dot products We consider the use oftreesin greater depth in Chapter 10 and light is1 if1 \342\200\242 nis Languages 453 454 Chapter Shaders Programmable FIGURE 9.2 vector Expression trees, (a) are assumed For Phong shading, reflection environment and can be From basic data structures, we know that arithmetic expressionsand are equivalent Thus, wecan use standard tree-traversal algorithms for the evaluation of expressions that define shaders Looking at shade trees slightly we see that shade trees can be differently, that can be executedbygraphicsprocessors The replacedbyprograms programming to developing shaders is supported approach by high-level languages that we canuse to program the graphics pipeline on the latest graphics cards source parameters, combined using 9.3 a set of scalar to and be available vector from (b) For the operations trees binary EXTENDING OPENGL into the details of programmable which add a new level of shaders, getting to examine the mechanisms by which OpenGL complexity to OpenGL, we pause has evolved to incorporate advancesin graphics hardware and software Graphics such as OpenGL, developed as a way to p rovide application programmers with APIs, access to hardware features that were being provided by the latest hardware graphics Before 9.3 As and mo re and more hardware features became re memory was provided on graphics became possible and even routine available, processor as mo techniques programmers Theproblem through expect such would processors, only natural that application supported by graphics APIs is how to support such features API developers must confront API while not forcing programmers that an existing speedsincreased, complex graphics It was to be techniques more Extending OpenGL to replaceexisting code One add newfeatures but arebackward approach istoreleasenewversionsoftheAPIthat compatible so that older code is guaranteed to run on newer versions Anot her approach is t o add optional extensions to the API that allow application programs to accessparticular hardware features OpenGL has used both these m echanism s However,in order to access the new features of programmable graphics processors,a new set of programming tools is required 9.3.1 OpenGL Versionsand Extensions API has been very stable Therewere OpenGL 1.5that were released over a 10-year period,each of which was compatible with previous releases OpenGL 2.0, which in 2004, was a major was released but still retains code compatibility with upgrade earlier versions The current release is OpenGL2.1.Thus, written on an any program older version of OpenGLruns as expected on a later version Changes to OpenGL in hardware that became common to many reflect advances graphics processors For example, as hardware for texture mapping increased, newer versions support of OpenGL contained many new functions for using texture maps Features such as texture objects, mipmapping, and three-dimensional textures were added to the early versions of Open GL Whereas versions users and hardware OpenGL represent a consensus of many card or high-end workstation is likely to support feaproviders, a given graphics tures that are not generally available on other hardware Such is especially the case with commodity cards that are used for computer games Nevertheless, programmers who have access to a particular of hardware want to be ableto access piece its features through OpenGL functions, even these features are not general though version ofth eAPI One solution to thisdilemma enough to be supported bythelatest is to have an extension mechanism within OpenGL Individual hardware providers can provide accesst o (or expose) hardware features new Open GL functions through that may only work on a particular manufacturer's hardware OpengGL extensions have names that identify the provider For example, an extension with a name such as glCommandNV identifies it as provided by NVIDIA Other manufacturers could then the same extension Extensions that have been widely used are apimplement Review Board (ARB) and are designated as ARB proved by the OpenGLArchitectural One of the main upgrades from features OpenGL of OpenGL is that the 1.0 through In 2006, the ARB w a s replaced by the Seewww.opengl.org OpenGL Working Group under the Kronos Consortium 455 456 Ch a p te r Shaders Programmable When programmable vertex shaders first became the ARB approved available, for low-level vertex p ro g ms Later extensions low-level fragsupported ment programs However, the original interfaces to programmable hardware were somewhat for programmable hardware was unwieldy The first software support much like assembly language interfaces for general purpose computers Application had to write moderately long that kept track of low-level programmers programs and moving data bedetails, such as register assignments in the graphics processor tween and memory The OpenGL extensions provided a mechanism for registers loading this assembly-like code into a programmable pipeline Although this mechanism allowed users to work with shaders, it had all the faults of an programmable assemblylanguageprogram AsGPUsbecame more sophisticated,itbecameincreasIn a manner similar ingly more difficult to program shaders using assemblylanguage to the development of st an d ard programming languages, higher-level programming interfaces and compilersfor shader code have now replaced assembly language p ro extensions for gramming most users GLSL and 9.3.2 Cg to us are the shading languages of most interest (GLSL) a nd Cg, w hich is an acronym for Cfor Graphics Language but have different targeted users Both are based on the C programming include most ofits programming constructsbut add languagefeatures that make it easier t o program shaders two The high-level The main differences portable acrossmultiple is virtually arise because platforms, Cg is including designed to support OpenGL Shading They are similar and language and data shaders OpenGL and Microsoft's types that are DirectX.Cg (HLSL) and thus High LevelShading Language that it allows them to advantage developers developshadersfor both DirectX and OpenGL at the same time However, the interface between OpenGL and Cg sh ader s is m ore sophisticated than the interface between OpenGLand GLSL is GLSL is part of OpenGL 2.0 and thus is supported by multiple vendors and on multipleplatforms BecauseGLSLispart ofOpe n GL, itis simpler todevelopOpenGL shaders with GLSL than with Cg Hence, wewill focus on GLSL, understanding that the two approaches have far more similarities tha n differences has the 9.4 identical to Microsoft's for Windows THE OPENGLSHADING LANGUAGE is a C-like language that allows the programmer OpenGL Shading Language both vertex and fragment shaders It is incorporated into OpenGL 2.0 In GLSL,there is little distinction in the syntax between a vertex program and a fragment program, although the two are used in different contexts Before we examine the GLSL lan guag e, first we examine the different tasks that these shaders must The to write perform 9.4 The OpenGLShading 9.4.1 Vertex A vertex Shaders or vertex shader, replacesthe fixed-function program, the vertex processor with defined in the operations operations per- shader If a vertex shader is not provided by the application, a programmable vertex processor carries out the standard e rtex processor.A vertex operations of the OpenGLfixed-functionv shader is executed on each vertex as i t passes down the pipeline Every vertex shader must the information that the rasterizer needs to its j ob At a minimum, output must for the rasterizer For each vertex, every vertex shader output a vertex position the input to the vertex can use the vertex position defined program by the application and most of th e information that is in the OpenGL state, including the program current ma teri al properties, and transformation matrices color, te xtu re coordinates, In addition, the application program can p ass other application-specific information on a per-vertex basisto the vertex shader There are a few operations that virtually every vertex program must out carry Recall that most application programs specify vertex positions in object space, and the vertex processor transforms these first by the model-viewmatrix into positions matrix into clip coordinates Because eye coordinates and then by the projection an application-supplied vertex shader replacesthefixed-functionv e r tex operations, one of the jobs that almost all vertex programs must carry out is to transform the vertex from object coordinatesto clip coordinates Because the vertex input position transformation state, it has accessto the standard program can accessthe OpenGL matrices or it can compute its own transformations formed Here /* pass by is a simple, but vertex through complete, shader vertex program: */ void main(void) { gl_Position = gl_ProjectionMatrix*(gl_ModelViewMatrix*gl_Vertex); } in object coordinates shader simply takes each vertex'sposition (gl_Vertex) it first the model-view matrix and then the matrix multiplies by by projection in in the to obtain the position coordinates The four variables (gl_Position) clip shader are all part of the OpenGL state and thus not have to be declaredin the shader Each execution of g lV er t e x in an application triggers the execution of the shader This shader is so simple that it does not even set a color or any other vertex such matters to the fragment Because this shader does attribute, leaving processor but send on the of the it is sometimes calleda pass-through vertex, nothing position This and shader A slightly follows: more complexversi on that also assigns a red colorto each vertex is as Language 457 458 C h a pt e r Shaders Programmable /* simple vertex shader */ vec4 red = vec4(1.0, const 0.0, 0.0, 1.0);/* C++ style constructor */ void main(void) { gl_Position = gl_ModelViewProjectionMatrx*gl_Vertex; = r ed ; gl_FrontColor } This program does two things It transforms the input vertex position (gl_ of the projection and model-view matrices to a new Vertex) by the concatenation in clip coordinates (gl_Position) and colors each vertex red Because position the conversion of a vertex's position from object to clip coordinatesis so common, GLSL of the projection and model-viewmatrices provides the precomputed product Notethatnames variablegl_ModelViewProjectionMatrix refer to variables that are part of the OpenGLstate Suppose that program that uses this vertex shader contains the code throughthebuilt-in that begin the with gl_ application glBegin(GL_P0LYGON); glVertex3fv(v0); glVertex3fv(vl); glVertex3fv(v2); glEndO; in the application have been defined previously er t e x invokes our shader with a new value of of the vertex in gl_Vertex, which is the internal four-dimensional representation h Each execution oft e vertex a color glVertex program outputs (gl_FrontColor) and a new vertex position (gl_Posit ion) that are passed on for primitive assembly in Figure 9.3 In this shader, we could have This process is illustrated a computed color so that each vertex could be assigned a different color We also could have set in the application for each vertex using g lCol or and had the shader pass the color on these colorsto the rasterizer by using the code where the program vertices vO, v l , and v2 of glV execution Each = gl_Color; gl_FrontColor has a main function and can call designation The sameis t r u e for fragment shaders GLSL includes new data types and the associated operations among them Thus, the model-view matrices are oftype mat4 thevertex position , whereas andprojection * is overloadedso that matrix-vector isa vec4 datatype The multiplication operator in the other shader Note that a functions We are assuming because back faces our shader should written that vertex shader in GLSL two-sided lighting has not been enabled If we need two-sided lighting different front and back properties, then are visible and materials might have also compute gl_BackColor 9.4 The OpenGL Shading -Application , program glColor glOrtho glLoadMatrix F r o n t Colo r ~\302\261 n Positio ~ gl_Vertex gl_ ModelViewMatrix gl_ProjectionMartrix 9.3 FIGURE Vertex shader architecture as we are defined multiplications would Hence, expect the code in our simple vertex shader gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; yieldsthefinalpositionthatisavec4datatype than now, we have used the terms column matrix and row matrix rather so as not to confuse the vector geometric type with its representation using row and column matrices GLSL defines a vector data type that is a one-dimensional C-style array GLSL reserves the matrix data type for square matrices that are twoin this chapter dimensional C-style arrays We will use th e GLSLterminology In our example,we usedbuilt-in ion variablesgl_FrontColor andgl_Posit for the output of the vertex program Thefront colorisinterpolated by the rasterizer and the interpolated colors are available to either a fragment program or the fixedfunction for each vertex is used by the rasterizer to fragment processor The position for each fragment it produces Note that the red color has a const assign a position and will be the same for each invocation of the program In general, the qualifier of the vertex program output position and color can change with each invocation Also note the use of a C++-style constructor to initialize the red colorvector Until vector 9.4.2 Fragment Shaders Fragment ever, shaders written programs rather than on fragment fragment Considerour in GLSL have the are executed after same the syntax rasterizer as vertex programs Howand thus operate on each each vertex in which the front color is passed onto primitive If the vertex is not eliminated it goes on assembly stages by clipping, to primitive and then to the which rasterizer, assembly generates fragments that are then processed by the fragment processor using either fixed-function fragment or an application-defined fragment or fragment shader Vertex processing program, such as vertex colors and positions, are interpolated attributes, by the rasterizer In the simplest across a primitive to generate the corresponding attributes fragment trivial and clipping example Language 59 460 Ch a p t e r9Pr ogr a m m a ble Shaders state Vertices Position gl g l FrontColor - (per vertex) 9.4 FIGURE ( gl_Fron t C o l or olat e d ) g l _ Fragm i n t er p architecture processor uses theseattributes fragment program is as follows: /* A minimal modification without shader */ fragment pass-through void olor r Fragment shader the fragment case, e n tC mainO \342\200\242C gl_FragColor\342\200\242gl_Color; } as this As trivial a vertex the vertex appears, program The values function program Rather, program the values there is a major of gl _Color of gl_Color difference are not in the between the values fragment how it and produced program by have interpolating the vertex values of gl_FrontColor over (and gl_BackColor lighting is enabled) from thevertex processor the primitive to produce the values used in the fragment unless all Thus, program the vertex colors are identical, each tim e that the fragment executes, it uses a program different value color produced by the fragment ofg l _ C olor The fragment program is then used to modify the color of a pixel in theframe buffer Thisprocess is shown in the main features of GLSLand then develop some more Figure 9.4 We now present been produced by rasterizer the iftwo-sided sophisticated THE 9.5 The shaders OPENGL SHADING LANGUAGE Shading Language is basedon the C programming language GLSL has data and control structures conventions, However, because naming types, and shaders execute in a very different environment than normal fragment OpenGL similar vertex programs, including significant differences the from OpenGL C application that invokes them, there are some 818 Index Subject Mercatorprojections, Monte Carlo methods, morphing, 472-474 Mosaicbrowser, 264-269 polygon motion-blur 268-269 offset, shading, 312-313 polygonal for messages methods for objects, 519-521 mix ray trac model frames, moving 173,183,504 for matrices, 70 model-view paradigm, modeling-rendering 28-29 models rotating colored cubes, 187-195 and systems Phong 140-142 298-304 lighting, 701-707 polygon, process, 332-333 504-505 and instances, symbols modes 127 feedback, input, 105-107 matrix, 70 149 replacement, Phong 451-452 modifier keys, 7-9 move function, 118 lighting model 123 , 303-304, vectors, 152 multiview B-splines, curves and 766-767 162 626 626-627,648 surfaces, nonuniform scaling, 200-201 normal function, 724-725 normal maps, 495,497 normal matrices, 476 normalization maps, 490-492 matrices, 270 161,164,756-757 427,434-439 420-421 orthographic 237-239 nonuniform 478-479 normal vectors,304-308 203, multitexturing, nonphotorealisticshading, nonsingular matrices, 769 nonuniform foreshortening,255 nonuniform rational B-spline (NURBS) scalar-matrix, 766-767 multirendering, 341-342 displays, noninterlaced move_rel function, 96 moveto 23-24 function, scalars, moire patterns, 377,443 monitors, events, 541-544 implementing, nonconvexpolygons, 219 tree struc ture s, 516 mouseButton function, 720 mouseMotion function, 719 move 530-532 506-507 noise, 590-593 rotating squares, 144 matrix-matrix, 149,389-390 modified 716 cubes, graphs, group, 526-527 arrays multiplication selection, 127-133,710-712 writing, with vertex 565-566 forces, spring geometry, program, moving vertices,470-475 viewer program, 721-723 moving MRI (magnetic resonance imaging), 149-150 copy, cube spinning See hie rarchic al models interactive, with texture program, models hierarchy nodes cube rotating face, 116-117 graphics Seegraphics interpolation 734 46,183 coordinates, color forces, 566-567 Newton's secondlaw, 562-563 Node class, 528-530, 541 program, 130-131,711 picking, and repulsive 722-723 viewer rotating cube with program, 714 636 Mike, independent, 564-565 152 erasable lines, model airplanes, 603 548 709 program, model, synthetic-camera Newtonian particles, 562-564 attractive double buffering 473 function, program, drawing 752-753 ing, 657 372 26 Newell, Beziercurves 415-416 mipmapping, mirrors in function mouse 414 minification, (NTSC) system, 578 languages, Committee browser, Netscape Navigator networks, 546-547 102 overview, midpoint division, 584-586 natural 118-119, 124, functions, 127-128 133 middleware, 104 National TelevisionSystems near distance in back call 674 micropolygons, (mocap) systems, 94,585-586 548 (NCSA), Applications 438 mouse, 10 519-521 objects, name stackbuffers, 127 National Center for Supercomputer fractal, mountains, 172 n-tuples, 665 548 effect, motion-capture 586-587,640-643 subdivided, N 115,395 fonts, monotype meshes, 96 interactive, images, 385 monochromatic 409 Mesa distribution, 689 mesh 738-739 function, projections, projection, 270-271 transformations, 249 normalize fun ction , 465 normalization maps, 490 sphere approximation, 316 co ordin ates, device normalized NTSC 184 168 to planes, normals bit Television (National Systems Committee) system,372 in particle systems, numerical instability 569 numerical differential ordinary equations, 568-569 NURBS (nonuniform curvesan d Nyquist frequency, Nyquist sampling OpenGL API, rational B-spline) surfaces, 626-627,648 441-443 and pixel camera 441,444 approach, 140 structure, 780-781 quad rics, 48-49 49-50 geometric See geometric oblique projections, oblique views 273-276 in , 348 clipping obtaining, 240-241 Occam'srazor, 87 545 octrees,554-555 offsets, tests, 354-355 polygon, 268-269 one-dimensional reconstruction, 445 vi ews, 37,242 one-point perspective opacity in compositing open splines, vertex 626 arrays, 215-220, 280, views 347-348 orthonormal 761 vectors, OurFont 113-114 function, out function 465 parameter, outcodes, clipping, 337 outer 166-167 products, overdetermined 788-789 548-549 overlay window system, 777-779 OpenGL Utility (GLU) library, 49-50, 86 problems, fragments, overlapping 189-190 faces, outward-pointing Ovals of Cassini, views, 66-70,782 VRML, Gram-Schmidt, output devices, 7-10 781-782 431-432 planes, 153-154 overloaded 465 functions, 790-791 Utility Toolkit (GLUT), 71 63 527,549 Open Inventor program, (OSG) program, Open SceneGraph 527-528,544-546 787-788 25 transformations, OpenGL system, manipulation, texture mapping, 410-421,786-787 techniques, 428- 429 RGBA Language) three-dimensional, occlusion culling, odd-even See GLSL (OpenGL Language buffer 257-258 projections, oscillation in spring forces, 566 OSG (Open SceneGraph) program, 527-528, 544-546 258-261 state and matrices, 271-273 orthogonal-projection creating, 66-69 shader extensions, Shading 206 matrices, orthogonal clipping, query functions, 789 Shading 170, 758 spaces, orthographic 785 50-56,783-784 projections, 25 orthographic projections, 237-239 454^56 419-420 specification, 761-762 465-470 picking functions, programmable camera orthogonalization, 320-322 primitives, in equations, window systems,71 317-319,785-786 173,183,185, 504 three-dimensional,25 differential orthogonal vectors, 166-167,760-761 779-780 linking shaders, 217-218 568-569 of transformations, orthogonal frames, texture, order afnne 790-791 graphics functions, 47-48 and state machines, graphics pipeline 467 optical detectors, 102 origins GLSL,791-793 materials, program, 756-758 optic nerves, 19 orientation 58 objects 766-767 scalar, 755-756 ordinary functions, 775-776 curved, graphical, 519-524 429-431, 183-187 frames, lighting, systems, 46,183 coordinate blending, features, enabling interface, 69-70,258-259 clipped, and 149-154 matrix, vector, interaction, objects, 11-12 244-248 789 algorithms, 262,358-360 object-space object 330-331 logic, concave polygon 355-356 rasterization, curves and surfaces, 644-649,790 display lists, 784 GLU object-oriented GLSL,464-465 operations, 392-399 compositing geometry theo r e m , 1,46-47 positioning, 819 Index Subject packed format, 394 painter's algorithm, 367-369 palettes, color, 63 operations afnne 49-50, spaces, 759 bit and pixel, 392-399 Euclidean spaces,760 parallel-projection matrices, 269-270 oblique projections, 273-276 orthogonal-projection, 271-273 820 Index Subject matrices parallel-projection {com.) projection normalization, 270-271 parallel ray tracers, 663 674-676 rendering, parallel sort-last, 677-680 465 613-614 curves and lines, 165 surfaces, 405-406,600-605 parent 506-507,524 particle structure, 574,746-751 561-562 systems, collisions, 571-573,576-577 570-574 constraints, flocking, 577-578 574-575 position updates, 575 746-751 program, solving, 568-570 vertices,474-475 85 influids,5 particles -638 617-618,636 609-611 interpolating, radiosity, 666 surface, 603,617-618 15,665 coordinates, function, 573 46 function lighting, OpenGL program, 703 127-133,710-712 curves, 86 architectures 343 performance, pixel, 392-394 59 objects, geometric 160 OpenGL,41 785 graphics,30-32,48-49 for 161-162,164 addition, pointing devices, 10,102,117-120 join, 603 functions, linear 759 attributes, pinhole cameras, 16-18,258 clipping, 480-483 techniques, Euclidean spaces,760 138 for, 401 buffers game boxes, point light sources, 14,296-297 point-point subtraction, 161-162, points pipeline per-fragment shading, 314 -483 per-vertex lighting, PlayStation pick devices,105 modeling 307 plasma panels, point-vector polygon 20-21 projection, physical images, 10-11 physical input devices, 101-104 561-562 models, physically-based CADprogram, 153-154 overlay, plotting physical-device 259 clipping, tangent, 8-9 mapping, piecewise penumbra, 296 per-fragment 301-303 reflection, selection modes, pen-plotter models, 23-24 penalty photon for, 400-401 testing algorithms writing examples,399-401 planar geometric projections, 237 overview, 167-168 300-301 reflection, modified, 303-304,451-452 picking, 126-127 patches cubic diffuse pick_polygon pass-through shaders, 457 move events, 118 passive Bezier, ambient 56-58 349-352 rasterization, planes model, 298-299,451 300 reflection, lighting Phong phosphors, particles, 562-567 display, particle tomography), (positron-emission PHIGSAPI.93 397-399 392-394 pipeline, raster characters, 256 vertex lighting , 475-478 Phong shading, 313-314,480-483 575-576 initialization, PET specular forces,577 Newtonian lookup tables, 276-281 matrices, 259-261 nodes, particle images, 396-397 perspective views, 37,236-237,241-242, spheres, 306 texture mapping, 405-406 399-403 examples, transformations, perspective 168 planes, 184,257 perspective-projection 400 color gamut, perspective projections,254-255 parametric form 5-7,384 buffers, 49 transformations, 276-280 continuity, parametric bitmaps, 394-395 perspective-normalization persistence, 49 28 pixels, 392 of parameters, persistence perspectivedivision, parameters function, Pixar, Perlin noise, 592 236-237,261 parallel views, pitch, 157,253 34-35 440 functions, 33-34 programmer, surfaces,292 characteristics, performance 451-452 programmable, 293 surfaces, perfectly specular periodic 676-677 sort-middle, diffuse perfecdy periodic B-spIines,626 680-682 sort-first, 60 color, perception, 35 41 representing, 414-416,443 shrink-wrapping, 166 sampling, three-dimensional APIs, 25 three-dimensional gaskets,80-8 type specifications, 52 Polygon class, polygon function moving 532,543 viewer program, 721-722 821 Subject Index with color cube rotating with virtual cube program, trackballs offset 269 mode, traversal, 511 precision, buffers, 361-362 program, 701-707 25, 82-83,169 types, 53-54 faces, principal faces, principle of razor, 87 522 algorithmic polynomials exercises, 595-596 616,644 parametric surfaces,602 of, 630-634 subdivision pop-up menus, display, and notes, 594 function, 575 and cross, trackballs,221-223 program structure, 75 270-271 normalization, oblique, 273-276 257-258 parallel, planar, programmable 215,217 programmable shaders,451 pipelines, maps, 237-239 orthographic, 166-167,465, (PET), bump 10 409 Mercator, 236-237 perspective,254-255 objects, 467 postmultiplication postorder traversal, 551 238-240 axonometric, display systems, 271-273 770-771 by matrices, 20-21 planes, projection orthogonal-projection 30,109-110 program tomography 70 OpenGL,258-261 dot products, matrices, orthogonal, raster, 393 positron-emission 132,710-711 productions, 578-579 25,244-252 input devices, 103 24-26 APIs, displays, projection GPUs, 7,34 position particles, See p a rticl e systems CPUs, stacks, 112 cameras, systems processors 219-220 three-dimensional projections, 254, 760-761 recursion and fractals, 582-590 suggested readings, 594-595 processHits popping matrices, 578-581 models, summary 124 23-24 models, projection normalization, 270-271 noise, 590-593 particle 601-602,604-605 curves, parametric 21-23 interfaces, modeling-rendering paradigm, 28-29 progressive radiosity, 672 559-561 models, language-based 629-630 499-500 readings, suggested progressive procedural methods, 559 curves and surfaces evaluation, interpolating, 605-611 451-452 samplers, 483-485 programmer pipelines, 33-34 polylines, 52 Bernstein, with, sample images, 27-28 Occam's members, 454\342\200\224456 linking systems, 474\342\200\224475 particle pen-plotter 237 print servers, 108 private 661 program programmer 53-54 triangles, 413 texture mapping, three-dimensional, extensions, OpenGL summary and notes, 499 vertex moving, 470-475 three-dimensional,25,168-169 282-283 polyhedron 47-48,783-784 54-55 spheres, recursion, 77-79 shadow, processing,333 text, 56-58 354-358 rasterization, OpenGL pipelines, polygons, 52-54 268-269 472\342\200\224474 465-470 functions, OpenGL 341-343 475-483 lighting, 58-60 in geometry basics, 52-53 for morphing, 58 curved, removal, offsets, 19 clipping, 32-33,343-346 362 attributes, 59 modeling languages, 453-454 215 32-33 assembly, Shading Language) by matrices, attributes, clipping, GLSL.SeeGLSL(OpenGL 6,384 primitives, 50-52 shading, 309-314 back-face fragment, 479-480 pre-order colors, 500-501 exercises, 674 walls, primary polygons area, power premultiplication polygon scan conversions, 354 structure, 134-135,701 polygon polygonal fonts, 56 preimages, pixel,406 718 program, polygon texture cube maps, 485\342\200\224492 23 PostScript, PostScript rotating cube with 733 rotating interpolation 713 program, 492-498 451-452 237 points, 17 and shadows, 281-284 projectors, 20 properties See attributes matrices, 822 Index Subject proportional fonts, members, 522 protocols, network, pseudocolor raster 115,395 protected 546-547 raster images, 397-398 hidden-surface 522 public members, 349-352 casting, ray 190-191 function, in refresh 292,639 refreshed CRT displays, registered functions, 74 in clipping, 336 rejected primitives in synthetic-camera model, relationships intersections, quadrics recursive, 658-660 lines, 165 quantizers, 446 query ReadPixel function, 226 and complex and rotation, n umber 228-230 Polygon, 543 95 736 48, 789 functions, Color, 544 function, 466-467, readShaderSource s , 226-228 back-to-front and front-to-back, 432-433 curves and scalars, 755-756 160 vectors, reciprocity equation, 667 example, R3 spa ce, 172,174,176 reconstruction exercises, 686-687 radiosity, 324,654,666 rectangles, form factors, 669-672 15-16 method, radiosity rand polygons, ray recursive 590-592 particle random-scan movement sphere in fluids, CRTs, 585 658-660 subdivision 630-633 approximation, 314-317 Utah teapot, 636-638 redrawContinue function, 224 refinement, curve, 640 raster operations 388 (raster-ops), raster position, 56-57,116,393 reflection maps, 402,423,427-428, function, 486-487 polygons, 52 radiosity, 324,666-673 ray 465,475 639 casting, ray tra cing RenderMan, Seeray and sampling scene rank, matrices,768\342\200\224769 raster color, 394 reflect 28-29 427,434-439 multirendering, parallel, 674-682 Bezier polynomials, Sierpinski gaskets,44-45 random fractal Sierpinski gaskets,692-695 motion, 585 noise, procedural and 77-79 tracing, 438 extensions, modeling-renderingparadigm, geometry noise, 590-591 numbers Brownian See fractals fractals Sierpinski gaskets,44 random 624-625 B-splines, 436\342\200\224438 processing, image imaging function procedural 682-684 image-based,682-684 v iew ing , 69-70 recursion 666-669 equation, step, 440,444\342\200\224446 rectangular approximation, 446 carrying out, 672-673 604,629-635 surfaces, equations, 290,654,664-665 for R 653-654 rendering, numbers real queues, event, 107 method Render 658-660 function, raytrace 102-103 521 render_cube function, render function, 522-523 14-15 light, 439,446 devices, relative-positioning rays 554-555 quaternions, 26 657 trees, ray quadrilaterals, 54-55,415-416 quantization, 659-662 rates, variations, 663 648-649,790-791 surfaces, 600,638-639 308-309 computations, 488 function, refraction, 293,433,452,487-490 quadratic form, 638 quadtrees, vector format, 388 15,324,654-658 ray tracing, 656-657 201-202 scaling, refract rasters, 5-6 image in tra c ing , surface, 290-293 process, 334-335 RAW OpenGL, 263 removal, primitives, 219-220 stacks, 112 quad ray model, 300-303 lighting Phong polygons, 354-358 pushing matrices, collisions, 571-572 56-57,395-396 text, rasterization, 7,33 590-592 numbers, pseudorandom reflections 50 primitives, raster scan devices,103 tracing 673-674 aliasing, antialiasing, 439\342\200\224446 435-436 sort-first, 680-682 sort-last, 677-680 sort-middle, 676-677 suggestedreadings, summary 685-686 and notes, 684-685 Subject Index 673 farms, rendering noise function, 592 663 ray tracing, shading, 452-453 149 mode, replacement cube rotating replicating pixels,57 about fixed points, representation and surfaces, 597-603 curves spheres, 306-307 and vectors matrices, request modes, and smooth, 224-225 squares, reshape function selection-mode program, 753 virtual program, picking rulers matrices, 215-216 541 method, geometry, 582-583 570 resolution for, 18 768-769 transformations, systems, 6-7, color 60, 62-63, 373-374,398 buffers, right-hand rule, 189 coordinate right-handed system, 167 right-sibling structure, 513-514 transformations, rigid-body robot 507-509 eye, 18-19 nodes, rotate matrices, 215-216 conversion, polygon, 354 process,334-335 with 365-366 z-buffers, polygon rotating rotating color function, 506 523 541-544 nodes, (OSG), 527-528, 741-745 robot figure, 535-537 interpolation, transformations, 535 537-541 viewers, with texture, 733-735 cube with vertex arrays, scenes, antialiasing , 435-436 visualization scientific applications, scissoring technique, 345 with virtual trackballs, 717-721 scenegraphs, 741-745 Sierpinski and 533-534 lights and materials, Node class, 528-530 program, cube cube 532\342\200\224533 nodes, 530-532 546-549 Internet, 544-546 701-707 rotating cube with 712-715 class, open scene graph 746-751 modeling, 292 light, scene graphs, 29, 526-528 721-723 viewer, selection-mode roll, 157,253 root 200 696-700 squares, particle systems, rotating scene gra phs, 535-537 rods, marching 715-717 figure arms, 730-732 algorithm, 707-709 buffering, GLSL, 735-740 moving system, 63,427-128 393 color RGBA right 204 geometry Mandelbrotsets, 727-730 Reyes Tenderer,674 RGB transformation Camera Bezier curves,751-754 double 465 689-690 programs, sample Bresenham's return types, 106-107 sample-mode inputs, human visual systems, 18 retained-mode graphics, 110 reversible 160 objects, geometric scattered 10,71 buffers retinas, 162, multiplication, scanlines, 331,360-361 display, frame and addition scan 148,151 method, Runge-Kutta 162,755 fields, vertex positions, 470-472 221-224 technique, fractal in scalar objects, 200-202 trackballs, rubberbanding 440-444 homogeneous coordinates, row matrices, 766-768 711-712 theory, saturated color values, 62 saturation in HLS system s, 375 scaling 143-144 transformation Beziercurves drawing GLSL program, 739 sampling in 106-107 events, apertures, 444 756-757, 766-767 228-230 quaternions, 119 reshape ReshapeO coordinates,205-206 198-200 objects, 414-417 texture, sampling 225-226 incremental, 566-567 forces, 208-209, 217 rendering, 439-446 scalars, 755-756 in homogeneous 170-172, 175-176,181-182,757,769-771 repulsive sampling 209-211 general, 483-485 samplers, programs with color interpolation, 712-715 with texture, 733-735 with vertex arrays, 715-717 with virtual trackballs, 717-721 rotation about arbitrary axes, 212-215 28-29 interface, function, 522 rotate_cube RenderMan Tenderer,28,673-674 823 picking, 710-712 gaskets, spheres, 724-727 690-695 screen areas, 221 coordinates, 46,71,184,335 71 resolution, searching for resources, seed points, 357 547 824 Subject Index spaces, 755 581 shape grammars, segments 206-207 aliased, 369 shear curve, 602 shininess coefficient, 302 Show method, 529,540 See l in e segments line selection modes, 127-133, 710-712 selection self-emission, 290 separable surfaces, 611 servers, 107-109 function, 249 set_view_reference_point function, set_view_up function, 249 249 542 sets 586-590,727-730 Mandelbrot, 162 mathematical, SetTransform method, m ethod, SetValue 535 535,539 spatial-domain trees, 459-460,479-480 fragment, See programmable programmable shaders shades 289 326-328 views, 241 65 size_menu function, 126 Sketchpad project, sleep function, program, 724-727 recursive subdivision spinCube function, 219 cube with color rotating 478-479 Phong, 313-314,480-483 polygonal, smooth rotating cube with 734 311-313,480 309-314 and Gouraud, 311-313 322-323 models, suggested readings,326 and notes, 325-326 summary shadow masks,9 polygons, 282-283 soft sort-last rendering, sorts spline polygon source pixels in space-filling spaceballs, copy operations, curves, 104 580 623 surfaces, spring 389 forces, square source blending, 429 388 buffers, shadows trackballs spotlights, 297 removal, 360 356-357 rasterization, hidden-surface source bits for buffers, arrays 708 function, spinDisplay spinning cubes, 218-219 source light sources, 296 281-284 677-680 virtual sort-middle rendering, 676-677 shadow rays, 656 projections, rotating cube with program, 720 rendering, 680-682 program, 716 program, 570,573-574 constraints, sort-first texture with vertex cube rotating interpolation 714 program, snowflakes, Koch, 95-96,579 nonphotorealistic, 322-323 shading, 124 law, 488 Snell's approximation, representation, 306-307 99,103 74 shading, 54-55 314-317 smoothness of curves,603 Language) point fan and strip approximation, 424 mapping, size smooth 310-311 GLSL See GLSL (OpenGL Shading and spheres smooth rotations, 224-225 exercises, sphere Sphere class, 531-532 singularities, 357-358 perspective 440-442 292-293 surfaces, specular 769 matrices, singular aliasing, 370 specular reflection, 301-303 592 clouds, 360 removal, frequency, spectrum, slope, line s, 598 shading flat, simulated slidebars, of color, 773 matrices, rendered points, 453-454 shaders shadow Silicon Graphics,Inc (SGI),34,93 simulation applications,3-4 SetVertices function, 531 SetVerticesv method, 543 shade spans in hidden-surface 668 sparse matrices, simple polygons,53 CSG modeling, 550 167,756^758 vector, recursive generation programs, 692-695 silhouette edges, 322,479 similar 762 494 tangent, 43-45,690-692 program, 755-756 scalars, suggested readings, methods, 581 procedural set_view_plane_normal SetColormethod, projections, 760-761 39-40,76-77 77-79 polygons, orthogonalization, 761-762 graphics programming, 582 Gram-Schmidt 584 fractals, self-similarity, 162,759-760 exercises,762-763 166 points, shrink-wrapping 758-759 affine, Euclidean, Sierpinski gaskets 105,126-127 process, transformations, double interactive 149 565-566 function buffering models, square matrices defined, 765 inverse of, 769 program, 708 140 Index Subject drawing stability stack , 569 systems stack-based 127 stacking protocols, 547 state state manipulation, stencil 384,393 stipple patterns, 366 stopMotionfunction, string devices, 105 strips, 663 method, sampling 719-720 synthetic-camera images, synthetic model, 19-21,26,236 texture2D function, 484 10-11 texture3D function, Utah teapot, subwindows, color models, mapping 307 planes, tangent tangent space,494 vectors, 494 tangent 314-317 - 161-162,759 60- 63 568-570 theorem, teapot 636-638 texture making, 417-420 supersampling,436 tensor-product surfaces,611 surfaces terminal clipping, 345 and surfaces nodes, 506 tessellation, 58,169,341-342,356 for pixels, 400-401 testing algorithms tetra See texture mapping sampling, 414 -417 three-dimensional, 422 thermal color maps, 398 three-color theory, three dimensional clipping, 60 objects 346-349 function, 24-26, interfaces, OpenGL, 646-647 600,638-639 733-735 with, 421\342\200\224422 gaskets, 80 -85,693-695 drawing, 124 Bezier See Beziercurves \342\200\224 taxonomies,524 Taylor's sums See addition algebraic, 484 objects,419-420 TCP/IP (TransmissionControl Protocol and Internet Protocol), 547 438 subtraction, point-point, cuberotation generating, tablets, 103 639-640 636-638 imaging, 484 function, cube map, 485-492 630 64,397-399 lookup, 82-83 tetrahedrons, differences, instance, 141 630-634 polynomials, 484 coordinates, 404,417-419 forward surfaces, 634-635 sphere approximation, 417 matrices, function, tables subdivision curvesand surfaces, loop, 642 meshes,640-643 417-419 coordinates, textures shading, 312-313 trees, 513-517,549-550 subtractive texture texture objects, 419-420 414 -417 texture sampling, textureCube polygonal subsets, 410-421 ,786-787 OpenGL, texturelD 189-190,521-522 objects, 420-421 multitexturing, texture 504-505 objects, structures GLSL,461 28,402-404 texture mapping, two-dimensional,404-413 grammars, 578-579 stroke devices, 105 stroke text, 56 ,59,113 Bezier 464-465 operator, symbols 54-55 56-58 graphical, tensor-product,611 \"\"- Sutherland, Ivan, ,99 ,103^ Sutherland-Hodgeman clipping, 341,346 swizzling 345 clipping, display lists, 112-115 suggested readings, 650 and notes, 649-650 summary stiff sets, 569 stochastic text 597-603 representation, 787-788 buffers, 290-293 623 \342\200\242spline, 48-49 machines, 414 filtering, texture mapping, 404 635 rendering,401-403,629- function, 719 startMotion linear 603,617-618 reflections, 112 stacks, texels OpenGL, 645-649 patches, 314-315 82-83 subdividing, 401-403 methods, mapping traversals,511-513 buffers, sphere approximation, interpolation, 604-611 curves, 604 particle fractals, 585-586 See hidden-surface removal hidden 315,317,725 function, tetrahedrons 611-614 Hermite, 143-144 rotating, tetrahedron exercises, 650-652 121-122 exa mple, 603-604 criteria, design squares 82,694 220-226 primitives, 25,168-169 textures, three-point throughput, 422 perspectives, 242 30 TIFF images, 385-387 time-domain aliasing, timerjunc function, 370 147 825 826 Index Subject 146-147 timers, RGBA system,63 126 function, topology, cube; 189 torso transpose of matrices, 514 function, CSG modeling,551 658,663 function, 718-719 traverse function, 224 Traverse method, 541 tree grammars, 578 trackballs 221 -224,717-721 virtual, trackingMouse Transformation class, 535 transformation matrices, language-basedmodels, 578-579 and popping pushing, matrices, 219-220 195-197 coordinates, homogeneous 202-207 instance, 211-212,504-505 768-769 invertible, OpenGL, 48,280,781-782 perspective-normalization, 276-280 rotating, 198-200,205-206 scaling, 200-202,204 scene graphs, shear, translations, translation 198,203-204,215-216 matrices, 203-204 translations, 198,203-204,215-216 translucent objects, 335 translucent surfaces,293 724 315-316 Locators),548 variables, attribute-qualified teapot 636-638 OpenGL,646-647 417-420 making, graphics, input noise, devices, 105 591 values, characteristic,772 functions, 465 vanishing points, 37,242 variables 239 views, valenceofvertices,641 value 105-107 true-color systems, Turnoff class, 534 6-7 curves and surfaces,597-599 GLSL,461-463 631 property, variation-diminishing varying var iables, 462-463 vecarrays, 95,579 462 vector CRTs, twist angle, 254 Internet Protocol (TCP/IP),547 transmitted light, 326,488 two-dimensional applications, 40-46 two-dimensional sine function, twists, Resource drawing, valuator trimming curves, 648 tristimulus v alues, 60-61,294,372-373 turtle Utah texture ray tracing, 656-657 TransmissionControl Protocol and transmission, 394 operation, user interfaces,5,105 triangular polygons,169 trimetric 462-463 variables, 97,400 trigonometric 206-207 uniform user-defined 78-79 sphere approximation, texture 413 mapping, triggers, 535 200-201 uniform splines,625-626 URLs(Uniform 692,694 Sierpinski gasketprogram, sphere approximation, 315 model shading, 322-323 sphere Maxwell, 256 perspective, scaling, 463 spheresprogram, triangles, 53 -54 249 normalization, Resource uniform 491 problems, Locators (URLs), 548 updating particle positions, 575 -554 513-517 with, function, triangle concatenating, 70,207-215,768 Uniform unpacking 509-513,553 traversal, working triads, -9 transformations uncompressfunction, union of sets, 550 shade,453-454 translation, and scaling, 215-216 affine, 554-555 657 scene, 526-527 217-218 rotation, and octrees, quadtrees ray, OpenGL,215-220 order, 506-507 graphs, 296 umbra, underdetermined 550-551 CSG, 511 cube spinning, 218-219 loading, u-v-n systems,249 ultrasound, BSP,551-554 224 function, U 515,517 function, treenode structure,514 trees and tree structures, 549-550 variants, 102 395 typefaces, -554 509-513,553 function, trackball_ptov trackballMove tree, surfaces, 265 2-1/2-dimensional two-part texture mapping, 408 ,37 ,242 two-point perspectives, 765-766 traversal touch-sensitive screens, 103 trace two-dimensional views, 69\342\200\22470 637 function, transpose mapping, 404-413 428 opacity, top-level windows, 124 top_menu two-dimensionaltexture transparency 148 toolkits, vector-point addition, 231,618 445-446 vector-scalar 161\342\200\224162,164 multiplication, 164 vector space,162,755-758 SubjectIndex addition, 162,164,756-757 vector-vector vectors characteristic 772 volumes 170-183 viewing volumes, 69 GLSL, 462 views, 66 ,235-236 176-179 knot, 624 162-163 view, representation, 170-172,175-176, 181-182,757 494 tangent, 249 view-up, arrays, onia n particles, 562-563 187 interactive mesh displays, isometric, 239,247 264-269 66-69 objects, moving, 470-475 312 normals, objects, 37,236-237,241 position scaling, Virtual 470-472 primitives, 51 processing, virtual valence, 641 (VLSI) (VPNs), view-reference points (VRPs), 249 249 OpenGLfunctions, World Wide Web, write_block function, trackballs WritePixel with, 717-721 548 388 function, 24,349-350 function, 95 writing into buffers, 388-392 pixels, 399-401 writing modes, 149,389-390 13 spectrum, acuity, 777-779 world coordinate system, 46,183 world frames, 173,183,504 write_pixel visible-surface 124 wire frame, 646 (VRML),528,548-549 221-224 three-dimensional, 551 testing, visual 71-72 interaction, visibility visible view-orientation matrices, 249 view-plane Language visible color, 60 normals Modeling cube rotation 32 very-large-scale integrated circuits, ,34 games, (VR), Reality algorithms, 84,262,333 18 visual system,human, 100 iconifying, 123 managing, 69-70 virtual reality 11,25 systems, 121 -122,124 events, -242 See projections two-dimensional, OpenGL,41 video matrices, 269-276 suggested readings, 285 an d notes, 284-285 summary 195 window coordinates, 46,71,184,334 236-237,261 projections 355-356 test, winding 276-281 194 104 systems, windows and perspective-projection matrices, vertices 105 examples, winding numbers, 355-356 projections, 237-238 parallel-projection vertex shaders,457-459 widgets Wii oblique, 240-241 perspective, 13 548 browsers, interactive programs, 148 70 modes, parallel, buffer 249 white noise, 590 262-264 OpenGLfunctions, 192-195 web removal, hidden-surface orthographic, 788-789 l ight, wavelengths, functions, 48 orthographic attributes, points), (view-reference VUPs (view-up vectors), 249 W 242-243 cube rotation using, 715-717 working w ith, vertex lists, 190 Reality Modeling (Virtual VRPs camera classical, 237-238 matrix velocity ofNewt vertex 238-240 See cameras and exercises, 285-287 model, 298,303 lighting Language),528,548-549 axonometric, computer, operations, 756-758 Phong normals), 249 models linearly independent, 167,757 mathematical reality), (virtual VRML cameras 304-309 computation, light 555 VPNs (view-plane VR 72-74 viewports, properties, 550 volumetric voxels, 69-70 rectangles, viewing homogeneouscoordinates, 249 viewing functions, 782 dot and cross products, 166-167 160-161 geometricobjects, 69,258 view, systems, viewing-coordinate and frames, systems 33 ,344-345 clipping, scene graphs, 537-541 science view, 163 coordinate circuits, 3,34 11-12 process, image-formation 170 components, computer VLSI (very-large-scale integrated) viewers 494 binormal, view-up vectors (VUPs), 249 view volumes, 258,333 827 X on vertices, 45 game boxes, x values 18-19 Xbox 828 Xerox Subtetylndex Palo Alto Research Center (PARC), 155 XOR operations buffers, 391-392 drawing m ode, 149-151,153 XWindows.94,108,155 XYZ color Z on vertices, 361 algorithm, y values system, 373-374 y-x 45 z buffers hidden-surface YUV color removal, 84, 262-263, 362-365 yaw, 253 system, 373 scan conversion with, 365-366 z values on vertices, 45 zero (0)vectors, 161,756 zipfiles,3 87 Back Plate Shadows from a cube onto ground Computed by two passes over the data with viewpoint shifted between viewer and light source (Courtesy of University of New Mexico.) Back Plate Visualization thermohaiine of flows in the Carribean Sea using colored by water temperature (Courtesy of Computing David Munich, High Center, streamtubes Performance University of New Mexico.) Back Plate Rendering robot figure of hierarchical (Courtesy of University Back Plate Sphere recursive subdivision triangle colorsassigned of New Mexico.) computer by of tetrahedrons; (Courtesy of University of randomly New Mexico.) ...4 52 Ch a p t e r9Pr ogr Shaders a m m a ble Normalized Object coordinates Vertices 3 42 200 22 43 42 200 24 2? C l ip coord i n a te s JC d evice coor d... RenderMan shading language Variables, such as normals * wherethefactor/ max(0,1 3 42 200 24 2 n) and max(0, r 3 42 200 24 2v) 1.Thecomputationactuallyuses/ positive and otherwise to guard against the... fragment pass-through void olor r Fragment shader the fragment case, e n tC mainO 3 42 200 24 2C gl_FragColor3 42 200 24 2gl_Color; } as this As trivial a vertex the vertex appears, program The values

Ngày đăng: 16/05/2017, 10:28

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan