RenderMan - PowerPoint PPT Presentation

1 / 115
About This Presentation
Title:

RenderMan

Description:

Commercial Packages. RenderMan. Rendering Overview. Application Program ... Building blocks from which real objects are built. Don't have much inherent visual appeal ... – PowerPoint PPT presentation

Number of Views:171
Avg rating:3.0/5.0
Slides: 116
Provided by: icg76
Category:

less

Transcript and Presenter's Notes

Title: RenderMan


1
RenderMan
  • Jae Woo Kim
  • Doctoral Student, Institute for Computer Graphics
  • The George Washington University

2
The Goal of Today
3
What is RenderMan
  • API for graphics rendering
  • Designed by Pixar in 1988
  • Photosurrealistic Rendering
  • Used in many movies with digital effects
  • Shading Language
  • Flexibility for complex digital effects
  • Many RenderMan compliant Renderers

4
RenderMan compliant Renderers
  • PhotoRealistic RenderMan (PRMan)
  • by Pixar
  • 5,000 per cop
  • Blue Moon Rendering Tools (BMRT)
  • Made by Dr. Larry Gritz
  • Maintained by Exluna Inc.
  • Free for non-commercial use ( until last year I
    guess )

5
Comparison RenderMan vs. OpenGL / DirectX
RenderMan OpenGL/DirectX
Photorealism Reasonable quality
Offline rendering Immediate rendering
Flexible shading Hardware shading
Many compliant renderers Many hardware implementations
6
RenderMan vs Commercial packages
RenderMan Commercial Packages
Both are for photorealistic rendering Both are for photorealistic rendering
API Full modeling/rendering /animation package
Flexible shading Shading provided by the packages
7
Rendering Overview
Application Program
RenderMan compliant Renderer
Scene Description (RIB format)
Shading Requests / Results
Shading Requests / Results
User-defined Shading Modules
Standard Shading Modules
8
Application Program
  • All API calls starts with Ri prefix
  • All API calls generate RIB(RenderMan Interface
    Bytestream) output

RiAttributeBegin () RiTranslate (0.0, 14.0,
-8.3) RiSufrace (plastic, RI_NULL) RiSphere
(1.0, -1.0, 1.0, 360.0, RI_NULL) RiAttributeEnd
()
AttributeBegin Translate 0.0, 14.0, -8.3 Sufrace
plastic Sphere 1 1 1 360 AttributeEnd
RiAttributeBegin () RiTranslate (0.0, 14.0,
-8.3) RiSufrace (plastic, RI_NULL) RiSphere
(1.0, -1.0, 1.0, 360.0, RI_NULL) RiAttributeEnd
()
AttributeBegin Translate 0.0, 14.0, -8.3 Sufrace
plastic Sphere 1 1 1 360 AttributeEnd
9
BMRT
  • Most widely used public domain RenderMan
    compliant renderer
  • Two versions of renderer
  • rgl previewer based on OpenGL
  • rendrib Photorealistic rendering with ray
    tracing / radiosity
  • Input RIB stream
  • Output image files or framebuffer

10
How to Install BMRT
  1. Remove old version
  2. Unpack BMRT distribution
  3. Set BMRT environment variables
  4. Test BMRT

11
Set MBRT Environment Variables
  1. Right click, select properties
  2. Select Advanced tab
  3. Click Environment Variables
  4. Set variables

My Computer
Variable Name Variable Value
PATH C\BMRT2.6\bin
BMRTHOME C\BMRT2.6\
SHADERS C\BMRT2.6\shaders 
12
The first very simple program
13
Listing 2.1
Geometry
Light
Surface property
14
Program Structure
RiBegin() //Initialize RenderMan Interface
RiLightSource("distantlight",RI_NULL )
RiWorldBegin()
RiSurface("constant", RI_NULL )
RiPolygon( 4, RI_P, (RtPointer) square, RI_NULL
)
RiWorldEnd()
RiEnd() // End!!!
15
Define a polygon
RiPolygon( 4, RI_P, (RtPointer) square, RI_NULL )
Last argument Terminating token
The number of vertices
Token-value pair An array of points giving
positions in 3D space
RtPoint square4 .5,.5,.5
,-.5,.5,.5, -.5,-.5,.5,.5,-.5,.5
16
Define Surface Property
RiSurface("constant", RI_NULL )
RiPolygon( )
constant matte metal plastic
Surface shaders next week!
17
Define a light source
RiLightSource("distantlight",RI_NULL )
Ambientlight Distantlight Pointlight spotlight
Light source shaders also next week!!
18
The second very simple program
19
Listing 2.2
Color
Translation
Rotation
Perspective projection
20
Projection and Color
RiProjection( "perspective", RI_NULL )
perspective orthographic
static RtColor Color .2, .4, .6
R
G
B
RiSurface( ) RiColor(Color) RiPolygon( )
21
Scope of Graphics Environment
RiSurface( ) RiColor(Color) RiPolygon(
) RiPolygon( ) RiColor(Color) RiPolygon(
)
  • Affects all objects after it
  • Modifies the previous attribute

