home
contents
resume
showreel
portfolio

resources
renderman
maya
massive
houdini

friends
professor malcolm kesson
professor ron bernard
aleksander rodic
andrew dehner
billy dongyoon jang
kiki poh
sandro blattner
zahari dichev

contact
01. 912 . 272 . 2209
davekcw@yahoo.com.sg
RIB Matrix - The basics in a Renderman scene description
When Maya attempts to render in Renderman, it does so by converting the Maya scene description into a Renderman scene description. This project covers the basics in understand the structure of how a Renderman scene work, by exploring the individual coding behind rendering setups, camera, textures, lights and basic transformation setups. This project, while basic serves as a important precursor to debugging Renderman issues.

Notes!
This project may differ from the initial assignment writeup written for Professor Malcolm Kesson. It would have been edited to also reflect my later experiences, clearer tutorial techniques/codes and also later advancements made to the projects as well.
   
Coding the Basic Shapes

In this assignment, we are required to script our own basic polygonal shapes using available quadrics in the Renderman system. It seems that the purpose of this assignment was for us to understand how to manipulate the 3d axial space in Renderman without fully having to rely on a 4 point viewport or easy movement handles provided by 3d softwares like 3Ds Max, Maya, Houdini and etc.

Such a system was mainly predominent back in the early 1980s to the 1990s where individual objects formulas were mainly keyed into a 3d system and defaulted on the XYZ space of "0,0,0". Not considering the sketchpad point and draw program which ILM had used in the making of the Star Wars Trilogy of couse.

To start, I have decided to create 3 objects of mathematical interest. They are of course, shapes of Tetrahedron style. It is supposely a strong form of molecular like bond which is both firm and durable.

Testing the possiblity of my mathematical strengths, I have made 3 objects of interest as my matrix shapes. They are a spherical tetrahedron shell, a tetrahedron star based on molecular interests and the origami shape displayed on the upper right and a tetrahedron square just like the one displayed on the lower right.

The results of which are seen below for your references.

 

To elaborate alittle, I basically depended greatly on instancing for my Matrix shapes. Although it seems that the usage of ObjectBegin and ObjectEnd seems to be less than ideal in the usage of renderman rib files. I find that it was particularly useful in mine... At least in the very beginning (To be mentioned again below) . To start off, I analysed the shape and drew them out in their individual repetition as follows.

 
 

With that, I then placed the coding for the spheres and cylinders that form that basic shape. Remembering that as tetrahegons, the shapes should consist of mainly 30 and 60 degree angles with either equalateral or isoceles triangles. Then placing such plannedwithin an Object group as it is below.

 
################################################################## Instanced Bars
    ObjectBegin 1
        
        TransformBegin
        Rotate -45 0 0 1
        Scale 3 1 1
        Cylinder 0.7 0 20 360
        TransformEnd
                
        Sphere 5 -5 5 360
    ObjectEnd
################################################################## Instanced BarsNOJOINTS
    ObjectBegin 2
        
        TransformBegin
        Rotate -45 0 0 1
        Scale 3 1 1
        Cylinder 0.7 0 20 360
        TransformEnd
  
    ObjectEnd                
################################################################## Pyramid
    ObjectBegin 4
    
    TransformBegin
        Translate 0 13.5 0
        Scale 1 0.5 1
        Sphere 3 -3 3 360
    TransformEnd
    
    TransformBegin
        Translate -10 0 -10
        Rotate 45 0 1 0
        Rotate -45 1 0 0
        Scale 1 1 1
        Cylinder 0.8 0 20 360
    TransformEnd
    
    TransformBegin
        Translate 10 0 -10
        Rotate -45 0 1 0
        Rotate -45 1 0 0
        Scale 1 1 1
        Cylinder 0.8 0 20 360
    TransformEnd
    
    TransformBegin
        Translate 10 0 10
        Rotate -135 0 1 0
        Rotate -45 1 0 0
        Scale 1 1 1
        Cylinder 0.8 0 20 360
    TransformEnd
    
    TransformBegin
        Translate -10 0 10
        Rotate 135 0 1 0
        Rotate -45 1 0 0
        Scale 1 1 1
        Cylinder 0.8 0 20 360
    TransformEnd
  
    ObjectEnd
 

