renderman (introduction)

53
RenderMan (Introduction)

Upload: arion

Post on 22-Jan-2016

43 views

Category:

Documents


0 download

DESCRIPTION

RenderMan (Introduction). Objective. Understanding of graphics algorithms Rendering pipeline Understanding of Technical Director’s role Learning the Shading Language Notion of Shader. Lecture Outline. Computer graphical Image Synthesis RenderMan – A Brief History Using BMRT The RIB File - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: RenderMan (Introduction)

RenderMan(Introduction)

Page 2: RenderMan (Introduction)

Objective

Understanding of graphics algorithms Rendering pipeline

Understanding of Technical Director’s role Learning the Shading Language

Notion of Shader

Page 3: RenderMan (Introduction)

Computer graphical Image Synthesis

RenderMan – A Brief History

Using BMRT

The RIB File

The Shading Language

Writing a Shader

Lecture Outline

Page 4: RenderMan (Introduction)

Computer graphical Image Synthesis : Image Synthesis

Three routes to image synthesis

Page 5: RenderMan (Introduction)

Computer graphical Image Synthesis : Rendering

A renderer being fed a scene description

Page 6: RenderMan (Introduction)

Computer graphical Image Synthesis : Rendering

RenderMan converts RIB inputs into images

RIB: Renderman Interface Bytestream

Page 7: RenderMan (Introduction)

Computer graphical Image Synthesis : Rendering

Stages in a classical rendering pipeline

Object Space

World Space

Camera View

Clipping

Culling

Final Result

Page 8: RenderMan (Introduction)

The RenderMan History

Proposed by Pixar in 1989 Its design is based on

Lucasfilm’s REYES (Renders Everything You Ever Saw) in 1981

(Pixar is originally the computer division of Lucasfilm) Robert Cook’s Shade Trees [COOK84]

Since then RenderMan is referred as the industry standard of high-quality graphics production

Page 9: RenderMan (Introduction)

What is RenderMan?

An open specification – anybody can implement the standard Pixar RenderMan, BMRT, RenderDotC

A scenefile description for 3D rendering like PostScript is for 2D

Programmable shading language C Programming Interface

Can be a standalone program or called from RIB.

Page 10: RenderMan (Introduction)

What is RenderMan

Separation of Modeling and Rendering RenderMan serves as the interface.

Scene = Shape + Shading Two “languages”

• Geometry(Shape) - set of C subroutines

• Shading - a C-like language

Geometry code can be run directly, or output to RIB file

Shading code is compiled to byte-code The power of RenderMan is in the shading part

Page 11: RenderMan (Introduction)

Movies containing RenderMan-generated imagery

Page 12: RenderMan (Introduction)

RenderMan Interface

Page 13: RenderMan (Introduction)

RenderMan Interface

RenderMan Interface Bytestream (RIB): Geometry The scene description language (.rib) can be created by a C progra

m, generated by the modeler, or typed manually The scene description file defined the geometry and some renderin

g parameters

Shading Language (SL): Shading A skillful programmer develops the shader (.sl), a C-like program, to

control how a surface is shaded. It is then complied to intermediate code (.slo)

The intermediate shader code is interpreted to control the shading process

The .rib and .slo are fed to the renderer for rendering

Page 14: RenderMan (Introduction)

RenderMan Interface

RIB as an interface between modelers and renderers

Page 15: RenderMan (Introduction)

RIB File Structure

Page 16: RenderMan (Introduction)

Rendering program

RenderMan compliant renderer Pixar’s Photorealistic RenderMan (PRMan) Exluna’s BMRT, Entropy ART’s RenderDrive

Page 18: RenderMan (Introduction)

How to Install BMRT

Unpack the BMRT Distribution Choose a directory into which BMRT will be installed (e.g. “c:

\BMRT2.6”)

Set BMRT Environment Variables Variable: PATH Value:[…];C:\BMRT2.6\bin

(i.e., add C:\BMRT2.6\bin to the end of the current PATH value.) 