22
Graphics Environment
Attributes of objects
  • Affects all objects after it
  • Modifies the previous attribute (not
  • for the transformations)
  • Called before the object declaration
  • Sticks to that object
  • Default values (not for light sources)

Transformations Color Light sources Surface
properties Etc.
23
Geometric Transformations
x
y
z
RiTranslate( 0.0, 0.0, 1.0 )
Specify the motion along the x, y, z axes
respectively
RiRotate( 40.0, -1.0, 1.0, 0.0 )
A point in 3D space
Amount of rotation In degrees
Axis of rotation
Left handed rotation!!!
24
The Order of Geometric Transformations
RiTranslate() ? RiRotate()
RiRotate() ? RiTranslate()
25
Geometric transformations accumulated!
A
B
C
D
RiTranslate(-0.3,0.0,0.0) Object A
RiTranslate(-0.1,0.0,0.0) Object
B RiTranslate(0.1,0.0,0.0) Object
C RiTranslate(0.3,0.0,0.0) Object D
0.1
0.3
- 0.1
- 0.3
0
- 0.3
- 0.4
26
The third very simple program
27
Six rectangles
28
Declare a Cube (1)
A cube consists of six rectangles, so create six
rectangles (Listing 2.3)
Near, far, left, right, bottom, top defined in a
function UnitCube( )
Problem Readability Difficult to read and
understand
29
Declare a Cube (2)
To use previously defined, simpler objects to
createmore complex ones
Cube is nothing but a set of squares in different
positions and orientation
Therefore, create six identical squares, and then
transform each square to be located appropriate
position in 3D space
Click me Listing 2.5
30
Declare Cube
Square 1 / RiPolygon( ) / Rotate 90
degree / RiRotate( ) / Square 2 Rotate 90
degree Square 3 Rotate 90 degree Square 4
Square 4
Square 3
Square 1
Square 2
31
Save and Restore Geometric Transformations
Save current transform.
RiTransformBegin() Square 1 Square 2
rotated Square 3 rotated Square 4
rotated RiTransformEnd() RiTransformBegin()
Square 5 RiTransformEnd() RiTransformBegin(
) Square 6 RiTransformEnd()
Accumulated
Restore current transform. Accumulated transform
cleared!!
32
The fourth program a little complicated ?
33
(No Transcript)
34
Cubes
  • A number of small cubes
  • R, G, B values of the cube vary with x, y, z
    coordinates
  • Near-lower-left corner is black, far-upper-right
    corner is
  • white
  • Each minicube given a color appropriate to its
    position
  • Inner loop of ColorCube( ) cycles n times
    through x, y,
  • z creating unit cubes, scaling them
    appropriately, then
  • translating them into position

35
Save and restore attributes
  • RiAttibuteBegin( ), RiAttributeEnd( )
  • Save and restore all the attributes of the
    graphics environment
  • Not only geometric transformations

RiAttributeBegin()
RiTransformBegin()
Transformations
Attributes
Objects
Objects
RiAttributeEnd()
RiTransformEnd()
36
Algorithm
Loop x 0 to n-1 Loop y 0 to n-1 Loop z
0 to n-1 Set color values
RiTransformBegin() Transformations
Scale Call UnitCube()
RiTransformEnd()
Listing 2.6
37
Primitive Surfaces
Everything visible in a scene is ultimately
composed of surfaces
  • Quadric Surfaces Defined by quadric equations
    in two
  • dimensional space
  • Polygonal SurfacesBoundaries are given by a
    connected
  • series of line segments
  • Parametric Surfaces Free form polynomial curved
    surfaces