And that was the example code from the core structure of the Cube Tetrahedron. Using the ObjectBegin command, I placed the generic shapes of the patterns into a "instance", thus allowing me to easily view and manipulate any other replicas of the pattern later on in the same script file without putting my code into an additional archive to risk later file complication problems or to create an extremely long context of codes which would probably confuse me. If you would observe below, I have included an example of using the ObjectInstance code to call out the instances to create the form of the matrix shape.

 
################################################################## Pivot Change
    Scale 0.5 0.5 0.5
    Translate 0 10 0
################################################################## Frame A
    TransformBegin
        Rotate 180 1 0 0
        Translate 10 0 -10
        ObjectInstance 1    
    TransformEnd
    
    TransformBegin
        Rotate 180 0 0 1
        Rotate 90 1 0 0
        Translate -10 10 -20
        ObjectInstance 1    
    TransformEnd
    
    TransformBegin
        Rotate 180 0 0 1
        Rotate -90 1 0 0
        Translate -10 10 0
        ObjectInstance 1    
    TransformEnd
    
    TransformBegin
        Translate 10 -20 -10
        ObjectInstance 1    
    TransformEnd
################################################################## Frame B
    TransformBegin
        Translate -10 0 -10
        ObjectInstance 1    
    TransformEnd
    
    TransformBegin
        Rotate 90 1 0 0
        Translate -10 10 0
        ObjectInstance 1    
    TransformEnd
    
    TransformBegin
        Rotate -90 1 0 0
        Translate -10 10 -20
        ObjectInstance 1    
    TransformEnd
    
    TransformBegin
        Rotate 180 1 0 0
        Translate -10 20 -10
        ObjectInstance 1    
    TransformEnd
################################################################## BarFrame A
    TransformBegin
        Rotate 90 1 0 0
        Rotate 90 0 1 0
        Translate 0 -10 -10
        ObjectInstance 2    
    TransformEnd
    
    TransformBegin
        Rotate 90 0 1 0
        Translate 10 -20 -10
        ObjectInstance 2    
    TransformEnd
    
################################################################## BarFrame B
    TransformBegin
        Rotate 90 0 1 0
        Translate -10 0 -10
        ObjectInstance 2    
    TransformEnd
    
    TransformBegin
        Rotate 90 1 0 0
        Rotate 90 0 1 0
        Translate -20 10 -10
        ObjectInstance 2    
    TransformEnd
  
################################################################## Pyramid EXT Frames
  
    TransformBegin
        Scale 1 2 1
        ObjectInstance 4
    TransformEnd
  
    TransformBegin
        Rotate 90 1 0 0
        Translate 0 10 10
        Scale 1 2 1
        ObjectInstance 4
    TransformEnd
  
    TransformBegin
        Rotate -90 1 0 0
        Translate 0 10 -10
        Scale 1 2 1
        ObjectInstance 4
    TransformEnd
    
    TransformBegin
        Rotate 180 1 0 0
        Translate 0 20 0
        Scale 1 2 1
        ObjectInstance 4
    TransformEnd
    
    TransformBegin
        Rotate 90 0 0 1
        Translate -10 10 0
        Scale 1 2 1
        ObjectInstance 4
    TransformEnd
    
    TransformBegin
        Rotate -90 0 0 1
        Translate 10 10 0
        Scale 1 2 1
        ObjectInstance 4
    TransformEnd
            
 

Now this code is only 122 lines long. If I had chosen to code these transformations down without the instances, it would have easily costed me over 1000 lines, not to mention of course that it would be a hassle to make any adjustment changes on every single "uninstanced" replica of the same coding. It also allows me to view my transformation clearly with the limited screen sizes that we have on our monitor.

But of course, such system will have its flaws, as it seems that the object instances do not allow nesting of any form. This error persist throughout and even when within ReadArchive of stored rib files. To fix that, once I have concluded my final coding, I then proceed to use a find and replace function to replace all ObjectInstance with the actual coding.

To see the file script of my 3 matrix shapes you can click on the images below to see the rib files.

 
   
Puting together the scene composition

Well, after the completion of the basic matrix shapes as described in the ealier chapter, I now proceed into creating the composition required of the assignment.