Variable: BMRTHOMEValue: C:\BMRT2.6\  Variable: SHADERS Value: C:\BMRT2.6\shaders

Page 19: RenderMan (Introduction)

How to Install BMRT

Testing BMRT Command cmd

• C:\> cd BMRT2.6\examples C:\BMRT2.6\examples\> Test rgl

• C:\BMRT2.6\examples\> c:\BMRT2.6\bin\rgl teapots.rib hit the esc key or q to close the window after it finishes rendering.• C:\BMRT2.6\examples\> c:\BMRT2.6\bin\rgl limbo.rib

Test slc• C:\BMRT2.6\shaders\> c:\BMRT2.6\bin\slc funkyglass.sl• C:\BMRT2.6\shaders\> c:\BMRT2.6\bin\slc screen_aa.sl• C:\BMRT2.6\shaders\> c:\BMRT2.6\bin\slc screen.sl

Test rendrib• C:\BMRT2.6\examples\> c:\BMRT2.6\bin\rendrib -d 16 shadtest.rib

– The -d option to rendrib will display the results directly to the screen – press the w key while over the window to write out a TIFF file – the esc key or q will quit and close the window

Test iv• C:\BMRT2.6\examples\> c:\BMRT2.6\bin\iv balls1.tif

Page 20: RenderMan (Introduction)

Using BMRT

Rendrib – the command line renderer Rendrib [flags] <filename>

• -d– Forces display to screen

– Put a number afterward and it will render in multiple passes

• -v – verbose. Tells you more about what is happening while you render.• -stats – displays some statistics after rendering about CPU usage, etc.

Slc – the shading language compiler Slc [flags] <filename>

• -dso compile to machine code• -o name output to specified name

Page 21: RenderMan (Introduction)

A Simple Scene

Making RIB # : comment ( 주석 ) Display

• Create a file “min.tiff”• Color information “rgb”• “file” write to “file”

– “framebuffer” on the screen

Projection• “perspective” projection

WorldBegin / WorldEnd• WorldBegin prepare to draw• WorldEnd the scene is finished

Transformation / Modeling• Translation z 축으로 2 만큼 이동• Sphere radius: 1, zmin: -1, zmax: 1, theta: 360

#min.rib - a minimal scene Display "min.tiff" "file" "rgb" Projection "perspective" WorldBegin

Translate 0 0 2 Sphere 1 -1 1 360

WorldEnd

Page 22: RenderMan (Introduction)

Transformation

Transformation Translate x y z Scale x y z Rotate angle x y z TransformBegin TransformEnd

# beginend.rib Display "beginend.tiff" "file" "rgb" Projection "perspective" WorldBegin # move everything back 2 units Translate 0 0 2 TransformBegin # Everything that follows is one unit left

Translate -1 0 0 Sphere 1 -1 1 360

TransformEnd TransformBegin # Everything that follows is one unit right

Translate 1 0 0 Sphere 1 -1 1 360

TransformEnd WorldEnd

Page 23: RenderMan (Introduction)

Color

ColorColor [ red green blue ] 0~1 AttributeBegin : 속성 설정 시작 AttributeEnd : 속성 설정 종료

# Display "beginend.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate 0 0 2

Color [ 1 0 0 ]

AttributeBegin

Translate -1 0 0

Color [ 1 1 0 ]

Sphere 1 -1 1 360

AttributeEnd

#This resets the colour back to red

AttributeBegin

Translate 1 0 0

Sphere 1 -1 1 360

AttributeEnd

WorldEnd

Page 24: RenderMan (Introduction)

Color

Opacity Opacity [ red green blue ]

0: Transparency ( 투명 )

1: Opaque ( 불투명 )

Display "opacity.tiff" "file" "rgb" Projection "perspective" #PixelSamples 3 3 WorldBegin #move everything back 2 units Translate 0 0 2 Color [ 1 0 0 ] AttributeBegin         Translate -0.25 0 0         Color [ 0 1 0 ]         Opacity [ 0.5 0.5 0.5 ]         Sphere 1 -1 1 360 AttributeEnd AttributeBegin         Translate 0.25 0 0 #        Opacity [ 0.3 0.3 0.3 ]         Sphere 1 -1 1 360 AttributeEnd WorldEnd

