graphics gems iii

444 1.3K 0
graphics gems iii

Đ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

i GRAPHIC GEMS II Edited by DAVID KIRK ii GRAPHIC GEMS II Edited by DAVID KIRK This is a volume in The Graphics Gems SeriesThe Graphics Gems Series The Graphics Gems SeriesThe Graphics Gems Series The Graphics Gems Series A Collection of Practical Techniques for the Computer Graphics Programmer Series Editor Andrew S. Glassner Xerox Palo Alto Research Center Palo Alto, Califomia iii GRAPHIC GEMS II Edited by DAVID KIRK GG GG G RAPHICSRAPHICS RAPHICSRAPHICS RAPHICS GG GG G EMSEMS EMSEMS EMS III III III III III edited by DAVID KIRK California Institute of TechnologyCalifornia Institute of Technology California Institute of TechnologyCalifornia Institute of Technology California Institute of Technology Computer Graphics LaboratoryComputer Graphics Laboratory Computer Graphics LaboratoryComputer Graphics Laboratory Computer Graphics Laboratory Pasadena, CaliforniaPasadena, California Pasadena, CaliforniaPasadena, California Pasadena, California AP PROFESSIONAL Boston San Diego NewYork  London Sydney Tokyo Toronto Copyright (c) 1995 by Academic Press, Inc. GRAPHICS GEMS copyright (c) 1990 by Academic Press, Inc. GRAPHICS GEMS II copyright (c) 1991 by Academic Press, Inc. GRAPHICS GEMS III copyright (c) 1992 by Academic Press, Inc. QUICK REFERENCE TO COMPUTER GRAPHICS TERMS copyright (c) 1993 by Academic Press, Inc. RADIOSITY AND REALISTIC IMAGE SYNTHESIS copyright (c) 1993 by Academic Press Inc. VIRTUAL REALITY APPLICATIONS AND EXPLORATIONS copyright (c) 1993 by Academic Press Inc. All rights reserved. No part of this product may be reproduced or transmitted in any form or by any means, electronic or mechanical, including input into or storage in any information system, other than for uses specified in the License Agreement, without permission in writing from the publisher. Except where credited to another source, the C and C++ Code may be used freely to modify or create programs that are for personal use or commercial distribution. Produced in the United States of America ISBN 0-12-059756-X v GRAPHIC GEMS II Edited by DAVID KIRK About the CoverAbout the Cover About the CoverAbout the Cover About the Cover Cover image copyright 1992 The VALIS Group, RenderMan  image created by The VALIS Group, reprinted from Graphics Gems III, edited by David Kirk, copyright 1992 Academic Press, Inc. All rights reserved. This cover image evolved out of a team effort between The VALIS Group, Andrew Glassner, Academic Press, and the generous cooperation and sponsorship of the folks at Pixar. Special thanks go to Tony Apodaca at Pixar for post-processing the gems in this picture using advanced Render- Man  techniques. The entire cover image was created using RenderMan  from Pixar. We saw the Graphics Gems III cover as both an aesthetic challenge and an opportunity to demonstrate the kind of images that can be rendered with VALIS’ products and Pixar’s RenderMan  . Given the time constraints, all of the geometry had to be kept as simple as possible so as not to require any complex and lengthy modeling efforts. Since RenderMan  works best when the geometric entities used in a 3-D scene are described by high order surfaces, most of the objects consisted of surfaces made up of quadric primitives and bicubic patches. Andrew’s gem data and the Archimedean solids from the VALIS Prime RIB TM library are-the only polygonal objects in the picture. Once all of the objects were defined, we used Pixar’s Showplace TM , a 3-D scene arranging application on the Mac, to position the objects and compose the scene. Showplace also allowed us to position the camera and the standard light sources as well as attach shaders to the objects In RenderMan, shaders literally endow everything in the image with their own characteristic appearances, from the lights and the objects to the atmosphere. The shaders themselves are procedural descriptions of a material or other phenomenon written in the RenderMan  Shading Language. We did not use any scanned textures or 2-D paint retouching software to produce this picture. Where appropriate, we used existing shaders on the surfaces of objects in this picture, taken from our commercially available VG Shaders TM + VG Looks TM libraries. For example,we used Hewn Stone Masonry (Volume 3) to create the temple wall and well; Stone Aggregate (Volume 3) for the jungle-floor, and polished metal (Volume 2) for the gold dish. In addition to these and other existing shaders, several new shaders were created for this image. The custom shaders include those for the banana leaves, the steamy jungle atmosphere, the well vapor, and the forest canopy dappled lighting effect. Shaders also allowed us to do more with the surfaces than merely effect the way they are colored. In RenderMan  , shaders can transform simple surfaces into more complex forms by moving the surface geometry to add dimension and realistic detail. Using shaders we turned a cylinder into a stone well, spheres into boulders and rocks, and a flat horizontal plane into a jungle floor made up of stones and pebbles. Similarly, we altered the surface opacity to create holes in surfaces. In this instance, we produced the ragged edges of the banana leaves and the well vapor by applying our custom RenderMan  , shaders to flat pieces of geometry before rendering with PhotoRealistic RenderMan  . Initially, this image was composed at a screen resolution of 450 × 600 pixels on a MacIIfx using Showplace. Rendering was done transparently over the network on a Unix  workstation using Pixar’s NetRenderMan TM . This configuration afforded us the convenience and flexibility of using a Mac for design and a workstation for quick rendering and preview during the picture-making process. Once the design was complete, the final version of the image was rendered at 2250 × 3000 pixel resolution. The final rendering of this image was done on a 486 PC/DOS machine with Truevision’s RenderPak TM and Horizon860 TM card containing 32 MBytes of RAM. During the rendering process, RenderMan separates shadows into a temporary file called a shadow map. The 2k × 2k shadow map for this image was rendered in less than an hour. However, using shaders to alter the surface geometry increases rendering time and memory requirements dramatically. As a result, we had to divide the image into 64 separate pieces and render each one individually. The total rendering time for all 64 pieces was 41.7 hours. Once these were computed, vi GRAPHIC GEMS II Edited by DAVID KIRK the TIFF tools from Pixar’s RenderMan Toolkit TM were used to join the pieces together into a single, 33 MByte image file. When the image was ready for output to film, we transferred the image file to a removable cartridge and sent it to a local output service. They output the electronic file onto 4 × 5 Ecktachrome color film and had it developed. The transparency was then sent to Academic Press in Cambridge, Massachusetts where they added the title and other elements to the final (over and had everything scanned and turned into four-color separations which were then supplied to their printer. We hope you like this image. Producing it was fun and educational. As you might guess, many “graphic gems” were employed in the software used to produce this picture. Mitch Prater, Senior Partner Dr. Bill Kolomyjec, Senior Partner RoseAnn Alspektor, Senior Partner The VALIS Group Pt. Richmond, CA March, 1992 ABOUT THE COVER vii CONTENTS CONTENTS CONTENTS CONTENTS CONTENTS CONTENTS The Symbol C denotes gems that have accompanying C implentations in the Appendix. Foreword By Andrew Glassner xvii Preface xix Mathematical Notation xxi Pseudo-Code xxiii Contributors xxviii II II I II II I MAGE PROCESSINGMAGE PROCESSING MAGE PROCESSINGMAGE PROCESSING MAGE PROCESSING Introduction 3 1. Fast Bitmap Stretching C 4 Tomas Möller 2. General Filtered Image Rescaling C 8 Dale Schumacher 3. Optimization of Bitmap Scaling Operations 17 Dale Schumacher 4. A Simple Color Reduction Filter C 20 Dennis Bragg viii CONTENTS 5. Compact Isocontours from Sampled Data 23 Douglas Moore and Joseph Warren 6. Generating Isovalue Contours from a Pixmap C 29 Tim Feldman 7. Compositing Black-and-White Bitmaps 34 David Salesin and Ronen Barzel 8. 2 1 2 -D Depth-of-Field Simulation for Computer 36 Animation Cary Scofield 9. A Fast Boundary Generator for Composited 39 Regions C Eric Furman II II II II II NN NN N UMERICAL AND PROGRAMMINGUMERICAL AND PROGRAMMING UMERICAL AND PROGRAMMINGUMERICAL AND PROGRAMMING UMERICAL AND PROGRAMMING TT TT T ECHNIQUESECHNIQUES ECHNIQUESECHNIQUES ECHNIQUES Introduction 47 1. IEEE Fast Square Root C 48 Steve Hill 2. A Simple Fast Memory Allocator C 49 Steve Hill 3. The Rolling Ball C 51 Andrew J. Hanson 4. Interval Arithmetic C 61 Jon Rokne 5. Fast Generation of Cyclic Sequences C 67 Alan W. Paeth 6. A Generic Pixel Selection Mechanism 77 Alan W. Paeth ix CONTENTS 7. Nonuniform Random Points Sets via Warping 80 Peter Shirley 8. Cross Product in Four Dimensions and Beyond 84 Ronald N. Goldman 9. Face-Connected Line Segment Generation in an n-Dimensional Space C 89 Didier Badouel and Charles A. Wüthrich IIIIII IIIIII III MM MM M ODELING AND TRANSFORMATIONSODELING AND TRANSFORMATIONS ODELING AND TRANSFORMATIONSODELING AND TRANSFORMATIONS ODELING AND TRANSFORMATIONS Introduction 95 1. Quaternion Interpolation with Extra Spins C 96 Jack Morrison 2. Decomposing Projective Transformations 98 Ronald N. Goldman 3. Decomposing Linear and Affine Transformations 108 Ronald N. Goldman 4. Fast Random Rotation Matrices C 117 James Arvo 5. Issues and Techniques for Keyframing Transformations 121 Paul Dana 6. Uniform Random Rotations C 124 Ken Shoemake 7. Interpolation Using Bézier Curves C 133 Gershon Elber 8. Physically Based Superquadrics C 137 A. H. Barr x CONTENTS II II I VV VV V 2-D 2-D 2-D 2-D 2-D GEOMETRY AND ALGORITHMSGEOMETRY AND ALGORITHMS GEOMETRY AND ALGORITHMSGEOMETRY AND ALGORITHMS GEOMETRY AND ALGORITHMS Introduction 163 1. A Parametric Elliptical Arc Algorithm C 164 Jerry Van Aken and Ray Simar 2. Simple Connection Algorithm for 2-D Drawing C 173 Claudio Rosati 3. A Fast Circle Clipping Algorithm C 182 Raman V. Srinivasan 4. Exact Computation of 2-D Intersections C 188 Clifford A. Shaffer and Charles D. Feustel 5. Joining Two Lines with a Circular Arc Fillet C 193 Robert D. Miller 6. Faster Line Segment Intersection C 199 Franklin Antonio 7. Solving the Problem of Apollonius and Other 203 Related Problems Constantina Sevici VV VV V 3-D 3-D 3-D 3-D 3-D GEOMETRY AND ALGORITHMSGEOMETRY AND ALGORITHMS GEOMETRY AND ALGORITHMSGEOMETRY AND ALGORITHMS GEOMETRY AND ALGORITHMS Introduction 213 1. Triangles Revisited 215 Fernando J. López-López 2. Partitioning a 3-D Convex Polygon with an 219 Arbitrary Plane C Norman Chin 3. Signed Distance from Point to Plane C 223 Príamos Georgiades [...]... directory ‘pub/GraphicsGems’ on ‘weedeater ’, or the directory ‘pub /Graphics/ GraphicsGems’ on ’ princeton’ Code for Graphics Gems I, II, and III is kept in directories named Gems , ‘Gemsll’, and ‘Gemslll’, respectively Download and read the file called ‘README’ to learn about where the code is kept, and how to report bugs In addition to the anonymous ftp site, the source listings of the gems are available... “Pseudo-Code,” and the listings, xix PREFACE Graphics Gems C Header File,” and “2-D and 3-D Vector Library,” the last of which was revised in volume two of Graphics Gems At the end of most Gems, there are references to similar Gems whether in this volume or the previous ones, identified by volume and page number This should be helpful in providing background for the Gems, although most of them stand quite... Motion Blur on Graphics Workstations C John Snyder, Ronen Barzel and Steve Gabriel 374 10 The Shader Cache: A Rendering Pipeline Accelerator James Arvo and Cary Scofeld 383 References 611 Index 625 xiii PSEUDO-CODE PSEUDO-CODE FOREWARD F OREWORD by Andrew Glassner Welcome to Graphics Gems III, an entirely new collection of tips, techniques, and algorithms for the practicing computer graphics programmer... demand,a need for an entirely new second volume, and Graphics Gems II was born The same cycle has now repeated itself again, and we have happily arrived at the creation of a third collection of useful graphics tools Since the first volume of Graphics Gems was published, I have spoken to many readers and discovered that these books have helped people learn graphics by starting with working codes and just... + (α*h) = l + (α(h – l)) GRAPHICS GEMS III Edited by DAVID KIRK xxvi PSEUDO-CODE clamp(v, l, h) return l if v < l, else h if v > h, else v: min(h,max(l,v)) floor(x) or  x  ceiling(x) or  x  round(x) round x towards 0 to first integer frac(x) round x away from 0 to first integer round x to nearest integer, if frac(x) = 5, round towards 0 fractional part of x GRAPHICS GEMS III Edited by DAVID KIRK xxvii... [array [0 2] of array [0 2] of real;]; example: m:Matrix3 ← [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]; m[2][1] is 8.0 m[0][2]← 3.3; assigns 3.3 to upper-right corner of matrix GRAPHICS GEMS III Edited by DAVID KIRK xxiii PSEUDO-CODE matrix4 equivalent to: matrix4: record [array [0 3] of array [0 3] of real;]; example: m: Matrix4 ← [ [1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0,... that so many people have contributed to Gems shows that we are not afraid to demonstrate our preferences for what is interesting and what is not, what is good and what is bad, and what is appropriate to share with colleagues I believe that the Graphics Gems series demonstrates some of the best qualities in the traditional models of the researcher and engineer Gems are written by programmers who work... Urbana, Illinois 61801, ksung@cs.uiuc.edu Filippo Tampieri (225, 231, 329), Program of Computer Graphics, Cornell University, 580 ETCBuilding, Ithaca, New York 14853, fxt @graphics. cornell.edu Ben Trumbore (295), Program of Computer Graphics, Cornell University, 580 Theory Center Building, Ithaca, New York 14853, wbt @graphics. cornell.edu Jerry R Van Aken (164), Texas Instruments, Mail Stop 712, 12203 Southwest... integer not smaller than x) modulo arithmetic; remainder of a ÷ b same as above  n i n−i Bernstein polynomial =   t (1 − t ) , i = 0Ln  i  n    i binomial coefficient n! ( n− i ) !i! GRAPHICS GEMS III Edited by DAVID KIRK xxii PSEUDO-CODE P SEUDO-CODE Declarations (not required) name: TYPE ← initialValue; examples: π :real ← 3.14159; v: array [0 3] of integer ← [0, 1, 2, 3]; Primitive Data... creative expression I hope that the algorithms in this book will help each of us move closer to that goal xviii PREFACE PREFACE This volume attempts to continue along the path blazed by the first two volumes of this series, capturing the spirit of the creative graphics programmer Each of the Gems represents a carefully crafted technique or idea that has proven useful for the respective author These . ‘pub /Graphics- Gems on ‘weedeater’, or the directory ‘pub /Graphics/ GraphicsGems’ on ’ princeton’. Code for Graphics Gems I, II, and III is kept in directories named Gems , ‘Gemsll’, and ‘Gemslll’,. i GRAPHIC GEMS II Edited by DAVID KIRK ii GRAPHIC GEMS II Edited by DAVID KIRK This is a volume in The Graphics Gems SeriesThe Graphics Gems Series The Graphics Gems SeriesThe Graphics Gems Series The. Segment Generation in an n-Dimensional Space C 89 Didier Badouel and Charles A. Wüthrich IIIIII IIIIII III MM MM M ODELING AND TRANSFORMATIONSODELING AND TRANSFORMATIONS ODELING AND TRANSFORMATIONSODELING

Ngày đăng: 04/06/2014, 11:45

Từ khóa liên quan

Mục lục

  • Graphics Gems III

    • Cover

    • Copyright

    • About the Cover

    • Contents

    • Foreward

    • Preface

    • Mathmatical Notations

    • Pseudo-Code

    • Contributors

    • I Image Processing

      • Introduction

      • 1-Fast Bitmap Stretching

      • 2-General Filtered Image Rescaling

      • 3-Optimization of Bitmap Scaling Operations

      • 4-A Simple Color Reduction Filter

      • 5-Compact Isocontours from Sampled Data

      • 6-Generating Isovalue Contours from a Pixmap

      • 7-Compositing Black-and White Bitmaps

      • 8-2.5D Depth-Of-Field Simulation for Computer Animation

      • 9-Fast Boundary Generator for Composited Regions

      • II Numerical and Programming Techniques

        • Introduction

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

  • Đang cập nhật ...

Tài liệu liên quan