38
Primitive Surfaces (I) Quadric Surfaces
39
Sphere
Cylinder
Cone
Torus
Paraboloid
Hyperboloid
40
Quadric surfaces
Finite curve in two dimensions is swept in
three-dimensional space about one axis to create
a surface
Sphere
Circle
Torus
Line segment, one end lying on the axis of
rotation
Cone
Cylinder
A line segment parallel to the axis
Generalization of a line segment, By rotating an
arbitrary line segment
Hyperboloid
Paraboloid
Paraola y x2
41
Sphere
RiSphere(0.5, -0.5, 0.5, 360.0, RI_NULL)
RiSphere(radius, zmin, zmax, thetamax,
RI_NULL)
42
Cone
RiCone(1.0, 0.5, 360.0, RI_NULL)
RiSphere(height, radius, thetamax,
RI_NULL)
43
Cylinder
RiCylinder(0.5, -0.5, 0.5, 360.0,
RI_NULL) RiCylinder( radius, zmin, zmax,
thetamas, Parameterlist )
44
Hyperboloid
RiHyperboloid(hyperpt1, hyperpt2, 360.0,
RI_NULL) RiHyperboloid(point1, point2,
thetamax, parameterlist)
45
Paraboloid
RiParaboloid(0.5, 0.0, 0.9, 360.0,
RI_NULL) RiParaboloid(rmax, zmin, zmax,
thetamax, parameterlist)
46
Torus
RiTorus(.4, .15, 0.0, 360.0, 360.0,
RI_NULL) RiTorus(majorrad, minorrad, phimin,
phimax, parameterlist)
47
Disk
RiDisk(height, radius, thetamax, parameterlist)
48
Primitive Surfaces (II) Polygons
49
Polygons
  • A simple, easy-to use class of surface
  • Defined by boundary, given as an ordered series
    of vertices
  • Square in Listing 2.x

RtPoint square4 .5,.5,.5
,-.5,.5,.5, -.5,-.5,.5,.5,-.5,.5 RiP
olygon( 4, RI_P, (RtPointer) square, RI_NULL )
50
How to Use RIB Models
RiWorldBegin () RiSurface ("matte", RI_NULL)
RiReadArchive("bench.rib", RI_NULL,
RI_NULL) RiWorldEnd()
51
teapot.rib
52
trashcan.rib
53
column.rib
54
bench.rib
55
pen.rib
56
2nd Day
57
The goal of Today
58
Geometric Transformations and Hierarchical
Modeling
59
Geometric Transformations
60
Basic geometric transformations in RenderMan
  • RiTranslate( dx, dy, dz )
  • RiRotate( angle, dx, dy, dz )
  • RiScale( sx, sy, sz)
  • RiSkew( angle, dx1, dy1, dz1, dx2, dy2, dz2 )

61
Scale
RiScale( 0.2, 0.2, 0.2)
1.0
0.2
62
Skew
RiSkew( 45.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0 )
63
General Linear Transformation
RiConcateTransform( transform ) RiIdentity() RiTra
nsform( transform ) RtMatrix transform
RiScale( s1, s2, s3 )
RiConcateTransform( t )
RtMatrix t s1, 0.0, 0.0, 0.0, 0.0, s2, 0.0,
0.0, 0.0, 0.0, s3, 0.0, 0.0, 0.0, 0.0, 1.0
64
Concatenation of transformation
  • RiConcatTransform()
  • Concatenates transformation specified by the
    transform matrix onto the current transformation
  • RtMatrix is a 4 x 4 homogeneous transformation
    matrix of RtFloat values
  • Row major order

65
Clearing the current transformation
  • RiIdentity()
  • When it is necessary to define an object directly
    in world space
  • To reset the current transformation
  • May be enclosed in a transform block

66
Example
RiWorldBegin() RiConcatTransform( t1 )
Object1 RiConcatTransform( t2 ) Object2
RiTransformBegin() RiIdentity()
RiConcatTransform( t3 ) Object3
RiTransformEnd() RiConcatTransform( t4 )
Object4 RiWorldEnd()
67
More general transformation
  • Replaces the current transformation with the
    transformation specified by the transform matrix
  • RiTransform( transform )
  • Equivalent to

RiIdentity() RiConcatTransform( transform
) RtMatrix transform
68
Hierarchical Modeling
Combine simple objects into more complex ones
Conceptual convenience to think of a cube instead
of this square and that square and that square
69
Why Hierarchical Modeling?
Quadric Polygonal Parametric
Dont have much inherent visual appeal
Building blocks from which real objects are built
Object
A set of surfaces grouped together
Treated as a single entity for purposes of
shading, motion, duplication, or assembling other
objects
70
How to implement objects
RiAttributeBegin() Attribute setting
Primitive surfaces RiAttributeEnd()
OR
RiTransformBegin() Transformations
Primitive surfaces RiTransformEnd()
To avoid the waste of efforts
71
Hierarchical Model
Body Upper_arm1 Lower_arm1
Upper_finger1 Lower_finger1
Upper_finger2 Lower_finger2
Upper_finger3 Lower_finger3
Upper_arm2 Lower_arm2
Upper_finger4
72
RiAttributeBegin() Attributes Upper_arm1
RiAttributeBegin() Attributes
Lower_arm1 RiAttributeBegin()
Attributes Finger1 RiAttributeEnd()
RiAttributeBegin() Attributes
Finger2 RiAttributeEnd()
RiAttributeBegin() Attributes
Finger3 RiAttributeEnd()
RiAttributeEnd() RiAttributeEnd()
  • Graphics environment stack,
  • Different attributes for each part
  • Local coordinate system
  • Represent tree structure

