Rib
Transformation & Attributes


return to main index



Coordinate systems and their transformations control the placement, orientation and size of the objects in a scene. Attributes are named values that are associated with (assigned to) geometric primitives (objects). They control the way primitives are rendered.

RenderMan uses two stacks to ensure the coordinate transformations and attributes applied to an object do not affect other primitives. This tutorial explains how RenderMan uses transform and attribute blocks to manage these two stacks.



Figure 1 - Shaken Not Stirred !



# disk2.rib
# setting the world coordinate system
  
Display "disk2" "framebuffer" "rgb"
Projection "perspective" "fov" 40
Format 320 240 1
  
Translate 0 0 3  # a transformation
WorldBegin
    Color 1 0 0  # an attribute
    Disk 0 0.25 360
WorldEnd

The primary 3D coordinate system in RenderMan is the camera coordinate system. Until the renderer reads WorldBegin the camera defines the current coordinate system. From a users point of view, applications such as Maya and Houdini enable a camera(s) to be moved within a fixed modeling (world) space. However, internally these applications behave in the same way as RenderMan in the sense that the world is defined after the characteristics of the camera have been established. Therefore, it is the scene that is orientated with respect to a fixed, or primary, camera coordinate system.

This tutorial explains what transformations and attributes mean in the RenderMan specification. The Translate command is one of four transformations. The others are Rotate, Scale and Skew. The effect of these transformations will be seen in the next couple of examples. For now we will focus on translations. The effect of the Translate statement is,

  • to create a copy of the camera coordinate system,
  • to move the copy 3 units along the z-axis of the camera.

When the renderer reads WorldBegin a copy of the camera coordinate system, now moved out in front the camera, becomes the primary or current coordinate system. It is named the "world" coordinate system. Transformations are accumulative. For example, these two translations,

    Translate 0 0 3
    Translate 0 0 3

have exactly the same effect as a single translation ie.

    Translate 0 0 6

The Color statement sets a RGB value. Attributes are not acculumative ie.

    Color 1 0 0
    Color 0 0 1

does not specify purple. The second Color statement makes blue the current color. In effect, the second statement replaces or hides the first color statement. The RGB color components must be in the range 0.0 to 1.0. Unlike Maya, geometry in RenderMan can be colorized without the use of a material. Opacity is another attribute that can effect the transparency of an object irrespective of an objects "material" properties.



# disk2.rib
# setting the world coordinate system
  
Display "disk2" "framebuffer" "rgb"
Projection "perspective" "fov" 40
Format 320 240 1

Translate 0 0 3  # a transformation

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 320 by 240 pixels.






Create a copy of the camera coordinate system and move it 3 units along z-axis. Note: it is the copy that is translated NOT the camera coordinate system - it remains fixed.

WorldBegin

The copy of the coordinate system now becomes the primary, "world", or current coordinate system.

    Disk 0 0.25 360

Create a disk at the origin of the "world", 0.25 units in radius and 360 degrees in circumference.

WorldEnd

Conclude the description of the 3D scene.




© 2002- Malcolm Kesson. All rights reserved.