Slide 1 CSCD 472? 4/8/09
RIB File Structure CSCD 472? Slide 1 4/8/09 Hierarchical Graphics - - PowerPoint PPT Presentation
RIB File Structure CSCD 472? Slide 1 4/8/09 Hierarchical Graphics - - PowerPoint PPT Presentation
RIB File Structure CSCD 472? Slide 1 4/8/09 Hierarchical Graphics State RenderMan uses two stacks to store the Graphics State Attribute Stack allows saving and restoring of current attribute state information includes lights, materials
Slide 2 CSCD 472? 4/8/09
Hierarchical Graphics State
RenderMan uses two stacks to store the Graphics State
Attribute Stack – allows saving and restoring
- f current attribute state information
includes lights, materials – generally anything relating to the scene and what to render. Transform Stack – allows modeling transforms to be saved while other transforms are added and then restored later. equivalent to the only stacks available in OpenGL except modeling and viewing transforms are strictly separate.
Slide 3 CSCD 472? 4/8/09
Hierarchical Graphics State
The 2 stacks can be manipulated separately
- r together.
There are no specific push or pop commands – these actions are taken automatically upon entering or leaving RIB file blocks.
Slide 4 CSCD 472? 4/8/09
RenderMan API Commands
Commands - Can be generally divided into 2 groups of commands.
Commands that describe the viewer (Options)– have to do with how the rendering is done, where the camera is placed, what to do with the output file – global to whole rendered image. Generally located outside (global to) any blocks
- r within Frame blocks if the file calls for
rendering multiple frames. Commands that describe the world (Attributes) – all geometry and material properties and other properties specific to an
- bject in the scene.
Slide 5 CSCD 472? 4/8/09
RenderMan API Block Structure
Options global to the entire animation Frame Block (optional) Changed options World Block Attribute Block(s) Transform Block(s) Image options Camera options Another World Block Next Frame Block
Slide 6 CSCD 472? 4/8/09
RenderMan API Block Commands
Outside of any block
Options that affect the entire file (a single frame or a whole animation) are given before the start of any block Specification of how each image is to be rendered – image options Specification of camera location or description – camera options or transforms.
Slide 7 CSCD 472? 4/8/09
RenderMan API Block Commands
Frame Block (optional if file is rendering
- nly a single frame)
describes a single frame to be rendered can contain as many World blocks as necessary to describe all the elements needed for the final rendering. Other world blocks may describe images to be rendered for use as textures. FrameBegin Pushes both the attribute and option state FrameEnd pops attribute and option state
Slide 8 CSCD 472? 4/8/09
RenderMan API Block Commands
World Block – starts the scene description of a single image.
WorldBegin current transformation matrix is stored as the camera-to-world matrix new object-to-world transform is initialized as an identity matrix camera setup options also stored globally. attribute state is also pushed (as a side effect) WorldEnd ends the scene description and causes the image to be rendered.
Slide 9 CSCD 472? 4/8/09
RenderMan API Block Commands
Attribute Block – inherits attribute state from its parent block, possibly changes it and presumably creates some geometric primitives to use the changes then restores the state to the parents version.
AttributeBegin pushes the entire graphics attribute state including the transformation stack usually used inside the world block but can appear anywhere. AttributeEnd pops the attribute stack Attribute State contains all the visual attributes of the geometric primitives in the scene (e.g. color, shaders, etc) and the transformation stack (all transform matrices).
Slide 10 CSCD 472? 4/8/09
RenderMan API Block Commands
Transform Block – allows the transform state to be pushed and popped independently of the entire attribute state. TransformBegin
pushes transformation stack (only) but no change to other attributes. can be nested within attribute blocks but stacking must be balanced (transformation block must end before end of attribute block)
TransformEnd
pops the transformation stack (only)
Typically used to create an object with an additional transform which uses the same attribute settings
Slide 11 CSCD 472? 4/8/09
Parameters and Parameter Lists
Designed as an extensibility mechanism for RenderMan
RenderMan calls pre-define only most basic parameters but other parameters can be added in a variable length argument list known as a Parameter List Parameter Lists contain most of the interesting data the modeler transmits to the renderer. Each entry in a parameter list has two parts: parameter name - given in a string an array of data values for the parameter
Slide 12 CSCD 472? 4/8/09
Parameter Variable Declaration
Renderer (prman) maintains a symbol table defining the data type and storage class of each parameter. it contains:
Predefined symbol table entries Data the user or modeler has created – includes most parameters to shaders and geometric primitives. User data items must be declared before being used
Slide 13 CSCD 472? 4/8/09
Parameter Variable Declaration
User data item declaration
Declare name declaration name is simply a variable name declaration: defines storage class and type for each variable in a single string class: any of 4 storage classes: constant, uniform, varying, or vertex – defaults to uniform if not mentioned type: any of the Shading Language types: float, point, vector, normal, color, string, or
- matrix. It can also be an array of these types
by providing the trailing integer length inside square brackets
Slide 14 CSCD 472? 4/8/09
Parameter Variable Declaration
Two additional data types are available that are not part of the Shading Languaage:
hpoint – refers to homogeneous points, integer – not useful to shaders but maybe useful to declare parameter list data types for use in other commands (e.g. Attribute and Display) Examples of Parameter Declarations: Declare “Kd” “uniform float” Declare “m1” “matrix” Declare “N” “varying normal” Declare “specularcolor” “color” Declare “st” “varying float[2]” Declare “Pw” “vertex hpoint”
Slide 15 CSCD 472? 4/8/09
Parameter Symbol Table Scope
Parameter Symbol Table is global to a scene – not part of the attribute state If a parameter is redeclared it replaces the
- riginal definition in the symbol table for the
rest of the RIB It is best to have every parameter name be unique or modeler will have to keep track of the current usage and definition of the parameter.
Slide 16 CSCD 472? 4/8/09
Inline Parameter Variable Declaration
Special (temporary) inline parameter declarations
Declare “Kd” “uniform float” Surface “plastic” “Kd” [.2] this is standard usage Surface “carpetfloss” “Ka” [.05] “uniform color Kd” [.3 .2 .4] special usage (but temporary) Surface “plastic” “Kd” [.5] back to standard usage
Slide 17 CSCD 472? 4/8/09
RIB Rendering Options
These are the global (or Frame block) options Display filename fileformat imagetype parameterlist – tells the renderer what to do with output
Display “filename.tif” “file” “rgba” - sends output to current directory in filename.tif
Display "/files/home/clark/maya/projects/default/rmanpix/untitled. 0001" "it" "rgba" "int merge" [0] "string dspyParams" ["dspyRender
- context /files/home/clark/maya/projects/default/scenes/h
ammer_materials.mb -time 1 -renderer 1 -crop 0 1 0 1
- port 40438
- workspace /files/home/clark/maya/projects/default/;"]
for display to 'it'.
Slide 18 CSCD 472? 4/8/09
RIB Rendering Options
Format xresolution yresolution pixelaspectratio – resolution of image to generate pixelaspectratio is 1.0 for computers and 0.9 for TV.
Format 1200 800 1
FrameAspectRatio ratio - aspect ratio of final rendered frame Exposure gain gamma gamma sets the gamma correction (default is linear or no gamma correction) gain is just a brightness multiplier. Both values are floating point.
Slide 19 CSCD 472? 4/8/09
RIB Rendering Options
Quantize imagetype one min max dither specifies how to convert floating point 0.0 – 1.0 to integers needed by files Quantize “rgba” 255 0 255 0.5 255 is the value 1.0 maps to – range of integer values is 0 – 255 – dither value says add 0.5 before truncating – thus round.
Slide 20 CSCD 472? 4/8/09
RIB Rendering Options
Quantize imagetype one min max dither
specifies how to convert floating point 0.0 – 1.0 to integers needed by files
Quantize “rgba” 255 0 255 0.5
255 is the value 1.0 maps to – range of integer values is 0 – 255 dither value says add 0.5 before truncating – thus round.
Slide 21 CSCD 472? 4/8/09
RIB Rendering Options
PixelSamples nx ny
specifies how many samples to take per pixel in each dimension.
PixelSamples 2 2
four samples per pixel – adequate anti-aliasing
PixelSamples 8 8
slower rendering but better anti-aliasing.
PixelFilter xwidth ywidth
sets the filter to use for final pixel color calculation PixelFilter “box” 1 1 PixelFilter “sinc” 4 4 PixelFilter “gausian 2 2 (default)
Slide 22 CSCD 472? 4/8/09
RIB Rendering Options
CropWindow xmin xmax ymin ymax
essentially a viewport-like setting
- nly renders part of the image
y increases downward CropWindow 0 0.5 0 0.5 renders upper left quarter.
Slide 23 CSCD 472? 4/8/09
Camera Description Options
All transformations between the Projection call and WorldBegin are accumulated and become the world-to-camera transform.
This transformation basically says how objects are to be moved in front of the real, fixed camera to give the illusion of a virtual camera. A single viewing transform (like gluLookAt) could be applied here via ConcatTransform but it is up to the program creating the RIB to generate this matrix.
Slide 24 CSCD 472? 4/8/09
Camera Description Options
Projection type parameterlist
types can be “orthographic” or “perspective” parameter list used to set fov in perspective projection e.g. Projection “perspective” “fov” 30 default projection plane is z = 1 in camera space.
Slide 25 CSCD 472? 4/8/09
Camera Description Options
ScreenWindow xmin xmax ymin ymax
sets the rectangular region of the projection plane where objects will appear does not have to be centered on z or have the same aspect ratio as the shape of the frame for display but both are usually true. default: (–frameaspectratio, frameaspectratio, –1, 1). if frameaspectratio is greater than or equal to
- ne, or
(–1, 1, –1/frameaspectratio, 1/frameaspectratio). if frameaspectratio is less than or equal to one.
Slide 26 CSCD 472? 4/8/09