Camera Transformations


return to main index



Transformations applied before WorldBegin establish the spatial relationship of the world relative to the camera. Rib files produced by mtor make a call to a ConcatTransform statement. The statement specifies a transformation matrix of 16 values. The following example has been reformatted to more clearly show the 4 by 4 matrix of values.

    ConcatTransform [ 0.707 -0.331 -0.625  0.0
                      0.0    0.884 -0.469  0.0 
                     -0.707 -0.331 -0.625  0.0 
                      0.0    0.0   44.822  1.0 ]

Although it is not obvious this matrix inverts the z-axis of the world so that its coordinate system conforms to Maya's right hand coordinate system. Fortunately, RenderMan provides more human-friendly statements for specifying the same information.

The rib statements shown below in bold setup exactly the same world/camera relationship as that specified by the (less readable) ConcatTransform. The transformations do not effect the current coordinate (camera) system but rather, as figures 2 to 6 will show, they effect a copy of the current coordinate system.

It is often extremely helpful when debugging a scene or when developing a shader to make use of a simple rib file rather than trying to deal with a complex rib written by mtor. The following link compares two rib files that render exactly the same images.


1
2
3
4
5
6
7
8
9
10
11
12
 Display "untitled" "framebuffer" "rgb"
 Projection "perspective" "fov" 40
 Format 427 240 1
  
 Translate   0 0 5
 Rotate -30  1 0 0
 Rotate  45  0 1 0
 Scale 1 1 -1
  
 WorldBegin
    ReverseOrientation
    ...
 WorldEnd

Although the renderer "reads" the transformations in the order in which they appear the effect they have may be considered to be the result of the renderer applying the transformations in reverse sequence. Figures 1 to 5 illustrate how the transformations are applied to the coordinate system of the world.











figure 1 - active (left hand) coordinate system
before the transformations are applied



f i r s t     t r a n s f o r m a t i o n
1
2
3
4
 Translate   0 0 5
 Rotate -30  1 0 0
 Rotate  45  0 1 0
 Scale 1 1 -1


figure 2


s e c o n d     t r a n s f o r m a t i o n
1
2
3
4
 Translate   0 0 5
 Rotate -30  1 0 0
 Rotate  45  0 1 0
 Scale 1 1 -1


figure 3



t h i r d     t r a n s f o r m a t i o n
1
2
3
4
 Translate   0 0 5
 Rotate -30  1 0 0
 Rotate  45  0 1 0
 Scale 1 1 -1


figure 4


l a s t     t r a n s f o r m a t i o n
1
2
3
4
 Translate   0 0 5
 Rotate -30  1 0 0
 Rotate  45  0 1 0
 Scale 1 1 -1


figure 5




After the transformations have been applied the active, or current, coordinate system is that of the world - figure 6. Subsequent transformations occuring within the world block are applied relative to the world coordinate system.





figure 6 - active world (right hand) coordinate system




© 2002-7 Malcolm Kesson. All rights reserved.