Page 25: RenderMan (Introduction)

Camera Setup

Camera Format : 이미지 크기 “fov”

• Field of View# fov.rib

Display "fov.tiff" "file" "rgb"

Format 640 480 1.0

Projection "perspective" "fov" [ 25 ]

# Projection "perspective" "fov" [ 90 ]

Translate 0 0 10

WorldBegin

        Sphere 2 -2 2 360

WorldEnd

Page 26: RenderMan (Introduction)

Blocks

WorldBegin, WorldEnd FrameBegin, FrameEnd frameno AttributeBegin, AttributeEnd TransformBegin, TransformEnd Stacking must always be balanced

AttributeBeginTransformBeginAttributeEndTransformEnd is not legal

Page 27: RenderMan (Introduction)

Simple Surface

Parametric Quadrics Sphere Cone Cylinder Disk Hyperboloid Paraboloid Torus

Page 28: RenderMan (Introduction)

Simple Surface

SphereSphere <radius> <zmin> <zmax> <sweep_angle>

# sweep.rib Display “sweep.tiff" “file" "rgb" Projection "perspective" WorldBegin Translate 0 0 4 Sphere 2 -2 2 270 WorldEnd

Page 29: RenderMan (Introduction)

Simple Surface

CylinderCylinder <radius> <zmin> <zmax> <sweep_angle>

# Cylin.rib

Display "Cylin.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate 0 0 7

Rotate 90 1 0 0

Cylinder 2 -3 3 270

WorldEnd

Page 30: RenderMan (Introduction)

Simple Surface

ConeCone <height> <radius> <sweep_angle>

# Cone.rib

Display "Cone.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate 0 -2.5 7

Rotate -90 1 0 0

Cone 5 2 90

WorldEnd

Page 31: RenderMan (Introduction)

Simple Surface

ParaboloidParaboloid <radius_at_zmax> <zmin> <zmax> <sweep_angl

e># Para.rib

Display "Para.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate 0 -0.5 1.5

Rotate 90 0 1 0

Rotate -90 1 0 0

Paraboloid 0.6 0.0 1.0 360

# Paraboloid 1.0 0.25 0.9 330

WorldEnd

Page 32: RenderMan (Introduction)

Simple Surface

HyperboloidHyperboloid <x1> <y1> <z1> <x2> <y2> <z2> <sweep_angle>

# Hyper.rib

Display "Hyper.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate 0 0 2.0

Rotate 90 0 1 0

Rotate -90 1 0 0

Hyperboloid 0.15 -0.8 -0.5 0.25 0.25 0.6 360

# Hyperboloid 0.4 1.0 -0.5 0.5 0.5 1.0 300

WorldEnd

Page 33: RenderMan (Introduction)

Simple Surface

TorusTorus <major_radius> <minor_radius> <start_angle> <end_angle> <sweep_angle>

# Torus.rib

Display "Torus.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate 0 0 1.5

# Rotate -120 1 0 0

Torus 0.5 0.25 0 360 360

# Torus 0.6 0.1 0 360 120

# Torus 0.55 0.35 0 100 360

WorldEnd

Page 34: RenderMan (Introduction)

Simple Surface

DiskDisk <height_along_z> <radius> <sweep_angle>

# Disk.rib

Display "Disk.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate 0 0 1.0

Disk 0 0.5 360

# Disk 0 0.7 270

WorldEnd

Page 35: RenderMan (Introduction)

Simple Surface

PolygonPolygon "P" [...... points..]

GeneralPolygon [ poly_vert# vert_hole1# vert_hole2# .....] “P” [....points...]

# GPolygon.rib Display "GPolygon.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate -0.5 -0.5 1.0 GeneralPolygon [4 3] "P" [ 0 0 0

1 0 0 1 1 0

0 1 0 0.1 0.1 0 0.9 0.1 0 0.5 0.9 0 ]

