This page demonstrates the basics of scripting shapes RenderMan scene description (rib) protocol. Writing rib files by hand focuses attention on the use of color, opacity and the fundamental concepts related to xyz coordinate system.
The preliminary renders have been done using basic shading so that the geometry can be more easily seen.
In this project, I made an apple tree by writing rib files. Since there are no loop functions in rib syntax, I made eight individual rib files, which represent eight loops. Then I used the readArchive function to read all the loops one by one in my main rib file.
Creating a L-system only by writing rib files in renderman, it is not as easy as in any other 3D softwares. I think the main reason is that we cannot change object's hierarchy in rib files easily. Most time when we create a new object in rib files, we would like to put it into a block, which is defined by using transform begin, and transform end. This syntax is correct, but sometimes the result is not what we want. For example, if I put branch_B under branch_A by using "transform begin", branch_B will be in the world coordinate instead of being under branch_A.
So the trick is being careful of using "transform begin" if you want to write an L-system by using renderman ribs. Fortunately, if we don't add "transform begin", branch_B will be under branch_A, and that is what we want.
Next, I want to put another one to be under branch_A. But the problem is, now its parent is branch_B, so it will go to position D instead of C. So what I did is jumping out the hierarchy from branch_B to Branch_A.
Here is just a one loop demostration
# Right branch ReadArchive "l_branch.rib" ReadArchive "loop_01.rib" ReadArchive "l_back_to_parent.rib" # Left branch ReadArchive "m_branch.rib" ReadArchive "loop_01.rib" ReadArchive "m_back_to_parent.rib" # Middle branch ReadArchive "r_branch.rib" ReadArchive "loop_01.rib" ReadArchive "r_back_to_parent.rib"
Attribute "visibility" "trace"  Surface "tracedOcclusion" "Ko" 1.0 "samples" 512.0 "coneangle" 75.0 "bakename" [""]
Occlusion with the basic color
LightSource "shadowspot" 3 "intensity" 40 "lightcolor" [1.5 1.4 1.0] "from" [4 1 -3] "to" [0 3.5 0] "coneangle"  "conedeltaangle" [0.1] "conedeltaangle" [0.1] # "shadowname" ["raytrace"] "samples" 30 "width" 30
This is the beauty pass. All the objects I used the same plastic shader. And for the leaves and trunks, I just turned off the specular attribute and changed the color.
It is interesting to make an L-system in a limited programming envirment. Although we do not have the advanced functions, we still can make some beautiful artworks.
Here is the final ribs.