游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2061|回复: 0

[分享]介绍渲染器的书-Production.Rendering

[复制链接]

18

主题

45

帖子

45

积分

注册会员

Rank: 2

积分
45
发表于 2009-5-9 01:40:00 | 显示全部楼层 |阅读模式
Production.Rendering

Production.Rendering.-.Design.and.Implementation
BY Ian.Stephenson


Introduction
Developing a production 3D rendering system is an intimidating task. The skills
required are both broad and deep, requiring the mastery of practically every
aspect of computer graphics from curves and surfaces through to compositing
and image file formats. However, it doesn’t stop there; the developer needs to be
familiar with many aspects of computer science and engineering typically not
considered to be graphics related: compiler development, processor architecture,
signal processing, virtual machines, and perhaps most importantly of all, the
software engineering skills to bring together such a diverse range of techniques
into a coherent and manageable body of code.
While many books have been written about rendering, they are typically limited
to either the basics of ray tracing or they specialize on a certain aspect of rendering
research.When I began developing a renderer of my own, I rapidly found
that these texts told me very little about real rendering, as it is used in film and
video production. Rather than ray tracing spheres and polygons with Phong
shading I needed to know how to parse RIB files, and execute compiled shaders,
on a range of complex surfaces. I learned about shading engines by examining
the compiled shaders from other rendering systems.
As my own rendering system (Angel) developed I found that my experiences
were not unique, and I was lucky enough to meet others who were delighted to
share their own ideas on dicing strategies, grid sizes, optimization techniques
and other minutiae that enable a renderer to tackle the complex scenes found in
production. Rendering systems rarely seem to be developed by large teams, but
rather by enthusiastic individuals, who are always happy to share and learn from
each other. Many renderers which started out as experimental projects, much
like mine, have grown into commercial products used across the world.
A few years later when I was invited to contribute a chapter to the Handbook
of Computer Animation (Vince, 2002) I realized this was an opportunity to share
my experience of developing Angel, and present a more realistic introduction to
how a production renderer works.While successful, one chapter could only provide
an overview of such a huge subject and there was clearly scope for a more
in-depth treatment.
Having established that there was a need for this book, rather than attempt to
write it myself, I decided to invite the experts I had met to each contribute a
chapter on a subject of their choice. I was very pleased when every one of them
said yes, and with only a little rearrangement and coercion the rendering
pipeline was carved up between us, to produce a comprehensive and in-depth
study of how a production render is designed and implemented.
Chapter 1 is an extended and updated version of my original chapter that
appeared in the Handbook of Computer Animation. The intention is that this provides
a roadmap for the later chapters, introducing the concepts and ideas which
will be expanded upon later. Though the chapters are presented in a logical
sequence they can be read in any order, using the first chapter as a guide.
Chapter 2 is written by Rick LaMont, and deals with the overall structure of
the rendering system, showing how the scene is created and represented within
the renderer, and how the objects in the scene can be passed through to the various
rendering stages. Rick is CTO of Dot C Software, and the lead developer of
the RenderDotC renderer.
Chapter 3 deals more specifically with the geometry types typically found in
a production render, explaining how surfaces can be evaluated and manipulated.
It was written as a team effort by myself, Paul, Scott and Rick.
Having prepared the geometry, it must then be shaded by a procedural shading
engine. In Chapter 4 Mark Elendt explains how this can be implemented. Mark
was the very first employee of Side Effects Software Inc, developers of the Houdini
animation system, where he holds the position of Senior Mathematician. In addition
to his contributions to Houdini itself (for which he has received a Technical
Achievement Award from the Academy of Motion Picture Arts and Sciences) he is
the chief architect of Side Effects’ Mantra rendering system, and designer of its
VEX shading language.
Matthew Bentham is a programmer at ART VPS, where he develops the
shader compiler for their RenderDrive and PURE range of hardware rendering
products. In Chapter 5 Matthew describes how a compiler can be written to convert
a high level language such as RenderMan SL into a format suitable for use by
the shading engine.
While historically most systems capable of handling scenes of the complexity
required by commercial production used scanline techniques for efficiency,
more recently ray tracing and global illumination have been integrated, to create
hybrid renderers. Ray tracing and global illumination are the subjects of
Chapters 6 and 7 respectively. In Chapter 6 Scott Iverson considers the problems
of adding ray tracing support to a render without sacrificing the performance
and flexibility that users expect in a production system. Scott is the founder
of SiTex Graphics where he has developed the AIR rendering system, and supporting
tools.
Jacopo Pantaleoni, developer of Lightflow Rendering Tools, is the author of
Chapter 7, which discusses the problem of global illumination. Jacopo studied
mathematics at the University of Padova, has worked at NVIDIA as an intern in
the OpenGL group, and is currently working as a Lighting Technical Director for
Valiant Productions in London.
Once the surfaces have been shaded they must be assembled into a final
image, as described by Paul Gregory in Chapter 8. Paul was the original architect
of the Aqsis rendering system and, following its release as an open source project,
leads its development team.
Chapter 9, which concludes the book, is a collection of thoughts, information
and useful fragments of code contributed by myself, Rick, Scott, Mark and
Paul. Though not necessarily fitting neatly within the structure of the book as a
whole, we hope you find the contents of this final chapter valuable or at least
interesting.
Constructing a high quality renderer requires such a diverse set of skills that
this book could never have been written by one person. Each of us has learnt
something by reading the others’ chapters, and I would like to thank each of the
authors for their outstanding contributions.
Ian Stephenson
National Centre for Computer Animation
Bournemouth University



Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Chapter 1 A System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Ian Stephenson
1.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Scene Graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.5 Transforms and Coordinate Systems. . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.6 Shading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.7 Ray Tracing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.8 Global Illumination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.9 Hiding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.10 Resampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.11 Exposure, Imaging and Quantization . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.12 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Chapter 2 A Rendering Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Rick LaMont
2.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.2 The Hierarchical Graphics State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.3 Micropolygon Architectures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4 Reyes Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.5 Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.6 Grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.7 Shader Evaluator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.8 Micropolygons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.9 Hiders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.10 Frameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.11 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Chapter 3 Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.2 Parametrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.3 Polygons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
3.4 Subdivision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
3.5 Points and Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
3.6 Blobbies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Chapter 4 Shading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Mark Elendt
4.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
4.2 Architecture of the Virtual Machine . . . . . . . . . . . . . . . . . . . . . . . . . . 110
4.3 SIMD Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
4.4 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
4.5 Shader Specialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
4.6 The Tricky Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Chapter 5 Compiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Matthew Bentham
5.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
5.2 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
5.3 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
5.4 Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
5.5 Simplification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.6 Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.7 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.8 Other Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Chapter 6 Ray Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Scott Iverson
6.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
6.2 Ray Tracing Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
6.3 Acceleration Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
6.4 Ray?Primitive Intersection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
6.5 Shading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
6.6 Optimizations and Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
6.7 Hybrid Renderers versus Pure Ray Tracers . . . . . . . . . . . . . . . . . . . . . 176
Chapter 7 Global Illumination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Jacopo Pantaleoni
7.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
7.2 Light Transport Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
7.3 Monte Carlo Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
7.4 Programmable Shading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
7.5 Gathering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
7.6 Irradiance Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
7.7 Photon Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
7.8 Volume Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
7.9 Additional Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Chapter 8 Image Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Paul Gregory
8.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
8.2 Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
8.3 Filtering Sampled Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
8.4 Finalizing the Image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
8.5 A Sample Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Chapter 9 Rendering Gems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
9.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
9.2 Useful Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
9.3 Orientation and Handedness. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
9.4 Geometric Optics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
9.5 Noise. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
9.6 Fast Power, Log2 and Exp2 Functions . . . . . . . . . . . . . . . . . . . . . . . . . 270
9.7 Colour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
9.8 Bucket Ordering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
9.9 Network Rendering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
9.10 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
9.11 A Closed-form Solution for the Intersection of a Ray and
Bilinear Patch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

下载:here
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-12-20 09:22

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表