WorldEnd

# Polygon.rib

Display "Polygon.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate -0.5 -0.5 1.0

Polygon "P" [ 0 0 0

1 0 0

1 1 0

0 1 0 ]

WorldEnd

Convex Concave

Page 36: RenderMan (Introduction)

Simple Surface

PointsPolygonPointsPolygon [ face1_vert# face2_vert# …. ][ face1_index1 face1_index2 …. face2_index1 face2_index2 …. …. ]"P" [...... points..]

PointsGeneralPolygon [2 (face, hole) 1 (no hole) ….][ face1_vert# (face) face1_vert# (hole) face2_vert# (face) …. ][ face1_index1 face1_index2 …. face2_index1 face2_index2 …. …. ]"P" [...... points..]

# PPolygon.rib

Display "PPolygon.tiff" "file" "rgb"

Projection "perspective"

WorldBegin

Translate 0 0 1.5

Rotate -10 1 0 0

PointsPolygons

[3 3 3 3] # 4 faces, each with 3 verts, 12 total

[2 1 0 1 0 3 2 0 3 2 1 3] # indices of the 12 verts

# following is the vertex array with (x,y,z) pt

"P" [ 0.664 0.000 -0.469

0.000 -0.664 0.469

0.000 0.664 0.469

-0.664 0.000 -0.469 ]

WorldEnd

Convex Concave

Page 37: RenderMan (Introduction)

Patches

Patches Provide curved surface

Patch “type” “P” [...... points..] Type : bilinear , bicubic

Ordering of Points

# patch.rib

Display “patch.tiff" "file" "rgb"

Projection "perspective“ “fov” [20]

Translate -0.5 -0.5 3

WorldBegin

LightSource "ambientlight" 1

"intensity" [ 0.1]

LightSource "pointlight" 2

"from" [-2 2 -2]

"intensity" [ 7 ]

Color [ 1 0 0 ]

Surface "plastic"

Patch "bilinear" "P" [ 0 0 0

1 0 0

0 1 0

1 1 0]

WorldEnd

Page 38: RenderMan (Introduction)

Patches

Bilinear #curved.ribDisplay "curved.tiff" "file" "rgb"Projection "perspective" "fov" [ 20 ]Translate -0.5 -0.5 4WorldBegin LightSource "ambientlight" 1 "intensity" [ 0.1] LightSource "pointlight" 2 "from" [-2 2 -2] "intensity" [ 7 ]

Color [ 1 0 0 ]Surface "plastic"Patch "bilinear"

"P" [0 0 01 0 00.4 1 1 #MOVED BACK0.6 1 -1] #MOVED FORWARDS

WorldEnd

Page 39: RenderMan (Introduction)

Patches

Bicubic #cubic.ribDisplay "cubic.tiff" "file" "rgb"Projection "perspective" "fov" [ 30 ]Translate -0.5 -0.5 3WorldBegin LightSource "ambientlight" 1 "intensity" [ 0.1] LightSource "pointlight" 2 "from" [-2 2 -2] "intensity" [ 10 ]

Color [ 1 0 0 ]Surface "plastic"Rotate 40 1 0 0Patch "bicubic"

"P" [ 0 0 0 0.4 0 0 0.6 0 0 1 0 0 0 0.4 0 0.4 0.4 3 0.6 0.4 -3 1 0.4 0 0 0.6 0 0.4 0.6 -3 0.6 0.6 3 1 0.6 0 0 1 0 0.4 1 0 0.6 1 0 1 1 0]WorldEnd

Page 40: RenderMan (Introduction)

Lighting

Lighting Point light Distant light Spot light Ambient light

Page 41: RenderMan (Introduction)

Point light

Point light Pointlight creates a light that shines equally in all direction LightSource

• “pointlight” : 점광원 • “from” : 광원의 위치• “intensity” : 빛의 세기

광원과 물체의 거리에 따라 빛 감쇠 Surface

• 물체의 재질감표현• “plastic”: standard CGI shader

#pointlight.rib

Display "pointlight.tiff" "file" "rgb"

Format 640 480 1.0

Projection "perspective" "fov" [ 30 ]

Translate 0 0 5

WorldBegin

LightSource "pointlight" 1

"from" [ -2 2 -2 ]

"intensity" [ 7 ]

Surface "plastic"

Color [ 1 0 0 ]

Sphere 1 -1 1 360

WorldEnd

intensity [7] intensity [14]

Page 42: RenderMan (Introduction)

Illuminate

Illuminate Illuminate [0/1] [0/1] [0/1] …

• 광원 on/off

#illuminate.ribDisplay "illuminate.tiff" "file" "rgb"Projection "perspective" "fov" [20]Translate 0 0 10WorldBegin

LightSource"pointlight" 1"from" [4 3 -5]"intensity" [16]

LightSource"pointlight" 2"from" [-4 3 -5]"intensity" [16]

Surface "plastic"Color [ 1 0 0 ]

AttributeBegin Illuminate 1 1 Translate -0.5 0 0 Sphere 1 -1 1 360

AttributeEnd AttributeBegin

Illuminate 1 0 Translate 0.5 0 0 Sphere 1 -1 1 360

AttributeEndWorldEnd

Page 43: RenderMan (Introduction)

Distant light

Distant light LightSource

• “distantlight”

• “to” : 광원의 방향 거리에 상관없이 빛의 세기 일정

#distantlight.rib

Display "distantlight.tiff" "file" "rgb"

Projection "perspective" "fov" [ 30 ]

Translate 0 0 5

WorldBegin

LightSource "distantlight" 1

"to" [ 1 0 0 ]

"intensity" [ 1 ]

Color [ 1 0 0 ]

Surface "plastic"

Sphere 1 -1 1 360

WorldEnd

Page 44: RenderMan (Introduction)

Spot light

Spot light LightSource

• “spotlight”

• “from” : 광원의 위치 • “to” : 광원의 방향• “coneangle” : out cone

• “conedeltaangle” : inner cone

#spotlight.rib

Display "spotlight.tiff" "file" "rgb"

Projection "perspective" "fov" [ 30 ]

Translate 0 0 5

WorldBegin

LightSource "spotlight" 2

"from" [-2 2 -2]

"to" [ 0 0 0 ]

"intensity" [ 7 ]

"coneangle" [0.25]

"conedeltaangle" [0.05]

Color [ 1 0 0 ]

Surface "plastic"

Sphere 1 -1 1 360

WorldEnd

delta [0.05] delta [0.25]

Page 45: RenderMan (Introduction)

Ambient light

Ambient light LightSource

• “ambientlight” : 주변광 • “intensity” : 빛의 밝기• “color” [r g b] : 빛의 색깔

#spotambient.rib

Display "spotambient.tiff" "file" "rgb"

Projection "perspective" "fov" [ 30 ]

Translate 0 0 5

WorldBegin

LightSource "ambientlight" 1

"intensity" [ 0.1]

LightSource "spotlight" 2

"from" [-2 2 -2]

"to" [ 0 0 0 ]

"intensity" [ 7 ]

"coneangle" [0.25]

"conedeltaangle" [0.05]

Color [ 1 0 0 ]

Surface "plastic"

Sphere 1 -1 1 360

WorldEnd

Ambient Ambient & Spot light

Page 46: RenderMan (Introduction)

Shading Language

Many types of shaders are possible: Light source shaders Surface shaders Atmosphere shaders Volume shaders…etc.

We will discuss only the surface shaders.

Page 47: RenderMan (Introduction)

Standard Shaders

Standard Shaders Constant Matte Metal Plastic Painted plastic Displacement

Page 48: RenderMan (Introduction)

Constant

Constant “constant” : simplest surface

• Simpler than the default shader

Surface “constant”

#constant.rib

Display "constant.tiff" "file" "rgb"

Projection "perspective" "fov" [ 30 ]

Translate 0 0 5

WorldBegin

LightSource "ambientlight" 1

"intensity" [ 0.1]

LightSource "spotlight" 2

"from" [-2 2 -2]

"to" [ 0 0 0 ]

"intensity" [ 7 ]

"coneangle" [0.25]

"conedeltaangle" [0.05]

Color [ 1 0 0 ]

Surface "constant"

Sphere 1 -1 1 360

WorldEnd

Page 49: RenderMan (Introduction)

Matte

Matte Simulate the diffuse scattering

of light from a rough surface Surface “matte”

#matte.ribDisplay “matte.tiff" "file" "rgb"Projection "perspective" "fov" [ 30 ]Translate 0 0 5WorldBegin LightSource "ambientlight" 1 "intensity" [ 0.1] LightSource "spotlight" 2 "from" [-2 2 -2] "to" [ 0 0 0 ] "intensity" [ 7 ] "coneangle" [0.25] "conedeltaangle" [0.05]

Color [ 1 0 0 ]Surface “matte"Sphere 1 -1 1 360

WorldEnd

Page 50: RenderMan (Introduction)

Metal

Metal Metal Objects

• Reflect bright light, creating

a sharp specular highlight

Surface “metal”

#metal.ribDisplay “metal.tiff" "file" "rgb"Projection "perspective" "fov" [ 30 ]Translate 0 0 5WorldBegin LightSource "ambientlight" 1 "intensity" [ 0.1] LightSource "spotlight" 2 "from" [-2 2 -2] "to" [ 0 0 0 ] "intensity" [ 7 ] "coneangle" [0.25] "conedeltaangle" [0.05]

Color [ 1 0 0 ]Surface “metal"Sphere 1 -1 1 360

WorldEnd

Page 51: RenderMan (Introduction)

Plastic

Plastic Combine both a diffuse and

a specular component Surface “plastic”

# plastic.ribDisplay “plastic.tiff" "file" "rgb"Projection "perspective" "fov" [ 30 ]Translate 0 0 5WorldBegin LightSource "ambientlight" 1 "intensity" [ 0.1] LightSource "spotlight" 2 "from" [-2 2 -2] "to" [ 0 0 0 ] "intensity" [ 7 ] "coneangle" [0.25] "conedeltaangle" [0.05]

Color [ 1 0 0 ]Surface “plastic"Sphere 1 -1 1 360

WorldEnd

Page 52: RenderMan (Introduction)

Painted plastic

Painted plastic Surface “paintedplastic” “texturename” : 텍스춰

#painted.ribDisplay "painted.tiff" "file" "rgb"Projection "perspective" "fov" [ 30 ]Translate 0 0 5WorldBegin LightSource "ambientlight" 1 "intensity" [ 0.1] LightSource "spotlight" 2 "from" [-2 2 -2] "to" [ 0 0 0 ] "intensity" [ 7 ] "coneangle" [0.25] "conedeltaangle" [0.05]

Color [ 1 0 0 ]Surface "paintedplastic"

"texturename" ["swirl.tiff"]Rotate 90 1 0 0Sphere 1 -1 1 360

WorldEnd

swirl.tiff

Page 53: RenderMan (Introduction)

Displacement

Displacement Surface “plastic” Displacement “dented”

• In addition to a surface shader

#dented.ribDisplay "dented.tiff" "file" "rgb"Projection "perspective" "fov" [ 30 ]Translate 0 0 5WorldBegin LightSource "ambientlight" 1 "intensity" [ 0.1] LightSource "spotlight" 2 "from" [-2 2 -2] "to" [ 0 0 0 ] "intensity" [ 7 ] "coneangle" [0.25] "conedeltaangle" [0.05]

Color [ 1 0 0 ]Surface "plastic"Displacement "dented"Sphere 1 -1 1 360

WorldEnd