Renderman Room Description by Dave Smithey
For: UCLA Extension "Computer Generated Imagery: Rendering".
Taught by: Lewis Wakeland in Winter 1998.
Written by: Dave Smithey on 2-21-98.
email@example.com (Old address)
I constructed this room using a Renderman compliant rendering environment provided by "Blue Moon Rendering Tools" [a.k.a. BMRT]. This was Version 2.3.6 of BMRT for Win95/NT [which is still a Beta release]. My development environment consisted of Microsoft Visual C++ Version 5.0 [a.k.a. VC5] on a Pentium 233 running Windows 95. Image viewing and conversion was accomplished with Lviewpro Version 2.0 [CD Version].
BMRT was implemented by Doctoral Student Larry Gritz of George Washington University [who also works full time at Pixar]. Finding more information, as well as downloading of the software, can be accomplished at the BMRT Homepage at http://www.bmrt.org/. [A more recent link is/(was) http://www.exluna.com/products/bmrt/.] More information on LViewpro can be obtained through the LView Homepage at http://www.lview.com/.
The code was written in Console Mode [meaning that the executable would run in a DOS Window] and was primarily "straight C". The BMRT Libraries technically require "C++" but the code that I wrote was not Object Oriented. My "C" code used Functions and Data Types that are defined by the Renderman Interface and implemented by BMRT.
"C" source code would be compiled and linked from within VC5 and the resulting executable would be run from the command line of a DOS Window. The output of this run would be a "Renderman Interface Bytestream" file which is an ASCII Scene Description file that follows the rules of the Renderman Interface. These files have a ".rib" extension and are commonly called "Rib" files.
I would then run "rendrib", the BMRT Renderer, with the Rib file as input and this would create a ".tiff" file with a 24-bit RGB rendering of the scene. Sometimes I used the viewing capabilities of 'rendrib' and other times I let it just do the render and then looked at the picture with Lviewpro. There was an extensive series of iterations through the Edit/Compile/Run/Render/View cycle that lead to the final image.
Summary of the Room:
The room is a rectangular box that has a floor, a ceiling and 3 walls. The fourth "wall" is missing to allow for easy viewing into the room without having to do too many tricks. The floor is represented as being made up of varnished wood planks. The walls are supposed to look like cinder blocks that are painted blue but this didn't turn out quite as I had planned but at least they are blue. The ceiling is white stucco and actually looks pretty similar to what was above me as I worked on this project.
The back wall has a picture of a tiger on it that was texture mapped there from one of the images that comes with the CD Version of Lviewpro. There are also four spotlights that are represented in the scene as cylinders with disks on the back end. The lights also correspond to light sources that were used in rendering the scene.
There is a small ambient component of light that affects all objects. There is also a "cheating" light that is an extra point source that is rendered but has no visible object associated with it. While on the subject of cheating, two of the spot lights are magically hovering below the ceiling because I didn't get a chance to put supports for them into the scene. Currently my system has no "physics checker" installed.
The only other object in the scene is a pair of concentric plastic spheres on the floor, a red one that is partially open to show a green one inside. This was a last-minute, "gotta put something in the room", addition. The one saving grace is that BMRT is a Ray Tracing Renderer so that the spheres automatically produce reflections in and shadows on the floor.
I started out with a basic framework based on Lewis Wakeland's adaptation of the examples from Chapter 11 of "The Renderman Companion" by Steve Upstill from Pixar. I used this primarily for the code to set up a virtual camera based on various parameters. There ended up being two small "C" source files, each with a small associated header file, that dealt with the camera. These four files were relatively unchanged from the Chapter 11 example code.
There is also a main file called "roommain.cpp" , and an associated header file "roommain.h", that is the actual starting point for execution of the "C" code. This file sets up some rendering options including the name of the Rib file to output and calls the functions to set up the camera. After that it calls the Go() function which does basically everything else to render the scene. After the Go() function returns, control is transferred back to the operating system.
Most of the code for setting up everything in the scene is contained in the source file "room.cpp" and the associated header file. This contains the Go() function which calls several other functions to set up various parts of the scene. The many parameters needed to define the room and everything in it are contained in these files. I will go into some of the details in the chronological order that they were accomplished.
Phase Zero: Set Up Basic Structure.
I began by experimenting with the camera and basic coordinate system by setting up constants for the height, width and depth of the room. I also set up a set of "work lights" that included both an ambient and a distant light source. These made sure that there was light to work with until I got the "real" lights in place later. This code was eventually deleted for clarity when no longer needed.
I then made a set of eight small spheres with one at each of the corners of the room. I rendered them as plastic and changed the color of the specular highlight on some of them to make sure that I knew which corner was which. It would have been more straightforward to simply change the surface color but this gave me a chance to experiment with the specular color. This code also was eventually deleted. During this phase I generated "room00.rib" which generated "room00.tiff".
There are 400 by 400 jpeg versions, with corresponding numbering, available for viewing and here is room00_400.jpg.
Phase One: Create the Walls.
Next I took the eight vertices of the room corners and used them to define five rectangular polygons for the 3 walls, floor and ceiling. The fourth wall was to remain open, actually absent, to allow easy viewing of the inside of the room while allowing the camera to remain outside it. Originally these were done with standard Renderman surface shaders for a matte surface. I gave each one a different color to make them stand out. Not much of a room at this point, but a room none the less. This phase worked with "room01.rib" and "room01.tiff". Here is room01_400.jpg.
Phase Two: Embellish the Surfaces.
The first step toward photorealism was to begin using more sophisticated shaders on the existing surfaces that defined the room. I used the "superplank" shader that Larry Gritz wrote and that he provides with the BMRT download. This surface shader simulates a number of planks of various shades of wood with different grain patterns and many, many other parameters. There are actually 30 parameters that can be changed!!!
I declared enough parameters, in addition to a few standard ones, to change 20 of the parameters. It turned out to be somewhat of a "long and winding road" that at some points gave totally bizarre results. I ended up back fairly close to the default settings but learned a lot in the process. The code is still set up to allow later tuning and/or experimentation by changing these settings.
After feeling that the floor was looking decent [and having decided that I'd already spent too much time messing with it], it was time to work on the walls. I had seen a comment by Larry Gritz in the "brickbump" displacement shader that it could be used with a plastic or matte surface shader to get a cement cinder block effect. This shader is more commonly used along with the "brick" surface shader to make brick walls.
I decided to try for the cinder block effect and used both plastic and matte surfaces at various times with the "brickbump" displacement shader. This had many parameters and I had a hard time getting it to look much like blocks. I ended up giving it a blueish color and making it look somewhat block-like but decided to leave it well enough alone until I got farther along with the lighting.
During this time I also added a point light source to the center of the room. It was both useful and interesting since the camera does not "see" a light source so it is like having a bare bulb in the middle of a room that illuminates the walls but the camera doesn't photograph it. This made the room start to look a little better.
I then moved on up to the ceiling and decided to use a white surface with a plastic shader [since this gives ambient, diffuse and specular reflection components]. I used a "stucco" displacement shader which I eventually got to look quite like the ceiling that was over my computer area in my room. This was another excellent shader written and provided by Larry. Now it was starting to look like a room. This phase generated "room02.rib" and "room02.tiff". Here is room02_400.jpg.
Phase Three: Put a Picture on the Wall.
Next on the agenda was to hang a picture on the back wall. I used a surface shader called "paintedplastic" which basically texture mapped a 2-d picture onto a unit square plastic surface. I started by using Lviewpro to convert a ".jpeg" picture of a Tiger that was on the Lviewpro CD to the ".tiff" format that "paintedplastic" requires.
I then applied the texture to the unit square that started in the x-y plane with edges along the positive x and y axes. Since coordinates in texture space increase from top to bottom and coordinates in the room increase from bottom to top I had to first rotate the picture around the x-axis [referring now to the unit square] to flip it right side up.
Next it had to be translated back up above the x-axis. It was then scaled to the proper size relative to the room size. After that it was moved back to just in front of the back wall. Then it was moved over to center it on the back wall and finally was moved up to what would be roughly eye-level in a real room. The separation from the back wall stops the problems of having two things in the same place and also causes a slight shadow that makes the picture look more real. Now I had a room with a Tiger and this was "room03.rib" and "room03.tiff". Here is room03_400.jpg.
Phase Four: Add Spotlights to the Room.
I now proceeded to put the required 4 spot lights on [or near] the ceiling. This took a bit of geometrical thinking and a little bit of paper and calculator work to figure out where to point things. I first made a spot that was a little bit below the ceiling near the left side and about half way toward the back. I made it point at the opposite upper rear corner.
After messing around a bit with the parameters that determine the properties such as the intensity, color and spread characteristics of the light I copied most of that code and made a symmetrical light on the other side pointing toward the opposite corner. This started to look pretty interesting but I couldn't seem to get enough general light so I re-instated the point light but put it outside of the room to make the shadows and bright spots less obtrusive in the scene.
At this point these spotlights were not associated with any "fixtures" so I made metal cylinders with the lights at their centers. The hardest part of this phase was getting the cylinders to point in the same direction as the actual light sources so that things would look realistic.
I discovered a trick to help verify that things were working. I would start off by making the cylinder about 10 units long [roughly the room width] so that I could tell for sure where it was pointing. It would be visible in the direction that it was oriented, and a small amount of light would come straight out of it too!!! I never got a chance to make any kind of supports for these lights to they just float there.
I then put black disks for the backs of the lights to make them look more like real objects. This helped make them look more three dimensional since otherwise the inside and outside of the cylinders were the same color. I then used a similar process to put two more spots in the ceiling near the back walls on each side and facing straight down. The next example picture is at end of the next section.
Final Phase: Finish the Room for the Deadline.
After all of this, it was getting to be too late to do everything that I had planned so I had to start to hurry through things. I had actually started doing that during the lighting phase somewhat. I needed some kind of objects in the room so I put two spheres on the floor with one inside the other. That was all that I had time to do. It looked pretty good since it was reflected in the floor and also cast shadows on the floor as well as the back wall.
I then started trying to tune things a little bit with lights and shader parameters. I got the floor and ceiling to be acceptable but still couldn't really figure out the walls very well. When I changed the Groove Depth between the supposed cinder blocks it just started to look bizarre. I used the same parameters on all walls but for some reason the back wall had some pattern on it that looked almost like rain drops. As of 4am this looked more like "art" than a lack of understanding so I left it as it was since at least it was less boring than it had been before. Here is the final 600 x 600 renderman-room-with-a-tiger.jpg.
I then did a final rendering of "room04.rib" to "room04.tiff" and printed out the source code to turn in. I also converted a copy to a ".bmp" file and put a 600 by 600 version on my Desktop. After being away from it for a while and seeing it the next time that I turned my computer on I was pretty happy with it. Then I typed this summary.