RenderMan for Artist 02 – .rib file Architecture

18  12  Download (0)

전체 글

(1)

RenderMan For Artists #02

Wanho Choi

(wanochoi.com)

.rib file structure

(2)

(Review) REYES Algorithm

RenderMan renders micropolygons!

patch primitive sub-patches split

a sub-patch four corners of a micropolygonmicropolygon grid dice

micropolygon grid bust

individual

micropolygons sampling micropolygons at sub-pixel locations

(3)

(Review) RenderMan Pipeline

Application Specific Code RenderMan C API .rib file RenderMan compliant renderer image file compiled shader shader compiler .sl file Maya 3DS Max SoftImage|XSI Houdini Text Editor RenderMan Interface PRMan AIR 3Delight Aqsis RenderDotC image Modeling

Programs RenderingPrograms

.rib image PRMan Pixie 3Delight Aqsis RenderDotC prman rndr renderdl aqsis renderdc BMRT rendrib .sl PRMan Pixie 3Delight Aqsis RenderDotC shader sdrc shaderdl aqsl shaderdc BMRT slc PRMan Pixie 3Delight Aqsis RenderDotC .slo .sdr .sdl .slx .dll, .so BMRT .slc

(4)

RIB File Structure

The RIB format is formally defined in the

RiSpec

(RenderMan Interface Specification).

Scene descriptions (objects, lights, camera, …) are encoded as RIB files according to RiSpec.

In most RIB files, the RIB format version is specified at the top of the RIB file. (ex) version 3.04

RIB file is a

metafile

.

RIB can be regarded as a set of commands for RenderMan to execute.

If some essential information are absence, RenderMan uses the default settings.

RIB file can be generated

with 3D animation packages (Maya, 3DS Max, Houdini, …).

with programming interface (C/C++, Python, Java, …)

by hand using text editors (Notepad, Wordpad, vi, …)

A new RIB can be generated from existing once by cutting and pasting sections of them.

Whitespace

(tabs, newline characters, blank) are ignored.

The character “#”

is used to precede comments.

RenderMan ignores everything starting with a # till the end of the line containing it.

In RIB files,

no forward referencing

is allowed.

You cannot mention something first and then provide a definition for it later in the file.

The camera parameters and image options must come before scene definition.

Lights, materials and transforms must come before objects.

Translate 0 0 5 Sphere 1 -1 1 360 Translate0 0 5 Sphere 1 -1 1 360 Translate 0 0 5 Sphere 1 -1 1 360 Translate 0 0 5 Sphere 1 -1 1 360

(5)

Coordinate System

Left handed camera coordinate system

The origin at the imaging plane

X-axis to the right

Y-axis up

Z-axis “into” the screen

When the thumb of the left hand is pointed along the axis from the origin,

the fingers curl to point in the direction of positive rotation.

X

Y

(6)

Disk Examples

A Minimal RIB file

Image resolution: 640 x 480

Orthographic projection

A matte white surface shader which does not require light sources

A light located where the camera is and facing where the camera faces

Draw a disk

A quadric is always declared with its

center at the origin

.

If you want the object to be moved to someplace else,

you have to give the appropriate transformation first, then declare the geometry.

Move the disk

Display “result.tiff” “file” “rgb”

WorldBegin WorldEnd

Display “result.tiff” “file” “rgb”

WorldBegin

Disk 1 0.5 360

WorldEnd

Display “result.tiff” “file” “rgb”

WorldBegin

Translate 0 0 3

Disk 1 0.5 360 WorldEnd

(7)

Quadrics

Primitives = Pre-defined surfaces = Build-in library of shapes

(8)

Sphere <radius> <zmin> <zmax> <sweep_angle>

Quadrics Example - Sphere

Display "result.tiff" "file" "rgb" WorldBegin Translate 0 0 10 Rotate 90 1 0 0 Sphere 0.5 -0.5 0.5 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" WorldBegin Translate 0 0 10 Rotate 90 1 0 0 Sphere 0.5 -0.2 0.5 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" WorldBegin Translate 0 0 10 Rotate 90 1 0 0 Sphere 0.5 -0.2 0.2 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" WorldBegin Translate 0 0 10 Rotate 90 1 0 0 Sphere 0.5 -0.2 0.2 120 WorldEnd

.rib

(9)