73
Solid Modeling
74
Constructive Solid Geometry
  • The ability to use one object to modify the shape
    of another object
  • Example) a drilled machine part undrilled part
    a cylinder removed from it
  • Defines an object by applying set operators to
    the points in space inside other objects
  • Combination of primitives
  • Union
  • Intersection
  • Difference

75
Constructive Solid Geometry
RiSolidBegin(RI_PRIMITIVE) Sphere 3
cylinders RiSolidEnd()
RI_PRIMITIVE RI_UNION RI_INTERSECTION RI_DIFFERENC
E
76
Why constructive solid geometry??
  • Very difficult to represent using polygonal,
    quadric, and parametric models

77
Combination of Primitives (Program Solid)
78
Difference(Program Bowling)
79
Object Duplication
  • Object may be gathered into an independent
    description
  • RiObjectBegin() RiObjectEnd()
  • A program can duplicate or instance the
    description with a single routine call

80
Example
Cube RiObjectBegin() UnitCube() RiObjectEnd
RiAttributeBegin() Attributes
RiObjectInstance(cube) RiAttributeEnd()
81
Lighting and Shading
82
What ??
  • How to manipulate the appearance of objects
  • How to create and position light sources
  • How to color surfaces with something other than a
    flat color
  • Change in emphasis, from shape to shading

83
Information required
  • To calculate the color of any surface point
  • Object must be placed in a scene
  • Surface properties
  • Light sources for illuminating the object
  • Camera position
  • Atmosphere (e.g., smog )

84
Shading Pipeline
  • Illumination
  • Determines intensity and color of light
  • From various sources
  • Reflection / Transmission
  • Simulates interaction of light with surface
    material
  • Calculates intensity and color of reflected light
  • Atmospheric effects
  • Modification of lights color as it travels from
    object to viewer
  • Perhaps by particles in the atmosphere

85
Shading Pipeline
(1)
Light source
  1. Light source shaders
  2. Surface shaders
  3. Volume shaders

(3)
(2)
Camera or Eye
Surface
86
Shaders
Application Program
RenderMan compliant Renderer
Scene Description (RIB format)
User-defined Shading Modules
Standard Shading Modules
Shaders
87
Shaders
  • Programmed procedure
  • Written in RenderMan Shading Language
  • Invoked at realtime
  • Controls part of shading calculation
  • Two types of shaders
  • Built-in shaders (point light source, distant
    light source, plastic surface, matte surface,
    etc.)
  • User-defined shaders

88
Using Shaders
  • Several instances of light sources
  • There may be several light sources in a scene
  • Each with different color, intensity, position
  • Different shaders may use distinct instances of
    the same shader
  • Current instance
  • Part of graphics environment like surface color
  • Default values for each unassigned instance
    variable are provided by the shader

89
Environment variables used by shaders
  • Shaders use
  • Instance variables
  • Certain elements of graphics environment (color
    and opacity)
  • RiColor( Cs ), RtColor Cs
  • RiOpacity( Os ), RtColor Os
  • Changes current surface color and opacity in the
    graphics environment
  • Examples
  • completely transparent surface has opacity 0 in
    all channels
  • completely opaque surface has opacity 1 in all
    chanells
  • A colored filter would have different values in
    each channel

90
Light Source Shaders
91
Light source shaders
  • Calculate intensity, color, direction of light
    source to a point on a surface
  • RtLightHandle RiLightSource( name,
    parameterlist )
  • Adds new light source to a scene
  • By creating an instance of shader identified by
    name
  • RtLightHandle may be used later to turn the light
    on and off
  • Only light source shaders have multiple instances
    available at the same time (do not replaced but
    added )

92
Switching a light on and off
  • Why turn on and off??
  • Light sources remain, once they are created
  • RiIlluminate( light, onoff )
  • RtLightHandle light
  • RtBoolean onoff / RI_TRUE RI_FALSE /
  • The state of light source is part of graphics
    environment
  • The list of light source is maintained outside of
    the graphics state
  • But the state of each light is part of the
    graphics state

93
Predefined Light Sources
  • Predefined Light sources
  • Ambient light source
  • Distant light source
  • Point light source
  • Spotlight light source
  • No default light source
  • So light sources must be declared explicitly
  • Or use a constant surface shader
  • Requires no light source

