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 – 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. CSCD 472? Slide 2 4/8/09
Hierarchical Graphics State The 2 stacks can be manipulated separately or together. There are no specific push or pop commands – these actions are taken automatically upon entering or leaving RIB file blocks. CSCD 472? Slide 3 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 or 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 object in the scene. CSCD 472? Slide 4 4/8/09
RenderMan API Block Structure Options global to the entire animation Frame Block (optional) Image options Camera options World Block Attribute Block(s) Transform Block(s) Changed options Another World Block Next Frame Block CSCD 472? Slide 5 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. CSCD 472? Slide 6 4/8/09
RenderMan API Block Commands Frame Block (optional if file is rendering only 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 CSCD 472? Slide 7 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. CSCD 472? Slide 8 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). CSCD 472? Slide 9 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 CSCD 472? Slide 10 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 CSCD 472? Slide 11 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 CSCD 472? Slide 12 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 CSCD 472? Slide 13 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” CSCD 472? Slide 14 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 original 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. CSCD 472? Slide 15 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 CSCD 472? Slide 16 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'. CSCD 472? Slide 17 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. CSCD 472? Slide 18 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. CSCD 472? Slide 19 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. CSCD 472? Slide 20 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) CSCD 472? Slide 21 4/8/09
RIB Rendering Options CropWindow xmin xmax ymin ymax essentially a viewport-like setting only renders part of the image y increases downward CropWindow 0 0.5 0 0.5 renders upper left quarter. CSCD 472? Slide 22 4/8/09
Recommend
More recommend