rman booklet
TRANSCRIPT
-
8/9/2019 Rman Booklet
1/120
An Introduction to
3D Computer Graphics
Version 6.0 PDF 1995
Exploring Photo-Realismwith MacRenderMan
Malcolm A. Kesson
-
8/9/2019 Rman Booklet
2/120
CONTENTS
1 IntroductionInteractivity v scripting
Illusions and interfaces
RenderMan
What is a script?
Why u se scripting?
What s the catch?
2 Getting Started
Overview
Using a d efault camera
Setting a p erspective view
Rotating an object
Scaling
Assembling an object
Syntax and the structu re of a RIB file
3
Transformations
Translation
Rotation
Scaling
Skewing
Applying transformations
App lying sequences of transformations
4 Shading the basics
Using lights and materialsApp lying an image to an object
Preparing an image for texture map ping
Using an im age to d isplace a su rface
Avoiding rendering errors and improving performance
5 Shaping Up Library Objects and Polygons
Overview quadrics and p olygons
RenderMans library of quadric surfaces
Placing objects in the w orld
-
8/9/2019 Rman Booklet
3/120
Positioning the w orld relative to the camera
Modelling a coffee mu g
The effects of scaling and tran slation
Reusable geometry
Playing w ith materials surface shaders w ood, carpet and spatterMaking a comp osition the wron g way
Making a comp osition th e correct w ay
Another w ay of group ing objects
Sum mary of method s relating to th e group ing of objects
A simp le polygon mod el (to be added )
6 An Improved Camera
Overview
Depth of fieldMotion blur
Field of view
Matching a VR camera to a real camera
7 Animation
Using FrameUP
Animated texture and displacement maps
8 Basic Lighting
Overview
Defining a light source
Types of light sou rces descriptions
Types of light sou rces examp les
An examp le script
Reference
Positioning lights in space
9 Advanced lighting Casting Shadow s
Overview
An examp le script
The shad ow algorithm: how it works
An examp le animation
-
8/9/2019 Rman Booklet
4/120
10 Importing Fragments
Overview
A sample fragment
Importing correctly
Importing incorrectlyFragments an d objects
Restrictions
Appendix A Overview of MacRenderMan
Appendix B RenderMan Quick Reference
Appendix C Shaders Reference
Appendix D Projects
Separating Shape from Shad ing
Combining the real and the imaginary
Three Dimensional Icons for a Graph ical User Interface
-
8/9/2019 Rman Booklet
5/120
These notes are intend ed to explain the basics of theRend erMan system by
provid ing a series of examp les of its use in theMacintosh environm ent.
Although a nu mber of exercises and projects have been included they will
only be effective when u sed by those who wish to explore and experiment
with the RenderMan system.
I wish to acknowledge the support I received from PIXAR, especially in
graciously providing several pre-release versions of their p hoto-realisticrenderer that was being ported to the new RISC based Power-Macintosh
compu ters at the time that I was p reparing th is booklet for teaching und er-
grad uate stud ents of graphic design the principles of 3D comp uter grap hics.
Malcolm Kesson
April 1994
Wellington
New Zealand
Preface
-
8/9/2019 Rman Booklet
6/120
In Progress
The following sections are incomp lete,
5 Shaping Up
A sub-section dealing with the w ay in w hich RenderMan hand les polygons
has yet to be added. Several modelling exercises using polygons will also
form par t of this chapter.
10 Importing Fragments
The contents of this chap ter are almost complete but som e diagram s have
yet to be included and the body copy still requires some editing.
Add itional sections that may be add ed later includ e a general explanation
about viewing an d shad ing as well as the following,
11 Advanced Texture Mapping
A chapter dealing w ith the r elationships between cartesian space, texture
space and par ameter space. Use of texture s and t par ameters to control
the texturing of polygons and the use of the comm and TextureCoordinates
to likewise control the texturing of quadric surfaces.
12 Solid Modelling
A chapter d ealing w ith the p rinciples of boolean operations on sets of
enclosed objects.
Malcolm Kesson
Apr il 9th 1995
-
8/9/2019 Rman Booklet
7/120
Most designers, especially those who are new to compu ter systems, assum e
the only way to work w ith a compu ter is to use interactive software. Indeed,
grap hical user interfaces (GUIs, pronou nced goo-eez) are taken so mu ch forgranted that it may appear strange, if not bizarre, to reject the ease-of-use that
such systems offer in favour of an environmen t based on text an d scripting.
What possible advan tage could th ere be in using a keyboard rather than a
mou se for grap hical inpu t? Why exchange p ull-dow n m enus, floating
wind ows, dialog boxes and icons for an u nfamiliar w ay of making images that
requires a large investment of time to m aster and th at emp hasises though t,
care and perfect attention to detail? The answer to these questions lies
principally in th e natu re of a GUI.
The problem w ith interactive software is that their interfaces are d esigned to
hide the intricacies of the algorithms and techniques u pon wh ich they arebased. Infact, just as a conjurer deceptively presen ts fiction as fact, GUIs
organise their illusions aroun d metaph ors that rou tinely entice us to accept
the impossible. For example, in illustration software such as Aldus FreeHand
or Adobe Illustrator, users interact with elements of their artw ork as if they are
on separate layers. Even op erating systems encourage u sers to perceive
wind ows as being stacked and ordered into layers. Thus, window s can be
moved to the front or sent to the back. But th e notion that an image on a
compu ter screen can have d epth, let alone be comp rised of layers, is pu re
fiction. This course is intended to take you behind the illusions in order to
more fully understand the principles of 3D mod elling and rendering.
Working in the area of 3D compu ter grap hics without a GUI involves
communicating directly with a software package called a renderer. A renderer
is somew hat like a laser printer but instead of turning a 2D page description,
norm ally in a comp uter langu age called PostScript, into a p rinted image, it
accepts a 3D scene description and converts, or rend ers, it as an image that is
either viewed on the comp uter monitor, or saved as an image file. Because
most renderers are embedd ed w ithin an interactive modeller or animation
system the w ays in w hich they can be used are strictly limited by the host
software. Infact, the only peop le who can really get at the renderer are the
program mers wh o wrote the modelling or animation software!
Rend erers also form p art of software libraries used on high-end graph ics
workstations. But th ese require a kn owledge of a p rograming langu age such
as C, and traditionally, artists and designers have not been given access to
such skills. Fortunately, there is a renderer that su pp orts the typ e of comm un -
ication that we requ irePRMAN is part of the innovative RenderMan system
developed by PIXAR. RenderMan is intended to sup port the prod uction of
ph oto-realistic images based on a mini langu age called RIBRenderMan
Interface Bytestream. The intention of Rend erMan is to separate mod elling
from rend ering. In formulating th eir scene d escription stand ard, PIXAR
established a n um ber of rules by w hich th e characteristics of a virtual world ,
Introduction
Interactivity v scripting
Introduction 1 1
Illusions and interfaces
RenderMan
-
8/9/2019 Rman Booklet
8/120
and a virtual camera to view th at world , can be commu nicated to a rend erer.
Because RenderMan organises the w ay m odellers can p ass information to
rend erers, PIXAR refers to their system as an interface. Information abou t a3D scene is written a s text and is stored in a RIB file. Norm ally these files are
prod uced by an interactive modelling or an imation app lication and are rarely
seen by a naive u ser of a comp uter system. How ever, because the d etails of
the RenderMan Interface have been published by PIXAR, anyone with access
to a w ord p rocessor can w rite or edit a RIB file by hand and can gain greater
control over th e entire image m aking p rocess. In this course you will use
Rend erMan to explore the fund amentals of ph oto-realistic 3D comp uter
graphics.
Scripts are used to convey information abou t a prod uction or performance.
The samples given below are examples of textural and symbolic scripts. Whatever form it takes, a script typ ically enables an au thor to pass su fficient
information about th e structure of a performan ce so that it can be, in some
sense, true or faithfull to the o riginal d esign. To work effectively, a script must
adh ere to certain rules that are understood by th e author an d th e performer.
For examp le, it wou ld be a d isaster for an actor playing the role of King H enry
to speak the lines given in italics, Aumer le locks the d oor.
Introduction 1 2
Enter Bolingbroke, crowned King Henry, with Harry Percy, and other nobles
AUMERLE (rising) Then give me leave that I may turn the key, 35 That no man enter till my tale be done.
KING HENRY Have thy desire.
Aumerle locks the door. The Duke of York knocks at the door and crieth
YORK (within) My liege, beware! Look to thyself! Thou hast a traitor in thy presence there.
King Henry draws his sword
KING HENRY (to Aumerle) Villain, Ill make thee safe.
What is a Script?
Richard II Act 5.3 scripting a theatrical performance
(NeXT Digital Press 1988)
The scripting you will use in this course is no different to an y other typ e of
traditional scriptingyou w ill be the au thor, PRMAN will be the p erformer
and you w ill both conform to the rules defined by Rend erMan.
-
8/9/2019 Rman Booklet
9/120
If scripting is so powerful it is appropriate to ask why interactive software is so
pop ular? The answ er lies in the breadth and flexibility of modern software
design. In a produ ction environmen t the majority of tasks a designer needs to
add ress can be quickly and adequ ately tackled w ith interactive software. Butfor those who u nd ertake innovative and experimental wor k, scripting of one
kind or anoth er, can offer significant adv antages. At one end of the scale,
scripting can mean w riting an entire software p ackage and at the other end it
can mean w riting so-called macros for a spread sheet. In an edu cational
context, and m ore especially for a third level degree course, an investigative
app roach based on scripting means you will learn th e general principles of 3D
work rather than a single imp lementation. However, it should be recognized
that RIB scripts (files) are N OT norm ally wr itten by hand, but are u sually
prod uced by m odelling and animation software and these can hand le levels of
mod elling detail that wou ld be impossible for any hu man to reprod uce
manually.
The Labanotation System scripting human movement
low middle high
forward side backward
Why use scripting?
(The N ew Encyclopaed ia Britann ica vol 7 page 78)
From Three Pieces for String Quartet (No. 1) by Igor Stravinsky notation for scripting music
(The N ew Encyclopaed ia Britann ica vol 24 page 530)
Introduction 1 3
-
8/9/2019 Rman Booklet
10/120
The RIB files in this section are intended to gu ide you throu gh th e basics of
working with Rend erMan. Each examp le has been carefully chosen to
introduce a broad selection of concepts relating to 3D computer graphics. Theexplanations accomp anying each examp le are quite brief and are only
intended to touch up on the ideas being presented. Dont worr y if the material
looks terribly confusing. As the course un folds, the p rinciples und erpinning
the concepts w ill be reiterated and illustrated m any times over.
When a technical term is used for th e first time it is printed in italics. You
should make every effort to un derstand its meaning before continuing w ith
the next section, Shap ing Up Library Objects and Polygon s.
At the conclusion o f this section you will be able to
write, save and send a simp le scene description to PRMAN,
set the basic characteristics of a virtual camera,
use the basic transformations ie. translation, rotation and scaling,
distinguish parameters from RIB statements,
differentiate world space from camera space,
un derstand the role of default settings.
Chapter headings:
Getting StartedShap ing Up Library Objects and Polygons
Camera
Digital Lighting
Digital Lighting and Shad ows
Shading
Getting Started
Overview
Getting Started 2 1
-
8/9/2019 Rman Booklet
11/120
Getting Started 2 2
The pu rpose of this RIB file is to present a min imal scene to PRMAN and to
introdu ce the basics of interacting with the scripting an d rendering
environment.
The first two lines show the u se of the hash symbol # to ind icate these lines
are comm ents and m ust be ignored by the renderer. Comm ents can beincluded an yw here in a RIB file - they are the equ ivalent of post-it notices.
WorldBegin is a RIB statemen t and as such must be sp elled exactly as shown
ie. a single word with two capitalisations. Essentially it notifies Rend erMan
that objects comprising a scene descriptiona virtual worldare about to be
defined.
Disk is a RIB statement th at d efines, by the th reeparameters (num bers) that
follow it, a flat circular d isk situated 1 unit along the z axis, 0.5 units in rad ius
and a full 360 degrees in extent. App roximately, half the RIB statemen ts (or
command s as they w ill be referred to) you will use in this course requ ireparam eters. In all cases each p arameter m ust be separated by at least one
space. They m ay, however, be spread ov er several lines of text and have
comments at the end of each line, for examp le,
Disk1 #unit along the z axis0.5 #units in radius360 #degrees
Finally, WorldEnd indicates the description of the scene, or world, has been
completed. This small RIB file is interesting not just for w hat it describes bu t
also for w hat it om its. Althou gh it does not specify the characteristics of a
virtu al camera to view th e scene ie. its location and or ientation, or the surface
colour and ma terial characteristics of the d isk, or how it is lit, the rend erer is
able to prod uce an image because, in the absence of specific information, it
makes several assump tions and uses a num ber ofdefault settings. In
particular, RenderMan has p rovided
an orthographic view looking along the z axis with the camera and theworld sharing a common origin,
an image called Untitled measur ing 320x240 pixels,
a matte white surface for the disk that does not require external lighting.
Example 1
RIB
#ortho disk1.RIB#using a default cameraWorldBegin
Disk 1 0.5 360WorldEnd
-
8/9/2019 Rman Booklet
12/120
Getting Started 2 3
#ortho disk1.RIB
#using a default camera
RIB
two comments about the scene, thefirst gives the name of the file and
the second is a brief note about thescene
x
y
z
y
x
z
WorldBegin
the default camera creates anorthographic view, 320x240 pixels,with a name supplied by RenderApp
begin describing the world
Disk 1 0.5 360
x
y
z
y
x
z
create a disk situated 1 unit alongthe z axis, 0.5 units in radius and360 degrees in circumference
description of the world completeWorldEnd
initially the origins of the camera
and world coincide
Visualizing example 1
-
8/9/2019 Rman Booklet
13/120
Getting Started 2 4
Example 2
#perspective disk.RIB#setting a perspective viewProjection "perspective" "fov" 40WorldBegin
Translate 0 0 3Disk 0 0.5 360
WorldEnd
The purp ose of this file is to show the w ay in wh ich a virtu al camera u sing
perspective projection can be set up before the w orld is defined and also to
introdu ce the use oftranslation to m ove objects in a scene.
Before the w orld is d efined the statement Projection establishes a perspectiveview with afield of vision of 40 degrees - this is one of several statements that
control a virtual camera. Note that two of its three param eters are words. So
that RenderMan d oes not attempt to interp ret them as RIB statements or
command s, textual param eters are always given in qu otes ie. .
As in the p revious example, the scene consists of a single disk bu t this time
the origin of the coordinate system has been moved 3 units along the z axis
before the disk is defined. The Translate command has three parameters,
Translate x y z
to move, what m ay be thought of as a three dimensional cursor arou nd the
world space.
RIB
-
8/9/2019 Rman Booklet
14/120
Getting Started 2 5
Projection "perspective" "fov" 40
RIB
x
y
z
y
x
z
WorldBegin
set the camera to give a perspectiveview with a field of vision of 40degrees, the size and name of theimage are supplied by RenderApp
begin describing the world
Disk 0 0.5 360
x
y
z
y
x
z
create a disk situated at the origin,0.5 units in radius and 360 degreesin circumference
description of the world completeWorldEnd
initially the origins of the cameraand world coincide
Translate 0 0 3 move the origin 3 units along the zaxis
x
y
z
y
x
z
Visualizing example 2
-
8/9/2019 Rman Booklet
15/120
RIB
Getting Started 2 6
Example 3
#tube.RIB#rotating an objectProjection "perspective" "fov" 40WorldBegin
Translate 0 0 5Rotate -120 1 0 0Color 1 0 0Cylinder 1 -1 1 360
WorldEnd
In this scene a cylind er is introduced into a world space that has, for the
pu rpose of better viewing, been rotated and moved away from the camera.
The cylinder has also been coloured.
The RIB statement Cylinder, with four p arameters,
Cylinder radius depth height arc
shows how, like the disk in the previous example, an object from Render-
Mans library of pr imitive shap es can be u sed in a scene. The cylinder an d
disk, as well as the other su rfaces in the Rend erMan librar y, will be dealt w ith
in deta il in the next section.
This file uses ano ther type oftransformation,
Rotate angle x y z
which in this instance turns the coordinate system 120 degrees anti-clockwise
around the x axis BEFORE the or igin is translated 5 units along the z axis of
the world . Although th e renderer reads the transformations in the order in
wh ich th ey app ear, it postpones app lying them u ntil an object is declared, at
which time it back-tracks and uses the transformations from last to firstlike
bullets in the magazine of a gu n, the last one loaded is the first to be shot!
A cylinder is created within the redefined world coordinate system. Since the
camera is fixed to the old world origin, the renderer p rodu ces an image
looking slightly into the top of the cylinder. Using a fixed camera and trying
to obtain a p articular view ing angle by orientating an object in a scene is only
adequ ate for simple compositions. In the n ext section th e virtual camera is
positioned relative to the world - m uch like a hand held camera in real
photography.
Color (note the north American spelling) specifies a hue in terms of three
components,
Color red green blue
A colour is app lied to each ob ject un til another is declared in the RIB file.
-
8/9/2019 Rman Booklet
16/120
x
y
z
yx
z
1
Getting Started 2 7
Projection "perspective" "fov" 40
RIB
x
y
z
y
x
z
WorldBegin begin describing the world
Cylinder 1 -1 1 360
x
y
create a cylinder, 1 unit in radius,with a base 1 unit below and a top 1unit above the origin, 360 degrees incircumference
description of the world completeWorldEnd
initially the origins of the cameraand world coincide
Translate 0 0 5Rotate -120 1 0 0
the transformations are applied inreverse order; first an anti-clockwiserotation of 120 degrees around the xaxis, followed by a translation of 5
units along the z axis
set the camera to give a perspectiveview with a field of vision of 40degrees, the size and name of theimage are supplied by RenderApp
y x
z
y
y x
z
2
Visualizing example 3
-
8/9/2019 Rman Booklet
17/120
Getting Started 2 8
Example 4
#scaled tube.RIB#scalingDisplay "scaling" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 200 150 1WorldBegin
Scale 0.3 0.3 0.3Translate 0 0 5Rotate -120 1 0 0Cylinder 1 -1 1 360
WorldEnd
This example introdu ces the id ea ofscaling the w orld space, and th erefore,
any ob jects placed in it. It also illustrates the w ay in w hich the char acteristics
of a virtual camera can be further refined and controlled.
Like the p revious examp le, a cylind er is introduced into a world space that
has been rotated an d translated for better viewing. However, in th is examp le
the w orld sp ace has also been uniform ly redu ced to 30% of its original scale.
In this and all futu re scenes, the RIB statements Display an d Format are used
to provide ad ditional control over the imagery p rodu ced by th e virtual
camera. Display uses three p arameters to sp ecify
the name of the image,
where to put the image, and what information the image should contain.
Format uses three numeric parameters
Format image width image height pixel ratio
Althou gh it ap pear s first, Scale only takes effect after the rota tion and
translation h ave been app lied - remember, transformations are app lied in
reverse order. The scale statement uses three parameters,
Scale x y z
to enlarge or redu ce a coordinate system along its x, y and z axes.
RIB
-
8/9/2019 Rman Booklet
18/120
Getting Started 2 9
Display "scaling" "framebuffer" "rgb"
Projection "perspective" "fov" 40Format 200 150 1
RIB
x
y
z
y
x
z
WorldBegin begin describing the world
Cylinder 1 -1 1 360
x
y
create a cylinder, 1 unit in radius,with a base 1 unit below and a top 1
unit above the origin, 360 degrees incircumference
description of the world completeWorldEnd
initially the origins of the cameraand world coincide
Scale 0.3 0.3 0.3Translate 0 0 5Rotate -120 1 0 0
the transformations are applied inreverse order; first an anti-clockwiserotation of 120 degrees around the xaxis, then a translation of 5 unitsalong the z axis, followed by theuniform scaling
set the camera to give a perspectiveview with a field of vision of 40degrees, set the size of the image to200x150 pixels storing rgb information
y x
z
x
y
z
yx
z
y
y x
z
x
y
y x
z
1 2
3
Visualizing example 4
321
-
8/9/2019 Rman Booklet
19/120
Getting Started 2 10
Example 5
#goblet.RIB#assembling an objectDisplay "goblet" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 150 200 1
WorldBeginScale 1 1 1 #change these to squash and stretch the gobletTranslate 0 0 5Rotate -120 1 0 0
Color 1.0 0.978 0.34 #goldCylinder 1 0 1.5 360 #containerDisk 0 1 360 #base of the containerCylinder 0.25 -1.5 0 360 #stemDisk -1.5 1 360 #base of the goblet
WorldEnd
RIB
In this example a nu mber of basic library shapes are assembled into a simp le
goblet.
Color app lies a un iform yellow hue to the entire goblet. Experiment w ith
alternative colour schemes by introdu cing add itional color statements
between each part of the goblet. In p articular, add another d isk positioned a
little below the rim of the goblet so that it ap pears to contain a coloured
liquid.
The Scale statement, in effect, does noth ing because it app lies a un iform
scaling factor of one. Change the scaling factor of each pa ram eter to see how
the goblet can be ind ividu ally squashed an d stretched in height, wid th and
dep th, for example,
Scale 1 2 1
-
8/9/2019 Rman Booklet
20/120
Conclusion
By the time you finish the examp les in th is section and , no d oubt, completed
a few mod ifications of your ow n, you w ill have been introdu ced to m any
concepts, not only in 3D compu ter graph ics in general, but also in theabstract world of RenderMan. This section concludes with a brief review of
th e syntax of Rend erMan and an over-view of the structu re of a RIB file.
Twelve RIB statements or command s were u sed in Getting Started - by the
conclusion of the course you will have d ealt with ap proximately 35 of the
entire range of 96 RIB commands. In addition to the hash symbol, the
following statements:
Projection/ Display/ Format define a virtual camera,
WorldBegin/ WorldEnd relate to the concept of a virtual world ,
Translate/ Rotate/ Scale are examples of transformations, and finally
Disk/ Cylind er insert library objects/ surfaces into the world .
Incidentally, the word s statement and command are used interchangably.
RIB statements form p art a language recognised by th e rend erer. By hu man
standard s it is an impovished language, but n onetheless, it is in its own r ight
a complete system of commu nication. Some statements go together in p airs,
WorldBeginWorldEnd
and bracket, wh at are called blocks of RIB. Other statements have words
and / or num bers, called param eters, associated with them, for example,
Translate 0 0 5Projection "perspective" "fov" 40
that, in the m ajority of cases, provide essential information w ithout w hich the
statement makes n o sense.
At the beg inning of a RIB file only a virtu al camera exists, and therefore, all
statements relate to it and to nothing else, for examp le,
DisplayProjectionFormat(anything else that is appropriate)
As soon as th e renderer reads WorldBegin, the camera is frozen and all
subsequent statements effect the v irtual w orld, for example,
WorldBeginObjects etc
WorldEnd
and finally, WorldEnd marks the completion of the scene description.
Syntax
Structure of a RIB file
Getting Started 2 11
-
8/9/2019 Rman Booklet
21/120
There are four basic method s of chan ging or m odifying 3D objects; they can
be repositioned, reorientated, resized or distorted in space. These alterations
to an object, called transformations, are carried ou t relative to the origin of thecoordinate system and are known as
translation moving rotation turn ing scaling stretching or squ ashing skewing shearing
The illustrations show th e effect of app lying th e transformations to tw o cones
that are p ositioned at the or igin an d a short distance along the xaxis. In each
case the zaxis is pointing into th e page.
Transformations
Transformations 3 1
Translation
Translate 3 1 0
Rotation
Rotate 45 0 0 1
Scaling
Scale 0.5 0.5 0.5
Notice how the cone shifts toward theorigin of the coordinate system. Theopposite would occur if it were beingenlarged.
y y
x x
-
8/9/2019 Rman Booklet
22/120
Transformations 3 2
The cylinder appears to be largefrom the viewpoint of the camera
Skew -30 0 1 0 1 0 0
ie. lean the yaxis 30 toward the xaxis
Rotating and scaling an object that is NOT positioned at the origin of thecoordinate system can give rise to unexpected resu lts. Scaling, for examp le,
has the effect of mov ing the su rface of an object tow ard or aw ay from th e
origin d epend ing on w hether the object is being red uced or enlarged. If the
space into w hich an object is to be placed is translated, rotated an d/ or scaled,
it norm ally m akes more sense to ap ply the translation AFTER the rotation and
scaling as shown in the lower d rawing.
The following illustrations are based on Getting Started example 4, they
are intended to show how sw apping the order in w hich Scale an d Translate
are app lied results in the cylind er being p laced in tw o entirely d ifferent
locations in space. In each example the camera is located a t the origin of the
coordinate system.
Applying Transformations
Scale 0.3 0.3 0.3 #3rdTranslate 0 0 5 #2ndRotate -120 1 0 0 #1stCylinder 1 -1 1 360
1st 2nd
3rd
y
z
Translate 0 0 5 #3rdScale 0.3 0.3 0.3 #2ndRotate -120 1 0 0 #1stCylinder 1 -1 1 360
1st
2nd3rd
y
z
Skewing
Here the cylinder appears to bemuch smaller
y
x
y
x
-
8/9/2019 Rman Booklet
23/120
Transformations 3 3
Applying Sequencies of Transformations
Display "3tubes" "framebuffer" "rgb"
Projection "perspective" "fov" 40Format 400 300 1
WorldBeginTranslate 0 0 7Rotate -110 1 0 0Rotate 25 0 0 1
#insert the upright red cylinderScale .5 1 1Color 1 0 0Cylinder 0.5 -2 2 360
#insert the green second cylinderRotate 90 1 0 0
Scale .5 1 1Color 0 1 0Cylinder 0.5 -2 2 360
#insert the blue third cylinderRotate 90 0 1 0Scale .5 1 1Color 0 0 1Cylinder 0.5 -2 2 360
WorldEnd
RIB
The purp ose of this section is to gain a better und erstanding of the cumm u-lative effect of applying repeated sets of transformations to a modelling space.
The RIB file show n above illustrates one of the un expected resu lts that can
occur with transformations. In p articular n otice how the repeated scaling in
the x direction (shown in bold in th e RIB script) not only comp ound s the
overall squashing of each tu be but also redu ces the length of the blue tube.
This is quite an unexpected result. After all why should the length of th e last
tube be effected alon g its zaxis by scalings that h ave only been ap plied to th e
xaxes? The illustrations on the next two pages provide a step-by-step
explanation.
-
8/9/2019 Rman Booklet
24/120
Transformations 3 4
x
The camera coordinate system may be considered to lie on the su rface of the
computer screen as if it were a large view-finder of a virtual camera . At the
beginning of the RIB script the axes shown below (a) mar k wh at is called thecurrent coordinate system.
The following RIB statements transform w hat m ay be thou ght of as a copy of
the current coordinate system before the first object is inserted into the w orld .
_3 Translate 0 0 7 _2 Rotate -110 1 0 0 _1 Scale 0.5 1 1
Cylinder 0.5 -2 2 360
As soon as th e cylinder is d eclared, the transformed copy of the coordinate
system (b) becomes th e current coordinate system. Subsequent transformations
will take p lace with reference to the new axes (c).
y
x
y
z
z
x
y
Notice how the xaxis has beenscaled by 50%.
Camera space
z y
z
x
(a)
(b)
(c)
_3
_1
_2
-
8/9/2019 Rman Booklet
25/120
z
x
y
Transformations 3 5
The second set of RIB statements shown below transform w hat again m ay be
though t of as a copy of the current coordinate system.
Rotate 90 1 0 0Scale .5 1 1Cylinder 0.5 -2 2 360
Once again as soon as the second cylind er is declared, the copy of the
coordinate system (d) becomes the current coordinate system (e). Notice the
xaxis has received a fur ther red uction in scale.
z
y
x
The last set of RIB statements ap ply the final tran sformations prior to inser ting
the th ird cylind er.
Rotate 90 0 1 0Scale .5 1 1Cylinder 0.5 -2 2 360
Again th e xaxis of the m odelling space receives another redu ction in scale.
How ever, because of the rotation of the coordinate system around the yaxis,
the final cylinder is inserted p arallel to a coord inate axis that has been
considerably squashed hence the dram atic redu ction in th e length of the
cylinder.
z
y
x
z
y
x
The hollow arrows indicate thetransformed coordinates before
they become the current system.
(d)
y
z
(e)
-
8/9/2019 Rman Booklet
26/120
The pu rp ose of this section is to introd uce the basics of rend ering objects
ph oto-realistically. It is intended to be a p ractical introd uction an d as su ch it
does not ad dress the theory of rendering.
To prod uce a realistic image a rend erer mu st be provided with information
about th e nature of the light sources and th e material and geom etric attributes
of the objects in a synthetic scene. In add ition, the rend erer also requires
information about th e virtual camera that is being u sed to view the scene. For
the sake of simplicity the examples in th is section use a camera w ith a
standard focal length lens, that provid es full coloured low resolution im ages,
eg.
Projection "perspective" "fov" 40Display "untitled" "framebuffer" "rgb"
Format 300 200 1
A simp le object from th e Rend erMan librar y of quad ric surfaces, eg.
Sphere 1 -1 1 360
is used through out this section so that any und ue complications that might
arise as a result of modelling a complex object(s) can be av oided .
If compu ter graph ics can be likened to painting by n um bers, then the
process of rendering a 3D scene can be th ought of as painting with light.
Therefore, a photo-realistic system such as RenderMan, whose purpose is to
create imagery th at is indistingu ishable from real ph otograph y, is useful only
to the extent that it enables users to make su btle changes to th e way light
interacts with each part of a scene.
At each stage in the rendering process the w ay that light is changed as a result
of these in teractions is called shading, and RenderMan p rovides a mechanism
for controlling th e outcome of each interaction th rough the u se of what it
describes as shaders. For examp le, the interaction of light with the su rface of an
object is controlled by a surface shader; while the cha racteristics of the light
prod uced by a sou rce of illum ination are governed by a light source shader. In
add ition to th ese two types of shad ers this section also introdu ces a shad erthat controls the way light reacts with an object whose surface has been
displaced to form sm all bum ps and pits a displacement shader.
Although Rend erMan p rovides seven d ifferent typ es of shaders, this section
only introdu ces three of them. The following RIB scripts have been carefully
selected to act as templates for your own experiments in the creative use of
Surface, Lightsource an d Displacement shaders.
Shading the basics
Shading the basics 4 1
-
8/9/2019 Rman Booklet
27/120
Using lights and materials
The followin g scene consists of a coloured plastic sph ere that is illum inated
by two lights.
Projection "perspective" "fov" 40Display "untitled" "framebuffer" "rgb"Format 300 200 1
Translate 0 0 5Rotate -120 1 0 0Rotate 25 0 0 1
WorldBeginLightSource "ambientlight" 1 "intensity" 0.1LightSource "distantlight" 2 "intensity" 1.5 "from" [0 0 4] "to" [0 0 0]
Color 1 0 0Surface "plastic"Sphere 1 -1 1 360
WorldEnd
RIB
Of the two light sources used to illuminate th e scene the first provides a very
small amoun t of backgroun d, or am bient lighting. The second light is
positioned directly above the sph ere and is pointing toward the origin of the
coordinate system an d hence toward the centre of the sphere. Both "ambient-
light" and "distantlight" are provid ed by Rend erMan as p art of a basic library
of four typ es of light sou rces, the oth ers are "pointlight" and "spotlight".
The surface of the sphere has been a ssigned th e reflective proper ties of plastic
eg.
Surface "plastic"
Sphere 1 -1 1 360
(Using a shiny m aterial makes it somewh at easier to see how the high-lights
respond to any changes that are mad e to the p osition of the light sou rces.)
Rend erMan su pp lies a small nu mber of materials eg. plastic, wood , granite,
carpet etc., that can be u sed w ith the Surface statement. Each material has its
own way of being tun ed to the ind ividual requirements of a scene. For
example, the sph ere could have been given the p roperties of a very m atte and
non-reflective rough ened plastic with the following statement,
Surface "plastic" "Ks" 0.1 "roughness" 0.5
The surface shader "plastic" can use five parameters (the default valu es for
these are given in p arenth eses), namely,
"Ka" respon se to ambient light (1.0),
"Kd" d iffuse reflections (0.5),
"Ks" specular reflections (0.5),
"roughness" graininess of the surface (0.1), and finally,"specularcolor" the colour of the h igh-lights ([1 1 1]).
Shading the basics 4 2
-
8/9/2019 Rman Booklet
28/120
Applying an image to an object
The scene used in this examp le is very similiar to the first except th at a sur face
shader called "texmap" is used to wrap a 2D image around the sph ere a
technique know n as texture mapping,
Surface "texmap" "texname" ["your picture.tx"] "maptype" 2
The term texture in the context of 3D computer graphics is a little misleading
because it only refers to variations of the colour of a surface, it does not im ply
anything abou t its structure or rou ghness. Since there are a num ber of ways an
image can be wrap ped arou nd an object, "texmap" mu st be told to use
"maptype" 2 ie. sph erical mapp ing. Before "texmap" can apply an image to a
surface, the image mu st first be used to generate an interm ediate texture file.
The following statement does the necessay conversion,
MakeTexture "your picture.tiff" "your picture.tx" "periodic" "periodic""gaussian" 2 2
The main thing to note is that the image to be u sed as the source for the
texture file, which in th is instance is called "your picture.tiff", is located in the
same folder as the RIB file itself otherw ise the rend erer has n o way ofknowing where to find the appropriate file. Generally, picture files are either
created or modified using PhotoShop. It is essential they are stored as RGB
files rather th an, say, gray scale images. Once an image has been u sed to create
a texture file the MakeTexture statement can be commented-out.
The purp ose of the last part of the MakeTexture statement ie. "periodic"
"periodic" "gaussian" 2 2, is to allow the texture to be rep eatedly tiled over the
sphere should th at be necessary and to ensure the resulting texture map has a
smooth, or an ti-aliased, app earance. Like man y of the areas touched u pon by
this section, discussions about th e finer d etails of texture m app ing are d ealt
with elsewhere.
Projection "perspective" "fov" 40
Display "untitled" "framebuffer" "rgb"Format 300 200 1
Translate 0 0 5Rotate -120 1 0 0Rotate 25 0 0 1
MakeTexture "your picture.tiff" "your picture.tx" "periodic" "periodic" "gaussian" 2 2
WorldBeginLightSource "ambientlight" 1 "intensity" 0.1LightSource "distantlight" 2 "intensity" 1.5 "from" [0 0 4] "to" [0 0 0]Surface "texmap" "texname" ["your picture.tx"] "maptype" 2
Sphere 1 -1 1 360WorldEnd
RIB
Shading the basics 4 3
-
8/9/2019 Rman Booklet
29/120
Preparing an image for texture mapping
Scan and/ or mod ify a grap hic using PhotoShop, save it as either a TIFF or a
PhotoShop 2.5 file. Even if it is a mon ochrome image be sure to m anip ulate it
in RGB mod e within Ph otoShop.
Redu ce the graph ic to a square format by choosing Im age Size from th e
Image m enu item. The Image Size dialog box will allow the graph ic to be
resized to a squ are asp ect ratio, say 800 x 800 pixels.
Select All using the Select men u item then rotate the graph ic 180 degrees
with the Rotate command und er the Image menu.
Use Save As to store the gr aph ic as a TIFF file in the sam e folder as th e
RIB file that w ill use it for texture map ping.
DO NOT MODIFY THE ORIGINAL GRAPH IC ALWAYS WORK ON ACOPY.
Although the Macintosh operating system does not require file extensions,
make sure the image file is named with a .tiff extension eg.me.tiff. Nam ing
image files and RIB scripts with .tiff and .rib extensions makes them very
easy to ident ify on the desktop. It is advisable to comp ress the file using LZW
compression.
Within the RIB script convert the graph ics file to a texture file with th e
statement,
MakeTexture "me.tiff" "me.tx" "periodic" "periodic" "gaussian" 2 2
Once the RIB script has been used successfully the MakeTexture statement can
be comm ented-out ie.
#MakeTexture "me.tiff" "me.tx" "periodic" "periodic" "gaussian" 2 2
This will ensure that su bsequent rend erings will be comp leted as quickly as
possible. Of cour se if the original grap hics file is altered th en a new textu re file
mu st be produ ced, in w hich case the comm ent (ie. #) must be removed .
Use the surface shader texmap to wr ap th e texture file around the sphere.
Surface "texmap" "texname" ["me.tx"] "maptype" 2Sphere 1 -1 1 360
The texmap surface shader allows the same p arameters as the p lastic
shad er (ie. Ka, Kd , Ks, roughness and specularcolor) to be used to cont rol the
way light reflects from the surface of the texture map.
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Shading the basics 4 4
-
8/9/2019 Rman Booklet
30/120
Using an image to displace a surface
In this example an image is u sed to u pset or d isplace the surface of a sphere
a technique know n as displacement mapping. Similiar to the su rface shad er
texmap, the emboss displacement shader requires an image file to be
converted to an intermediate texture file ie.
MakeTexture "your picture.tiff" "your picture.tx" "periodic" "periodic""gaussian" 2 2
Again you m ust ensure th e image to be used as the source for the displace-
men t m ap is located in th e same folder as the RIB file itself. A tiff file to be
used as a source image for displacement map ping can be saved in either
PhotoShops gray-scale or rgb mode. However, gray scale images give a more
pronou nced em bossing effect. Once an im age has been used to create a texture
file the MakeTexture statement can be commented-out eg.
#MakeTexture "your picture.tiff" "your picture.tx" "periodic" "periodic""gaussian" 2 2
Unlike a techniqu e called bu mp map ping, displacement m app ing really
does m ake changes to the geometry of the su rface to w hich it is app lied. It is,
therefore, superior to bum p m app ing which only makes a surface appear to be
bumpy. The emboss displacement shad er mu st be given the nam e of a
texture file that it w ill use for em bossing ie.
Displacement "emboss" ["your picture.tx"] "Km" 0.03
It should also be given a reasonable value for the param eter Km w hich sets
the magn itude of the embossing. The emboss shader respond s to the gray
values in the texture file lighter p arts of the image are pressed deeper in to
the su rface. The default va lue for Km is 0.03.
Projection "perspective" "fov" 40
Display "untitled" "framebuffer" "rgb"Format 300 200 1
Translate 0 0 5Rotate -120 1 0 0Rotate 25 0 0 1
MakeTexture "your picture.tiff" "your picture.tx" "periodic" "periodic" "gaussian" 2 2
WorldBeginLightSource "ambientlight" 1 "intensity" 0.1LightSource "distantlight" 2 "intensity" 1.5 "from" [0 0 4] "to" [0 0 0]Displacement "emboss" "texname" ["your picture.tx"] "Km" 0.03
Sphere 1 -1 1 360WorldEnd
RIB
Shading the basics 4 5
-
8/9/2019 Rman Booklet
31/120
Avoiding rendering errors and improving performance
The renderer u ses each objects boun ding box to qu ickly determine wh ere their
surfaces are located in a scene. In th is way it avoids trying to render emp ty
space. How ever, wh en the su rface of an object is shifted a s a result ofdisplacement m app ing, PRMAN m ay make severe rendering errors. The
renderer literally ignores those parts of the object that have been displaced
outside their bound ing box. Rend erMan provid es a mechanism by w hich the
renderer can be warned about such d isplacements eg.
Attribute "bound" "displacement" [0.2]Displacement "emboss" ["your picture.tx"] "Km" 0.03
Shere 1 -1 1 360
As long as it app ears before the nam e of the object, Attribute can be inserted
before or after the Displacement statement. Unfortunately, even thou gh the
displacement m agnitud e is set with the Km factor their is no way of knowing
the exact Attribute value to u se. In th e example shown above it is set to 0.2 but
often 0.1 is enough to p revent rend ering errors from occuring.
Rend ering operations that involve texture files require more m emory th an
those that d ont. To ensure it can operate on compu ters with m odest amou nts
of memory, Rend erMan only sets aside a small amou nt of mem ory for
working w ith textures. To improve p erformance an option m ay be set to
inform the rend erer to work w ith larger chu nks of texture ie.
Option "limits" "texturememory" [4096]
The valu e 4096 specifies the nu mber of Kbytes (4 MB) to set asid e for
mem ory to be u sed to store information read from a texture file. If you w ish to
use th is option p lace it at the beginn ing of the script options effect the whole
scene and mu st be set before the camera and world are described.
Shading the basics 4 6
Bounding boxes
Memory and speed
-
8/9/2019 Rman Booklet
32/120
This section explores the ways that objects are defined in a virtual world.
Because our 3D w orlds are d escribed by han d w ritten RIB files they will be
relatively simp le. However, this is not a disad van tage because it will focusattention on imp arting as mu ch visual interest through th e use of careful
shading techniques and sensitive lighting, rather than gratutious comp lexity
obtained all too easily by the use of an interactive mod elling system . Before
embarking u pon the intricacies of lighting and shading som e competence
mu st be gained with m odelling. This section is designed to provide you with
these skills.
Shap ing Up takes an in-dep th look at two typ es of surfaces comm only used
to construct virtual models, namely, quadrics an d polygons. Sophisticated
modellers also use surfaces based on curves called splines. If you have used
an illustration program such as Adobe Illustrator or Aldus FreeHand youwou ld h ave emp loyed 2D splines to create curves. However, 3D splines are an
advan ced top ic of stud y and will not be addressed in this course.
Particular u se will be made of the library of shapes, or primitives as they are
sometimes called, that are built into RenderMan. These pre-defined surfaces
are based u pon mathem atical expressions called qu adratic equations, hence
their general name ofquadric surfaces. There are seven su rfaces in th e library
and they are illustrated on th e next two pages. Each quad ric has its own set of
parameters that allow its form to be accurately specified. The meaning of these
param eters and examples of their u se are given. In ad dition to being d escribed
by an equation they are also surfaces of revolution. That is, they are formed byspinning a line or curv e around a central axis. Most mod elling program s offer
these primitives because it is easy to assemble them into composite models.
Unlike man y renderers Rend erMan does not ap proximate quad rics in any
way and so renders them with smooth silhouettes.
The other typ e of sur face that w ill be used is a polygon - a flat shape enclosed
by straight edges. Traditionally, polygons have been very important in 3D
compu ter graph ics because of the ease with w hich th ey can be
internally represented by mod ellers and rend erers,
assembled into a skin or mesh that approximates a desired form, and rendered in a variety of ways to give the illusion of smoothness.
The straight ed ges of a polygon are d efined by a sequen ce of 3D vertices each
of which is specified by three n um bers its x, y and z coordina tes. Since even
simple polygon m eshes can consist of dozens of polygons each consisting of
at least three vertices (ie. triangles), it will only be feasible for us to describe
very simple surfaces.
Shaping Up library objects and polygons
Overview
Shaping Up 5 1
Quadrics
Polygons
-
8/9/2019 Rman Booklet
33/120
z
y
x
theta max
zmax
zmin
radius
RenderMans Library of Quadric Surfaces
z
y
x
z
y
x
theta max
height
radius
z
y
x
theta max
zmax
zmin
radius
height
radius
theta max
Disk 0.5 1.0 300 (example)
Cone 1.75 1.0 270
Sphere 1.0 -0.5 0.8 270
Cylinder 1.0 -0.5 1.0 300
Cone height radius thetamax
Cylinder radius zmin zmax thetamax
Sphere radius zmin zmax thetamax
Disk height radius thetamax (syntax)
Shaping Up 5 2
-
8/9/2019 Rman Booklet
34/120
Shaping Up 5 3
y
zmax
zmin
z
y
x
theta maxpoint1
point2
z
y
x
theta max
major rad
min rad
phi min
phi max
x
z
theta max
RenderMans Library of Quadric Surfaces - continued
Torus 1.0 0.3 90 320 300
Paraboloid 1.0 0.15 1.2 300
Hyperboloid -0.3 1.0 -1.0 0.7 0.7 1.0 300
Torus major rad min rad phimin phimax thetamax
Paraboloid radius zmin zmax thetamax
Hyperboloid point1 point2 thetamax
radius
-
8/9/2019 Rman Booklet
35/120
RIB
Shaping Up 5 4
Example 1 - dont forget the inside!
#better goblet.RIB#adding an inside surfaceDisplay "goblet" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 200 150 1
WorldBeginLightSource "pointlight" 1 "intensity" 40 "from" [4 2 4]Translate 0 0 5Rotate -120 1 0 0
Surface "plastic"Color 1.0 0.9 0.3 #goldCylinder 1 0 1.5 360 #containerDisk 0 1 360 #base of the containerCylinder 0.25 -1.5 0 360 #stem
Disk -1.5 1 360 #base of the goblet
Translate 0 0 1.5 #move the origin to the top of the gobletSphere 1 -1 0 360 #hemi-spherical inside surface
WorldEnd
This example introd uces the first of the library shapes a sph ere. It also uses
two new RIB statements, LightSource an d Surface. 3D compu ter graph ics
has d eveloped a rich set of lighting and surface texturing techniques that can
dramatically alter the appearance of an object. Although the concepts are
dealt with in detail in later sections, light sources and material attributes canstill be used effectively, even withou t elaborate explan ations, to add realism
to a model.
With th e exception of those lines marked in italics, this file is the sam e as the
final example of the prev ious section. At the end of the scene d escription the
origin is moved to the top of the goblet and th e lower half of a sphere is
placed within th e container by the RIB command ,
Sphere radius zmin zmax thetamax
A (poin t) light sou rce is oriented to high-light the curved sur faces of the
goblet. The harshness of the lighting can be reduced by inserting this line,
LightSource "ambientlight" 2 "intensity" 0.2
imm ediately after the first light source statement. The RIB comm and Surface,
followed by the n ame of a m aterial in th e Rend erMan library acts much like
Color intha t all subsequen t objects acqu ire the chosen characteristics.
Although m ore will be said about m aterials and surface textures, you may
like to experiment by su bstituting the par ameter p lastic for any on e of
those shown in th e list given opposite. Later you will be shown how to
control the char acteristics of each ma terial.
carpetcloth
cmarble
constantfinemetal
Mattemetal
paintedplasticplastic
rmarblersmetal
shinymetalspatter
stonewood
-
8/9/2019 Rman Booklet
36/120
Shaping Up 5 5
Placing objects in the world
Cylinder 1 0 1.5 360
RIB
The actions of some of the RIB statemen ts in the first examp le are illustrated
below. In each case the position of the xy p lane is indicated by a grid . The
surface being created is shown in the heavier line weight and the par ameter(s)responsible for positioning th e surface in th e z d irection are show n in bold.
Disk 0 1 360
Cylinder 0.25 -1.5 0 360
Disk -1.5 1 360
Translate 0 0 1.5Sphere 1 -1 0 360
-
8/9/2019 Rman Booklet
37/120
Shaping Up 5 6
Example 2 - adding a rim and moving the camera
#goblet with rim.RIB#adding a rimDisplay "goblet" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 200 150 1
Translate 0 0 5Rotate -120 1 0 0
WorldBeginLightSource "pointlight" 1 "intensity" 50 "from" [4 2 4]LightSource "ambientlight" 2 "intensity" 0.2
Surface "plastic"Color 1.0 0.8 0.3 #goldCylinder 1 0 1.5 360 #container
Disk 0 1 360 #base of the containerCylinder 0.25 -1.5 0 360 #stemDisk -1.5 1 360 #base of the goblet
Translate 0 0 1.5 #move the origin to the top of the gobletCylinder 0.9 -1.4 0 360Disk -1.4 0.9 360Torus 0.95 0.05 0 180 360
WorldEnd
Although this examp le demonstrates the u se of a torus, its main feature is the
way the transformations,
Translate 0 0 5Rotate -120 1 0 0
that were previously used to rotate and m ove the goblet within the world
space are now effecting the whole wor ld. Remember, all RIB statemen ts pr ior
to WorldBegin refer to the w ay the w orld is oriented with respect to the
camera. Because it makes more sense to change the cameraworld
relationship, as shown by the illustration on the next page, it will no longer be
necessary to rotate and move ind ividual objects to obtain a better view of
them.
After a cylindrical liner and a flat base have been add ed to the inside of the
goblet a round ed rim is created w ith the Torus statement,
Torus major rad min rad phimin phimax thetamax
Try to ad d an other d isk to the base of the goblet and provide it w ith either a
RIB
-
8/9/2019 Rman Booklet
38/120
x
y
z
yx
z
Shaping Up 5 7
Display "goblet" "framebuffer" "rgb"
Projection "perspective" "fov" 40Format 200 150 1
RIB
display the graphic in a window titled
"goblet", 200 by 150 pixels in size,use a camera with a 40 degree field ofvision and include rgb colour data
initially the origins of the cameraand the world coincide
x
y
z
y
x
z
rotate the world -120 degreesaround the x axis
move the world 5 units along the zaxis of the camera
since transformations occur inreverse order the rotation is followedby the translation
x
y
z
y x
z
Translate 0 0 5Rotate -120 1 0 0
"freeze" the camera - now only usethe world coordinates
WorldBegin(assemble the goblet)
x
y
z yx
z
WorldEnd scene description complete
Positioning the w orld relative to the camera
-
8/9/2019 Rman Booklet
39/120
#coffee mug.RIB#modifying the gobletDisplay "mug" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 200 150 1
Translate 0 -0.5 5Rotate -120 1 0 0Rotate 45 0 0 1
WorldBeginLightSource "pointlight" 1 "intensity" 50 "from" [4 4 4]LightSource "ambientlight" 2 "intensity" 0.25
Surface "plastic"Color 0 0 1 #fully saturated blue
Cylinder 1 0 1.5 360 #mugDisk 0 1 360 #base of the mugTranslate 0 0 1.5 #move the origin to the topCylinder 0.9 -1.4 0 360 #lining of the mugDisk -1.4 0.9 360 # bottom of the mugTorus 0.95 0.05 0 180 360 #mug rim
Translate 0 1 -0.75 #move the origin to the back, and lower it half way down the mugRotate 90 0 1 0 #rotate the origin so that the handle will be verticalTorus 0.6 0.1 0 360 180 #create a handle
WorldEnd
In this example some minor alterations to the scene have changed the goblet
into a coffee mug. The statements relating to the stem and base have been
removed an d those shown in bold have been add ed or altered. How ever, the
most imp ortant p oint to notice about this file is the way th e world is rotated 45
degrees clockwise abou t the z axis before it is tipp ed back 120 degrees. In all
the p revious examp les the camera w as vertically aligned w ith the y axis of the
world . If you place a comment in front of the cameras second rotation you
will immed iately see the effect it has on th e view. In add ition, the m ug has
been centred by moving th e world 0.5 units dow n th e y axis of the camera.
Introduce a Scale statement to widen the hand le as shown. The mu g does not
look tall enough increase its height to 1.9 un its.
RIB
Example 3 - anyone for coffee?
Shaping Up 5 8
-
8/9/2019 Rman Booklet
40/120
Cylinder 1 0 1.5 360 Disk 0 1 360
yy
y
y
y
y
x x
x
x
x
x
Translate 0 0 1.5Cylinder 0.9 -1.4 0 360
Disk -1.4 0.9 360
Torus 0.95 0.05 0 180 360 Translate 0 1 -0.75Rotate 90 0 1 0Torus 0.6 0.1 0 360 360
The actions of the RIB statements u sed in th e construction of the coffee mug ,
examp le 3, are illustrated below. Unless otherwise ind icated , the z axis is
pointing u p. The surface being created is shown in the h eavier line weight andthe parameter(s) responsible for positioning the suface in the z direction are
shown in bold.
In the last diagram th e hand le has been w idened by app lying a scaling factor
to the x coordinate. It is left as an exercise for you to d etermine wh ere in the
script th e Scale 2 1 1 command should be inserted.
z
y
x
z
Shaping Up 5 9
3
5
7
1
4
2
6
Scale 2 1 1
Question: why is the scaling being applied
to the x axis when in this diagram it app ears
as if the z axis requires stretching?
-
8/9/2019 Rman Booklet
41/120
Shaping Up 5 10
#saucer.RIB#some tricky scalingDisplay "saucer" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 200 150 1
Translate 0 0 7Rotate -120 1 0 0Rotate 60 0 0 1
WorldBeginLightSource "pointlight" 1 "intensity" 45 "from" [2 -3 4]LightSource "ambientlight" 2 "intensity" 0.15
Surface "plastic"Color 0.5 0.5 1 #pale blue
Translate 0 0 0.5Scale 4.4 4.4 1
Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360Torus 0.45 0.05 0 360 360
WorldEnd
The pu rpose of this example is to show the effect of using scaling an d trans-
lation, as well as the importan ce of app lying th ese transformations in the
correct order. Ignoring the tran sformations for a mom ent, the combination of
the two sp heres and th e torus simply p rodu ces a hemi-spherical cup , 0.1
un its in thickness, with a round ed rim.
The effect of the Scale statement is to stretch the cup into a saucer-like
object, refer to the illustr ation on th e next page. The translation is opt ional in
that it d oes not change th e form of the saucer, only its position. How ever, it
makes sense to lift the saucer by an amou nt equ al to its radius so that it sits
on the xy plane, hence the translation of 0.5 un its in the z direction.
The widened rim of the saucer is du e to the thickness of the basic cup being
exaggerated by the scaling factorlike stretching a sheet of rubber. By ad just-
ing the d iameter of the inner sp here, and m aking the necessary changes to the
param eters of the torus, a wide var iety of rims can be created.
The basic cup can also be stretched v ertically into an object reminiscent of
an egg cupsee the next page. To create this object, x and y have been scaled
by 1, therefore they remain un changed, wh ile the height in th e z d irection has
been increased by 200%. To comp ensate for the scaling, the tran slation has
been increased from 0.5 to 1 unit ie. 2 x 0.5 = 1.
As an exercise, create an egg by scaling a sph ere, assign it an ap prop riate
colour an d p osition it in the egg cup .
RIB
Example 4 - the universal saucer
-
8/9/2019 Rman Booklet
42/120
Translate 0 0 0.5Scale 4.4 4.4 1
Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360Torus 0.45 0.05 0 360 360
no translation
Shaping Up 5 11
Translate 0 0 0.5Scale 4.4 4.4 1
Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360Torus 0.45 0.05 0 360 360
Translate 0 0 0.5Scale 4.4 4.4 1
Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360Torus 0.45 0.05 0 360 360
The effects of scaling and translation
no scaling or translation
both scaling and translation ap plied
Translate 0 0 1Scale 1 1 2
Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360Torus 0.45 0.05 0 360 360
y
y
x
x
y
x
y
x
now its an egg cup !
For reference the or iginal xy p lane BEFORE the transform ations w ere app lied
are shown in each example.
-
8/9/2019 Rman Booklet
43/120
Shaping Up 5 12
#eggcup with base.RIB#copying and pasting with instancingDisplay "eggcup" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 200 150 1
ObjectBegin 1Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360Torus 0.45 0.05 0 360 360
ObjectEnd
Translate 0 -.5 5Rotate -120 1 0 0Rotate 60 0 0 1
WorldBeginLightSource "pointlight" 1 "intensity" 25 "from" [2 -3 4]LightSource "ambientlight" 2 "intensity" 0.25
#Egg cup topColor .55 .17 .11 #dark brownSurface "wood"Translate 0 0 1.0Scale 1 1 2ObjectInstance 1
#Egg cup baseTranslate 0 0 -0.5Scale 1 1 0.25
Rotate 180 1 0 0ObjectInstance 1
WorldEnd
RIB
Example 5 virtually greenreusable geometry
The previous examp le illustrated an imp ortant p oint about 3D mod els; by
making a few m inor changes, to scaling for examp le, their geometry can form
the basis of a variety of secondar y models. A similiar principle can be app lied
within a single scene description. This example shows how several surfaces
can be collected together into a sing le retained object, and conveniently reused,
or instanced, many times. In th e context of a dr awing program this is like mak-
ing a group, then copying and pasting it repeatedly w ithin an illustration.
The intention to make an ob ject from a collection of surfaces is indicated to the
renderer by ObjectBegin/ObjectEnd. The n um ber following ObjectBegin
indentifies, or tags the collection for later use by a statem ent tha t places the
object in the wor ld, the nu mber itself has no oth er significance,
ObjectInstance tag
Unfortunately, transformations cannot be used between ObjectBegin an d
ObjectEnd. Instancing allows the renderer to work more efficiently and also
helps to avoid writing tediously long RIB files. Pay particular attention to the
next two p ages as they explain th e transformations used in this scene.
-
8/9/2019 Rman Booklet
44/120
The following line d rawings sh ow the effect of app lying th e transformations
used in example 5. At each stage, the coordinate system is represented by a
one un it grid, subdivided into quarters. To fully un derstand the action ofeach group of transformations, remember they are app lied,
in reverse sequence, and
with reference to the current coordinate systemshown as heavier lines.
The new coordina te system only becomes current when an object is created.
untransformed Scale 1 1 2 Translate 0 0 1 ObjectInstance 1
Shaping Up 5 13
Rotate 180 1 0 0 Scale 1 1 0.25 Translate 0 0 -0.5 ObjectInstance 1
Translate 0 0 1Scale 1 1 2ObjectInstance 1
RIB (fra gmen t)
Translate 0 0 -0.5Scale 1 1 0.25Rotate 180 1 0 0ObjectInstance 1
RIB (fra gmen t)
Visualising example 5
-
8/9/2019 Rman Booklet
45/120
In the last example, the base of the egg cup w as positioned an d p laced in th e
scene by a scaling followed by a tran slation.
The same effect can also be achieved by p lacing th e translation before the
scaling. H owever, simply reversing the two statements w ill not w ork. As the
draw ing below show s, the translation m ust be altered. In general it is better to
perform a scaling BEFORE a translation, as shown on the previous page.
Shaping Up 5 14
Rotate 180 1 0 0 Scale 1 1 0.25Translate 0 0 -2 ObjectInstance 1
-1
-2
Visualising example 5 continued
RIB (fra gmen t)
#Egg cup baseScale 1 1 0.25Translate 0 0 -2Rotate 180 1 0 0
ObjectInstance 1
-
8/9/2019 Rman Booklet
46/120
-
8/9/2019 Rman Booklet
47/120
happ ened in example 1, or reset as shown. Three surface shaders are used in
this example to give the effect of a carpet, wood and spatter. Their full
specifications, as documented by PIXAR, appear on the next three pages.Although the d etails of surface shading will be dealt with in an other section,
the d escriptions of each of the m aterials used here should give you enou gh
information to und ertake your own experiments. Most of the param eters use
values that ran ge from 0 to 1; the exceptions, at least for the m aterials used in
this example, are
wood "grain"
carpet "nap"
spatt er "sizes"
Experiment w ith some or all the param eters in ord er to app reciate the control
that each provides over the ap pearance of a surface. In the absence of pre-
compu ted im ages this is a trial and error p rocess. Three techniqu es can be
used to speed up rendering
use a higher ShadingRate, say 20, and opt ionally use
ShadingInterpolation smooth, to red uce the blotchiness of the image,
comment-out any surfaces that are not currently being adjusted.
ShadingRate is like a quality control ad juster ; low valu es of around 1 or 2
give excellent results w hile higher values like 20 or m ore provide rough and
ready snap shots. A high shad ing rate simply tells the renderer not to cal-
culate the colour value for every pixel but to sample the pixels at whateverrate has been set. The closest comparison to real world photography is
choosing a high sp eed film with a coarse grain emu lsion. Unfortunately, high
shading rates generate very pixelated images, see opposite. To reduce these
artefacts,
ShadingInterpolation "smooth"
can be used to tell the renderer to average-out, or interp olate, the p ixels
between the samples, otherwise it simply uses a constant colour. The state-
ment can be inserted immed iately after ShadingRate. Of course you may
wish to take adv antage of these image d efects to achieve a par ticularillustrative effect, in w hich case resetting ShadingInterpolation is optional. By
defau lt its set to "constant", hence the b locks of flat colour.
Bearing in m ind a PAL resolution video image constists of 442,368 pixels, the
careful u se of these statements can have a very significant effect on the speed
of rendering.
Shaping Up 5 16
-
8/9/2019 Rman Booklet
48/120
Shaping Up 5 17
"wood" "Ka" "Ks" "Kd" "roughness" "specularcolor" "grain" "swirl"
"swirlfreq" "c0" "c1" "darkcolor"
"Ka" 1 "Ks" 0.4 "Kd" 0.6 "roughness" 0.2"grain" 5 "swirl" 0.25 "swirlfreq" 1"specularcolor" [1 1 1]"darkcolor" [dependent on the surface colour]
"c0" [0 0 0] "c1" [0 0 1]
This shader creates a realistic-looking wood . The frequen cy of the w ood grain
can be changed with the grain param eter. The relative amou nt or am plitude of
the tur buent sw irl in the grain is controlled by the swirl param ater, and swir-
freq controls the frequency of this turbulence. Low values of swirl produce
more u niform looking w ood, wh ile low values of swirlfreq m ake the wood
app ear to be m ore knotty. Obviously these two param eters interact to a largeextent. You sh ould be careful not to set swirl too high or sw irlfreq too low or
the wood will become a jumbled m ess.
The wood is simu lated by creating a grain that is essentially composed of
differently coloured concentric cylinders around a central axis defined by the
two p oints c0 an d c1. This axis is the z axis by d efault. Note th at the or ientat-
ion of this axis can be var ied either by changing these two param eters or by
doing some tran sformations between th e call to the shader an d th e definition
of the geometry. Either one of these ap proaches may make more intu itive sense
in different applications.
The colour of the wood will norm ally consist of band s of d ifferent intensities of
the su rface colour. This is the most generally useful way of invoking the
shader. However, for special appearances this can be changed by changing the
darkcolor param eter, which controls the colour of the dark grain of the w ood.
The different intensity levels are actually levels of mixing betw een this colour
and the sur face colour, so setting the su rface colour to red and darkcolor to
wh ite will produce red wood with w hite grain and various shades in between.
The parameters Ka, Ks an d Kd have the u sual meanings of ambient, specular
and d iffuse reflective in tensities, respectively. roughness an d specularcolor
control the sharpness and colour of the specular highlight.
This shad er can have p roblems w ith aliasing.
Name
Defaults
Description
Bugs
Surface Shaders
-
8/9/2019 Rman Booklet
49/120
Shaping Up 5 18
"carpet" "Ka" "Kd" "scuff" "nap"
"Ka" 0.1 "Kd" 0.6 "scuff" 1 "nap" 5 "swirl" 1
This shader p rodu ces a carpeted su rface, comp lete with scuff-marks. The scuff
parameter controls the amount of scuff, or the relative frequency of intensity
variations. Higher values prod uce more frequent scuffing. nap describes the
shagginess of the carpet. Higher valu es make a m ore coarse-looking carpet.
The carpet shader makes a reasonable stab at anti-aliasing, so the actual grain
of the carpet fades away w ith distance.
There are no sp ecular reflections from rea l carp et (at least on a macroscopic
scale), so the only lighting parameters are Ka an d Kd, which have the usual
mean ings of ambient and d iffuse reflective intensities, respectively.
The way an ti-aliasing is perform ed can cause linear ar tifacts in some cases.
Name
Defaults
Description
Bugs
Surface Shaders continued
-
8/9/2019 Rman Booklet
50/120
"spatter" "Ka" "Ks" "Kd" "roughness" "specularcolor" "basecolor"
"spattercolor" "specksize" "sizes"
"Ka" 1 "Ks" 0.7 "Kd" 0.5 "roughness" 0.2"specularcolor" [1 1 1] "basecolor" [0.1 0.1 0.5] "spattercolor" [1 1 1]"specksize" 0.01 "sizes" 5
This shad er m akes objects look like blue camp cookware with wh ite paint
spatt ers. Actually, both the blue basecolor and the wh ite spattercolor can be
changed if you d esire.
The parameter specksize controls the size of the paint specks as you w ould
expect. However, there are a ran ge of sizes of paint specks controlled by theparam eter sizes. Lower (integer) values p rodu ce smaller and more u niform
specks. Higher values p rodu ce some larger blotches and specks of man y
different sizes.
The parameters Ka, Ks an d Kd, have the u sual meanings of ambient, specular
and d iffuse reflective in tensities, respectively. roughness an d specularcolor
control the sharpness and colour of the specular highlight.
This shad er can have p roblems w ith aliasing.
Name
Defaults
Description
Bugs
Surface Shaders continued
Shaping Up 5 19
-
8/9/2019 Rman Booklet
51/120
Shaping Up 5 20
RIB
Example 7a - making a compos ition the w rong way!
In this example the d escription of the saucer in example 4, show n in bold , has
been copied and pasted into the p art of the p revious RIB file that d escribed
the so-called table cloth. However, as the illustration on the next page shows,
something very strange has happen ed to the egg cup and egg.
#egg and cup.RIB#playing with materials
Display "eggncup.tiff" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 200 150 1ShadingRate 5
ObjectBegin 1Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360Torus 0.45 0.05 0 360 360
ObjectEnd
Translate 0 -0.7 4Rotate -120 1 0 0
Rotate 60 0 0 1
WorldBeginLightSource "pointlight" 1 "intensity" 20 "from" [2 -3 4]LightSource "pointlight" 1 "intensity" 8 "from" [2 3 2]LightSource "ambientlight" 2 "intensity" 0.15
Surface "plastic"Color 0.5 0.5 1 #pale blueTranslate 0 0 0.5Scale 4.4 4.4 1
Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360
Torus 0.45 0.05 0 360 360
#TopColor 0.55 0.17 0.11Surface "wood" "darkcolor" [0 0 0] "swirl" 0.25 "grain" 15 "swirlfreq" 1.5Translate 0 0 1.0Scale 1 1 2ObjectInstance 1
#EggSurface "spatter" "basecolor" [0.87 0.66 0.6] "sizes" 3 "spattercolor" [0.55 0.17 0.11]"Ks" 0.0 "Kd" 1Sphere 0.4 -0.4 0.4 360
#BaseColor 0.55 0.17 0.11Surface "wood" "darkcolor" [0 0 0] "swirl" 0.25 "grain" 15 "swirlfreq" 1.5Translate 0 0 -0.5Scale 1 1 0.25Rotate 180 1 0 0ObjectInstance 1
WorldEnd
-
8/9/2019 Rman Booklet
52/120
Shaping Up 5 21
Because the saucer is created w ith a scaled coordinate system all the surfaces
defined after this transform ation are likewise effected , hence the Ostrich egg
effect shown on the left, rather than the d esired comp osition shown on theright!
Clearly objects in a scene need to have their individual coordinate systems, or
object space, and their surface attributes kept, in a sense, private from each
other. In a RIB file there are tw o ways in w hich this can be achieved . In th e
following example the two principle objects, the saucer and the egg cup
holding an egg, are blocked together between the statements AttributeBegin/
AttributeEnd; these instru ct Rend erMan to localise (keep pr ivate) the
geometry AN D the su rface attributes of each object. If only the geometry
needs to be kept p rivate, and there are good reasons why this is sometimes
necessary, then the TransformBegin/TransformEnd statements are used
instead.
To d raw an analogy, ifWorldBegin/WorldEnd define the beginning and end
of an entire theatr ical play, then the AttributeBegin/AttributeEnd behave like
markers that separate one scene from another. Surfaces and polygons fulfill
the role of actors with each, either separ ately or in collections, being
assigned costum es represented by the attribu tes ofColor an d Surface.
In the im proved RIB script on the following page, ObjectInstance has been
used to insert the sau cer instead of declaring three separate surfaces. None-
theless, the composition still displays a modelling errornotice how the egg
cup partially penetrates the saucer. How ever, because they are group ed
together with the AttributeBegin/AttributeEnd statements, the egg cup and
egg can be raised by a single transformation (show n in bold p rint on the n ext
pag e). Because of the curvatu re of the saucer a similiar error accurs if the egg
cup is moved toward the rim. But even so, it is sometimes acceptable to allow
objects to interp enetrate as long as th e error is not too not icable.
The two m ethods of group ing objects together using AttributeBegin/End an d
TransformBegin/End are summ arised on page 24.
-
8/9/2019 Rman Booklet
53/120
Shaping Up 5 22
#egg cup and saucer.RIB
#combining objects the correct way!
Display "eggncup.tiff" "framebuffer" "rgb"Projection "perspective" "fov" 40Format 200 150 1ShadingRate 5
ObjectBegin 1Sphere 0.5 -0.5 0 360Sphere 0.4 -0.4 0 360Torus 0.45 0.05 0 360 360
ObjectEnd
Translate 0 -0.7 4Rotate -120 1 0 0
Rotate 60 0 0 1
WorldBeginLightSource "pointlight" 1 "intensity" 20 "from" [2 -3 4]LightSource "pointlight" 1 "intensity" 8 "from" [2 3 2]LightSource "ambientlight" 2 "intensity" 0.15
AttributeBegin #SaucerSurface "plastic"Color .5 .5 1Translate 0 0 0.5Scale 4.4 4.4 1ObjectInstance 1
AttributeEnd
Translate 0 0 0.1 #raise the egg cup and egg
AttributeBegin #Egg cup and eggColor 0.55 0.17 0.11Surface "wood" "darkcolor" [0 0 0] "swirl" 0.25 "grain" 15 "swirlfreq" 1.5Translate 0 0 1.0Scale 1 1 2ObjectInstance 1
#EggSurface "spatter" "basecolor" [0.87 0.66 0.6] "sizes" 3 "spattercolor" [0.55 0.17 0.11]"Ks" 0.0 "Kd" 1Sphere 0.4 -0.4 0.4 360
#BaseColor 0.55 0.17 0.11Surface "wood" "darkcolor" [0 0 0] "swirl" 0.25 "grain" 15 "swirlfreq" 1.5Translate 0 0 -0.5Scale 1 1 0.25Rotate 180 1 0 0ObjectInstance 1
AttributeEndWorldEnd
RIB
Example 7b - making a composition the correct way
-
8/9/2019 Rman Booklet
54/120
Shaping Up 5 23
WorldBegin
#lighting setup the same as before
Color 0.87 0.71 0.51Surface "carpet" "Kd" 0.8 "nap" 0.8 "scuff" 0.8TransformBegin #mug
Cylinder 1 0 1.5 360Disk 0 1 360Translate 0 0 1.5Cylinder 0.9 -1.4 0 360Disk -1.4 0.9 360Torus 0.95 0.05 0 180 360
#mug handleScale 2 1 1Translate 0 1 -0.75Rotate 90 0 1 0Torus 0.6 0.1 0 360 180
TransformEnd
Translate 0 0 -0.15 #lower the saucer
Color .65 .27 .21Surface "wood" "darkcolor" [0 0 0] "swirl" .25 "grain" 15 "swirlfreq" 1.5TransformBegin #Saucer
Translate 0 0 0.5Scale 4.4 4.4 1ObjectInstance 1
TransformEndWorldEnd
Example 7c - another way of grouping objects
RIB fra gmen t
This example is a combination of coffee mug.RIB an d saucer.RIB. It show s
how the surfaces and transformations that form an object can be grouped
together using TransformBegin/TransformEnd. Like the group s formed by
AttributeBegin/ AttributeEnd in the previous examp le, these new statements
keep the tran sformations for each object pr ivate, but th ey do so withou t
localizing colour and surface attributes. The image on th e left show s wh at
happ ens if the transformations previously applied to the h and le are not kept
pr ivate. The imag e on the righ t is the result of the RIB given above.
-
8/9/2019 Rman Booklet
55/120
Independ ent objects each w ith
their own shape, position AND
shading attributes.
Shaping Up 5 24
Summary of methods relating to the grouping of objects
WorldBegin
AttributeBegin(shape, transformation and shading informationrelating to the egg and egg cup)
AttributeEnd
AttributeBegin(shape, transformation and shading informationrelating to the saucer)
AttributeEndWorldEnd
WorldBeginColor 1 1 0 #YellowTransformBegin
(only shape and transformationinformation relating to a saucer)
TransformEnd
TransformBegin(only shape and transformationinformation relating to a saucer)
TransformEnd
TransformBegin(only shape and transformationinformation relating to a saucer)
TransformEnd
TransformBegin(only shape and transformationinformation relating to a saucer)
TransformEnd
TransformBegin(only shape and transformationinformation relating to a saucer)
TransformEnd
WorldEnd
Independ ent objects each with
their own shape and position, BUT
all sharing a common shad ing
attribute wh ich in this example
has been set to the colour yellow.
AttributeBegin
AttributeEnd
TransformBeginTransformEnd
-
8/9/2019 Rman Booklet
56/120
In this section the characteristics of a virtu al camera will be furth er refined to
include,
depth of field, and
motion blur.
In the previous chapters, RIB scripts have typically defined a camera with the
following statements,
Display "mypicture" "framebuffer" "rgba"Projection "perspective" "fov" 40Format 800 800 1
Such a camera, however, only approximates the behaviour of a real camera. In
pa rticular it acts like a pin-hole camera in th at it sharp ly focuses all parts of an
image. Real cameras are strictly limited in their ability to simultaneou sly focus
the images of objects placed at d ifferent distan ces in front of the lens this is a
ph ysical limitation that d epend s solely on the ratio of the d iameter of the
aperture of the cameras lens to its focal length. In photography this ratio is
called th e f-stop or f-number of a lens. This opt ical limitation is
aesthetically exploited by photograph ers wh en the foreground and / or the
background of a comp osition is d eliberately d efocused.
Real camer as are likewise un able to shar ply focus on objects in a scene if either
the camera is moving, particularly if it is hand -held, or if the scene, or par ts of
it, are in motion. To accomoda te wh at, in compu ter grap hics, is called m otionblur th e specification of a synthetic camera mu st includ e the idea of an image
being form ed ov er a finite period of time ie. as if using a shutter. The basic
virtual camera used so far has assum ed all motion is frozen by capturing an
instantaneous rep resentation of a synth etic scene.
If ph oto-realism is to be achieved in th e digital dom ain then similiar facilities
should be available to 3D comp uter gr aphics. By p roviding m echanisms to
introduce, what are in effect, digital versions of depth of field and motion
blur, RenderMan greatly im proves a designers ability to deliver ph oto-realistic
imagery. Interestingly, some real world photographic nuances are not available
in RenderMan, these includ e effects caused by,
lens flare,
optical defects such as astigmatism and chromatic aberration, and
the mu nd ane effects of dirty or scratched optics!
Because there is a slight d ifference in th e way field of vision (fov) is defined
in ph otography compared to Rend erMan, this section also provides some
examples of converting from on e system to th e other.
Overview
An Improved Camera 6 1
In this section the characteristics of a virtu al camera will be furth er refined to
include,
depth of field, and
motion blur.
In the previous chapters, RIB scripts have typically defined a camera with the
following statements,
Display "mypicture" "framebuffer" "rgba"Projection "perspective" "fov" 40Format 800 800 1
Such a camera, however, only approximates the behaviour of a real camera. In
pa rticular it acts like a pin-hole camera in th at it sharp ly focuses all parts of an
image. Real cameras are strictly limited in their ability to simultaneou sly focus
the images of objects placed at d ifferent distan ces in front of the lens this is a
ph ysical limitation that d epend s solely on the ratio of the d iameter of the
aperture of the cameras lens to its focal length. In photography this ratio is
called th e f-stop or f-number of a lens. This opt ical limitation is
aesthetically exploited by photograph ers wh en the foreground and / or the
background of a comp osition is d eliberately d efocused.
Real camer as are likewise un able to shar ply focus on objects in a scene if either
the camera is moving, particularly if it is hand -held, or if the scene, or par ts of
it, are in motion. To accomoda te wh at, in compu ter grap hics, is called m otionblur th e specification of a synthetic camera mu st includ e the idea of an image
being form ed ov er a finite period of time ie. as if using a shutter. The basic
virtual camera used so far has assum ed all motion is frozen by capturing an
instantaneous rep resentation of a synth etic scene.
If ph oto-realism is to be achieved in th e digital dom ain then similiar facilities
should be available to 3D comp uter gr aphics. By p roviding m echanisms to
introduce, what are in effect, digital versions of depth of field and motion
blur, RenderMan greatly im proves a designers ability to deliver ph oto-realistic
imagery. Interestingly, some real world photographic nuances are not available
in RenderMan, these includ e effects caused by,
lens flare,
optical defects such as astigmatism and chromatic aberration, and
the mu nd ane effects of dirty or scratched optics!
Because there is a slight d ifference in th e way field of vision (fov) is defined
in ph otography compared to Rend erMan, this section also provides some
examples of converting from on e system to th e other.
An Improved Camera
Overview
-
8/9/2019 Rman Booklet
57/120
An Improved Camera 6 2