94
Ambient Light
RiLightSource( ambientlight,
intensity, intensity,
lightcolor, color, RI_NULL )
RtFloat intensity RtColor color
  • Distributes light uniformly throughout space in
    all directions
  • So, throws the same light on every surface
    regardless of the
  • surface positions and orientations
  • Default values, intensity (1.0), color (maximum
    white)

95
Ambient Light, Intensity 1.0
Ka1.0
Ka0.8
Ka0.6
Ka0.4
Ka0.2
Ka0.1
96
Distant Light
RiLightSource( distantlight,
intensity, intensity,
lightcolor, color, from,
from, to, to,
RI_NULL ) RtFloat intensity RtColor
color RtPoint from, to
  • Flows light uniformly in space in one direction
  • Surface of like orientation receive the same
    amount of light
  • independent of location
  • However, surfaces of different orientation are
    illuminated
  • differently
  • Default from ( 0, 0, 0 ), to ( 0, 0, 1 )

97
Distant Light, Intensity 1.0
Kd1.0 Ks1.0
Kd0.8 Ks1.0
Kd0.6 Ks1.0
Ka0.4 Ks0.5
Ka0.2 Ks0.5
Ka0.1 Ks0.5
98
Point Light
RiLightSource( pointlight,
intensity, intensity,
lightcolor, color, from,
from, RI_NULL ) RtFloat
intensity RtColor color RtPoint from
  • Distributes light through space from a single
    point
  • Shines evenly in all directions
  • Intensity of light falls off with the square of
    the distance
  • Default from ( 0, 0, 0 )

99
Point Light, Intensity 1.0, at (0.0, 0.0, -0.5)
100
Spotlight
RiLightSource( spotlight, intensity,
intensity, lightcolor, color, from, from,
to, to, coneangle, coneangle,
conedeltangle, conedeltangle,
beamdistribution, beamdistribution, RI_NULL
) RtFloat intensity RtColor color
RtPoint from, to RtFloat coneangle,
conedeltangle, beamdistribution
  • A light source with both position and direction
  • Simulates a cone of light emitted from one point
    from toward
  • another point to
  • Intensity falls off exponentially with angle
    from the center of cone

101
Point Light, Intensity 1.0, from (0.0, 0.0,
-0.5) to (0.0, 0.0, 0.0)
102
Altogether!!
103
Surface Shaders
104
Surface Shaders
  • To determine the color of light reflecting from a
    point on a surface
  • Surface shading process
  • The light arriving (obtained from light source
    shader)
  • The nature of the surface
  • The character of the surface
  • Shader ( e.g., specular (shiny) )
  • Shaders instance variables (shininess controlled)

105
Elements of surface shading
  • Used information
  • The direction, color and intensity of the
    arriving light
  • Color of the surface (RiColor())
  • Opacity of the surface
  • The orientation of the surface
  • Viewing direction

106
Color of reflections
  • Determined by light color surface color
  • Surface Color
  • Gives the proportion of red, green or blue that
    surface reflects

Example) Light 1.0, 1.0, 1.0 ? Surface color
appears
107
Types of reflection
  • Ambient, diffuse, specular reflections
  • The principal difference between the shaders is
    in how they handle those three components
  • The weight they give to each

108
Example
Constant
matte
plastic
paintedplastic
shinymetal
metal
109
Shaders
  • User Defined Shaders
  • slc myshader.sl
  • myshader.sl
  • How to use existing shaders
  • Just name the shaders in shaders directory!
  • RiSurface(shader_name, parameterlist)

110
Examples
brick
funkyglass
ceramic
greenmarble
plank
screen
111
Rendering
  • program_name gt xxx.rib
  • rgl xxx.rib
  • rendrib d 16 xxx.rib
  • rendrib xxx.rib
  • iv xx.tif

112
Further Studies
/BMRT2.6/examples
113
Programming Assignment
  • Draw a interesting, beautiful, wonderful,
    fantastic, artistic image or images
  • Put some quadric and polygonal models
  • Put some pre-existing models on the web
  • Transform them to make the scene more interesting
  • Use some light sources
  • Use some shaders including the existing ones

114
Example of assignment
Submitted by Pixar ?
115
Resources
  • Upstill, RenderMan Companion, 1989, ISBN
    0201508680
  • Apodaca and Gritz, Advanced RenderMan, 2000, ISBN
    1558606181
  • SIGGRAPH Course Note on RenderMan and more _at_
    course webpage
Write a Comment
User Comments (0)
About PowerShow.com