Disk <height_along_z> <radius> <sweep_angle>

Quadrics Example - Disk

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 1.0 Disk 0 0.7 270 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 1.0 Disk 0 0.7 120 WorldEnd

.rib

(10)

Cylinder <radius> <zmin> <zmax> <sweep_angle>

Quadrics Example - Cylinder

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 7 Rotate 90 1 0 0 Cylinder 2 -3 3 270 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 7 Rotate 90 1 0 0 Cylinder 2 -1 1 200 WorldEnd

.rib

(11)

Cone <height> <radius> <sweep_angle>

Quadrics Example - Cone

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 -2.5 7 Rotate -90 1 0 0 Cone 5 2 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 -2.5 7 Rotate -90 1 0 0 Cone 5 2 180

.rib

(12)

Paraboloid <radius_at_zmax> <zmin> <zmax> <sweep_angle>

Quadrics Example - Paraboloid

Display "result.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 WorldEnd

.rib

Display "result.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.3 1.0 330 WorldEnd

.rib

(13)

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

Quadrics Example - Hyperboloid

Display "result.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 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 2.0 Rotate 90 0 1 0 Rotate -90 1 0 0

.rib

(14)

Torus <major_radius> <minor_radius> <start_angle> <end_angle> <sweep_angle>

Quadrics Example - Torus

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 1.5 Torus 0.5 0.25 0 360 360 WorldEnd

.rib

Display "result.tiff" "file" "rgb" Projection "perspective" WorldBegin Translate 0 0 1.5 Torus 0.6 0.1 0 360 120 WorldEnd

.rib

(15)

RIB File Structure

FrameBegin / FrameEnd

Description of a single frame to be rendered.

A frame can contain any number of world blocks that can generate texture

maps, shadow maps, background elements, or any other renderings

required to make the “real image”

WorldBegin / WorldEnd

Scene description of a single image.

The current transformation matrix is stored as the camera-to-world matrix,

and the new object-to-world matrix is initialized with the identity matrix

AttributeBegin / AttributeEnd

AttributeBegin pushes the entire graphics attribute state, including the

transformation stack.

Although attribute blocks are typically used inside the world block, it is

perfectly legal to use tem outside as well.

TransformBegin / TransformEnd

TransformBegin pushes the transformation stack but leaves all other

attributes alone.

Tranform blocks can be nested within attribute blocks, and vice versa,

but the stacking must always be balanced.

AttributeBegin … TransformBegin … TransformBegin … AttributeBegin …

(16)

FrameBegin / FrameEnd

Format 640 640 1

Projection "perspective" "fov" 20 Translate 0 0 5

FrameBegin 1

Display "result.0001.tiff" "file" "rgb" WorldBegin Color [0.4 0.4 0.6] Translate 0 0 1 Sphere 1 -1 1 360 WorldEnd FrameEnd FrameBegin 2

Display "result.0002.tiff" "file" "rgb" WorldBegin Color [0.4 0.4 0.6] Translate 0 0 4 Sphere 1 -1 1 360 WorldEnd FrameEnd FrameBegin 3

Display "result.0003.tiff" "file" "rgb" WorldBegin Color [0.4 0.4 0.6] Translate 0 0 8 Sphere 1 -1 1 360 WorldEnd FrameEnd

.rib

(17)

More on Transformations

Display "result.tiff" "file" "rgb"

Projection "perspective" "fov" 40 WorldBegin Translate 0 0 5 Rotate -120 1 0 0 Color 1 0 0 Cylinder 1 -1 1 360 WorldEnd

.rib

(18)

References

Cook, Robert L., Loren Carpenter, Edwin Catmull, The Reyes Image Rendering Architecture, SIGGRAPH 87.Saty Raghavachary, Rendering for Beginners: Image synthesis using RenderMan, Focal Press, 2004

Rudy Cortes, Saty Raghavachary, The RenderMan Shading Language Guide, Thomson Course Technology, 2007Ian Stephenson, Essential RenderMan Fast, Springer, 2003

Anthony A. Apodaca, Larry Gritz, Advanced RenderMan: Creating CGI for Motion Pictures, Morgan Kaufmann, 1999http://old.siggraph.org/education/materials/renderman/pdf_tutorial/rman_booklet.pdf

수치

Updating...

참조

Updating...

관련 주제 :