**The **__RenderMan Companion__

*A Programmer's Guide to Realistic Computer Graphics*

ADDISON-WESLEY

Boston • San Francisco • New York • Toronto • Montreal

London • Munich • Paris • Madrid

Capetown • Sydney • Tokyo • Singapore • Mexico City

**Table of Contents**

**Preface****........................................................................ iii**

**Foreword****.................................................................... xv**

**CHAPTER ****1**

**The Image-Rendering World****........................................... ****1**

Making Pictures in the Real World............................................ 2

Synthetic Rendering: How Computers Do It............................ 5

Modeling vs. Rendering......................................................... 11

What is RenderMan?............................................................. 12

What RenderMan Offers........................................................ 14

**CHAPTER ****2**

**Getting Started****........................................................... ****17**

A Basic Program.................................................................... 1 7

Controlling the Picture........................................................... 20

A More Complex Object....................................................... 23

Combining Objects............................................................... 29

A Simple Animation.............................................................. 33

Summary.............................................................................. 34

**CHAPTER ****3**

**The Structure of a RenderMan Program****......................... ****37**

RenderMan Procedures......................................................... 37

Data Types........................................................................... 40

Graphics State....................................................................... 44

Program Structure: Blocks..................................................... 47

Coordinate Systems.............................................................. 51

Hider Selection..................................................................... 54

A Boilerplate RenderMan Program......................................... 54

Summary.............................................................................. 56

**CHAPTER ****4**

**Primitive Surfaces I: Quadric Surfaces****........................... ****59**

Quadric Declaration Routines................................................ 62

**CHAPTER ****5**

**Primitive Surfaces II: Polygons****..................................... ****69**

Basic Polygon Types............................................................ 69

**CHAPTER ****6**

**Primitive Surfaces III: Parametric Surfaces****..................... ****85**

Uniform Bilinear and Bicubic Patches.................................... 86

Types of Bicubic Surface..................................................... 90

Bicubic Patch Meshes........................................................... 94

Non-uniform Rational B-Spline Surfaces (NURBs)................. 103

Further Reading.................................................................. 105

**CHAPTER ****7**

**Geometric Transformations and Hierarchical**

**Modeling****......................................................... ****107**

Concepts of Hierarchical Modeling........................................ 107

Geometric Transformation Environment............................... 110

Constructive Solid Geometry............................................... 125

Object Instancing................................................................ 133

**CHAPTER ****8**

**Viewing I: The Digital Camera****...................................... ****137**

An Example Viewing Program.............................................. 1 38

A Virtual Camera................................................................. 141

The Digital Image................................................................ 154

A Better Viewing Program................................................... 167

**CHAPTER ****9**

**Viewing II: A Model of the Rendering Process****................ ****171**

Surface Approximation........................................................ 1 71

Raster Output..................................................................... 172

Depth of Field..................................................................... 185

Motion Blur......................................................................... 186

Further Research.................................................................. 191

**CHAPTER ****10**

**Procedural Models and Level of Detail****........................ ****193**

Level of Detail Calculations and Models............................... 194

Procedural Models.............................................................. 201

Further Reading.................................................................. 208

**CHAPTER ****11**

**Lighting and Shading****........................................................... ****209**

Using Shaders..................................................................... 211

Light Source Shaders.......................................................... 216

Surface Shaders.................................................................. 225

Volume Shaders.................................................................. 233

Other Shaders..................................................................... 237

Further Reading................................................................... 237

**CHAPTER ****12**

**Surface Mapping****.................................................................. ****239**

Simple Surface Mapping...................................................... 241

Using Texture Maps............................................................ 250

Texture Mapping Generalized.............................................. 257

Conclusion......................................................................... 270

Further Reading.............................................................. .... 271

**CHAPTER ****13**

**The RenderMan Shading Language I: Introduction**** ****273**

Shaders from the Outside Looking In................................... 276

Shaders from the Inside Looking Out.................................. 280

An Example Shader............................................................. 282

Further Reading................................................................... 285

**CHAPTER ****14**

**The RenderMan Shading Language II: Description**** ****287**

Defining Shaders and Functions.......................................... 287

Data.................................................................................... 288

Syntax................................................................................ 297

**illuminance****........................................................................ ****302**

**illuminate and solar****........................................................... ****305**

**CHAPTER ****15**

**The RenderMan Shading Language III: Tools****...... ****311**

Mathematical Functions................................................... 311

Shading, Coloring, and Lighting Functions....................... 315

Map Access Functions.................................................... 319

Geometric Functions....................................................... 325

Further Reading.............................................................. 332

**CHAPTER ****16**

**A Gallery of Shaders****......................................................... ****333**

Standard shaders................................................................. 333

Procedural Texturing........................................................... 343

Simple Tricks..................................................................... 360

Texture Mapping................................................................. 371

A Case Study: One Perfect Pencil........................................ 381

Further Examples................................................................ 386

The Future.......................................................................... 387

**APPENDIX A**

**Summary of RenderMan Program Structure****........... ****389**

Order of Transformations................................................ 389

RenderMan Program Structure........................................ 390

**APPENDIX ****В**

**Constructing Basis Matrices for Bicubic Surfaces****............ ****393**

Introduction........................................................................ 393

A Tensed Interpolating Spline.............................................. 395

A Tensed Approximating Spline.......................................... 398

A Biased, Tensed Interpolating Spline................................. 400

A Biased, Tensed Approximating Spline.............................. 402

Further Reading.................................................................. 403

**APPENDIX ****С**

**The ***ri.h *Header File**........................................................ ****405**

**APPENDIX D**

**List of RenderMan Functions****............................................ ****409**

RenderMan Interface Routines......................................... 409

RenderMan Shading Language Routines.......................... 415

**Glossary of Technical Terms****...................................... ****419**

**Bibliography****.................................................................... ****443**

**Index****................................................................................. ****447**