This, however is where the 2nd hard part is. In my mind, I was thinking more of a solar system or electron like layout. The Staro forms the core sun or nucleous the Cubo forms the orbital lines and the Sphero forms the planets or the electrons. To do that, I would need to create many rings of the archived shapes. So I have written a seperate rib file to allocate them for achieve a central pivotal point. I merely loaded the archives, placing 2 of the same into a single TransformBegin and TransformEnd on both positive and negative Z axis.

This group is then relicated and rotated to create the orbital rings...

    ObjectBegin 1
        TransformBegin
            Scale 0.15 0.15 0.15
            Translate 0 0 100
            ReadArchive "Cubo.rib"
        TransformEnd    
        TransformBegin
            Scale 0.15 0.15 0.15
            Translate 0 0 -100
            ReadArchive "Cubo.rib"
        TransformEnd
    ObjectEnd
  
  
    ObjectInstance 1
    
    TransformBegin    
        Rotate 15 0 1 0    
        ObjectInstance 1
    TransformEnd
    
    TransformBegin    
        Rotate 30 0 1 0    
        ObjectInstance 1
    TransformEnd      

Of course however, at this point the instances seemed not to matter to me so much so I allowed them to remain in the rib file so that I can easily change them with ease. Saying so, I merely replaced the "Cubo.rib" in the coding to allow a similar manipulation of the Sphero object. The first composition of such is as below....

However, it seems I now have a dilema. The 3 objects I haven chosen may be a little bit harder to composite together in a scene. Placing them in a ring formation as above may be nice in its output, however it is also hard to demostrate a sense of depth when the objects are equally vying for the same amount of space in the shot.

To fix the problem, I decided to give this image alittle reworking. I did this by going into the very base files of Cubo and Sphero and added a Scale command to scale it to it appropriate sizing. I then increased the overall size and lower the interpolation count of the replicas from the current to 6, giving me the required look below...

While the outlook was not quite what I had wanted in the start, I accepted it as it had a certain pattern to it. The scale of the shapes gave a sense of depth and the sizing allowed for much intricate details to be seen. For those interested in the rib file that I had coded to form the rings, you may find it over here at this link...

   
Adding Basic Colors

Time now to add colors~

Unfortunately for me, I had already compiled my instances into actual coding so it took me some times to get my colors up. With a little help from the Find and Replace function, I went through my codes and added color codes into my objects. A good reason why it is important to have a clear structure in your rib files. Now if only ObjectInstance was more developed... too bad renderman was not really meant for modelling.

There was also more problems with my CubTurn and SphTurn script which I had used to generate the orbital ring effect. Seems like all my RiColor coding became invalid in the instance format.. probably why the command was seldom used. So I have complied them as well to output the final Color Composition
 
Adding Depth of Field and Lighting

Unfortunately for me, for some odd reason, I am getting an error from prman when trying to execute my shadow (tx) scripts and ribs so I was not able to incorporate a shadow into the scene yet.

Irregardless, I still managed to get some lights going on... just without the shadows for now. As I did want to create an illusionary diagonal horizon I lighted the image in such a way that the specularity of the BG plane would be aligned in diagonal. The end result is a bright flowerly design.

And after that, I added on a DepthOfField of 12 4 64 where the object of my main focus was actually at 60 to give alittle sharpness but not overly sharp on my shot. A pixel sampling of 12 by 12 was used. I also enhanced the amount of lights to further push the specular into blossom.

And finally back to the shadows again. I wasnt trying to turn the composition into a realistic environment but rather a pattern like motif. So i deliberately adjusted the shadows to make it more patterned-like. Unfortunately, the depth shadows was not working for me. It just came out with lots of pointed bright blue pixels and with the same error as show above. So instead of using a depth shadow tx file, I choose to use raytracing instead by adding the below attributes.

    Attribute "visibility" "trace" [1]
    Attribute "shade" "transmissionhitmode" ["primitive"]
    Attribute "visibility" "int transmission" [1]   

With that done, I then proceed to render the final output image. You will note however, due to how light attenuates over long distances, I have added an extra scale attribute to every single object to scale it down. I have also added asstional lights to illuminate the core of the scene to generate the shadows so as to also create a vignette effect.

The final matrix rib file can be found at this link.





 
dave kin chang wei - visual effects artist / technical director - davekcw@yahoo.com.sg - www.kamid.net