Rib
Hello World


return to main index



The purpose of this tutorial is to present a minimal RenderMan Rib file. The image it produces is shown in figure 1.



Figure 1 - Hello World !



# hello_world.rib
# Setting a perspective view
  
Option "searchpath" "rixplugin" "${RMSTREE}/lib/shaders:@"
  
Integrator "PxrVisualizer" "shaded_wireframe"
Hider "raytrace" 
  
Display "hello_world" "it" "rgb"
Projection "perspective" "fov" 40
Format 640 360 1
 
WorldBegin
    Disk 3 1.0 360
WorldEnd 


The purpose of this tutorial is to present a minimal RenderMan rib file.

The first two lines show the use of the hash symbol # for comments. PRMan ignores the line of text following the # character. The text shown in blue are commands, also known as statements. They are part of the RenderMan 3D scene description protocol (language). The Rib "language" consists of about 125 commands. For the nerdy details of the Rib commands/statements refer to the Pixar document, Pixar: RIB Bindings

The Integrator and Hider statements tell PRMan the scene should be rendered in RIS mode. The "PxrVisualizer" integrator enables the geometry to be rendered as a shaded wire-frame surface - it avoids the complication of using the Rib statements needed to specifiy light source(s) and material(s).

The Display, Projection and Format statements define the characteristics of basic camera that is "looking" along it's own Z axis. The camera is "basic" because it does not use depth-of-field or motion blur.

Display has three parameters to specify

  • the name of the image,
  • where to put the image, and
  • what information the image should contain.

The parameters for Projection specify,

  • perspective or orthographic projection, and the
  • field of view measured in degrees.

The parameters for Format specify,

  • image width,
  • image height, and
  • the pixel aspect ratio.

WorldBegin notifies the renderer that objects comprising the 3D scene are about to be defined. Disk is a Rib statement that defines, by its three numeric parameters a flat circular disk situated 3 units along the z axis, 1.0 units in radius and 360 degrees in circumference. Parameters must be separated by at least one space. They may, however, be spread over several lines with comments. For example,

    Disk
    3   # units along the z axis
    1.0 # units in radius
    360 # degrees

Finally, WorldEnd indicates the description of the scene has been completed.



# hello_world.rib
# setting a perspective view
 
Display "hello_world" "it" "rgba"
Projection "perspective" "fov" 40
Format 640 360 1

Two comments about the scene.


Set the camera to give a perspective view with a field of vision of 40 degrees and a frame size of 640 by 360 pixels.

WorldBegin

Begin describing the contents of the 3D scene.

    Disk 3 1.0 360

Create a disk 3 units along the z axis of the camera, 1.0 unit in radius and 360 degrees in circumference.

WorldEnd

Conclude the description of the 3D scene.




© 2002- Malcolm Kesson. All rights reserved.