Jeremy Stribling, cs184-cf
CS184, Fall 2000
Instructor: David Forsythe
The goals of this project were:
- To create a realistic model of an apple core using Renderman Interface
Bytestream (RIB) files generated by hand with the aid of C++ programs written
specifically for the purpose.
- To design an implement a crude animation tool allowing for the creation of
limited animations of supplied RIB files. The animation should consist of
translations created by linearly interpolating positions of the RIB file world
in keyframes, and rotations created by linearly interpolating the rotations of
RIB file world about a set axis.
- Use this tool to create an animation of the apple core.
At the time of the second deliverable, I had completed the model of the apple, and
rendered it in several positions using the BMRT version of Renderman. These
renderings are supplied as TIFF files below:
Some notes about this model:
- The surfaces were obtained by using surface of rotation functions written
in C++, which, given an array of points in 2 dimensions, creates a bicubic
mesh of the points rotated about an axis in 3 dimensions. To model the
randomness of bite marks at the intersection of the core and skin, the surface
of rotation was randomly perturbed in the vertical direction at those edges,
giving it a jagged appearance.
- To model the bitemarks on the apple core, the surface of rotation was
slightly randomly perturbed in three directions, creating peaks and valleys in
- The skin of the apple is a basically a single color speckled with noise of
a darker color. This noise is generated as a function of the surface
parameters, applied to various sinusoid and BMRT random number functions. I
also had to use several splining tricks to make the noise uniform over the
curved surfaces, since the surface parameters are not uniformly distributed.
- The core of the apple actually uses the same shader as the skin to
generate faint noise along its surface, but it takes it a little further. In
order to model the oxidation of the apple as it's being eaten, the core is
slightly browner at the peaks. This is because the peaks of the apple core
tend to have been exposed to the air longer than the valleys. This was
accomplished by testing to see if the radius of the core was within a certain
range at a point, and then computing the color at that point to be somewhere
in between the color of the core and the darker color (supplied as a parameter
to the shader), as a function of its radius.
- The displacement of the skin and the core was created by the BMRT standard
displacement shader, "dented". Different parameters were passed to the shader
for the skin and the core, to model a different size and frequency of the
dents for the different surfaces.
Here are the C++ files used to
generate the apple core surface:
Here is the generated RIB file:
are the surface shaders used:
Since the the second deliverable, I created a Windows program entitle OC Animation
that allows a user to create an animation using an extended version of the crystal ball
interface from our homework. The user, through a simple interface, can create simple translation
and rotation animations to a 3D cube, and the apply those animations to a RIB file. They can
specify the position of the cube at keyframes, and then linearly interpolate between the two
frames to create the animation. Here is the executable:
Download OCAnimation for Windows
Download DLLs that you might need to run it
Here is an animation I created of the apple. I used a trial version of
GIF Construction Set to create the
animation from BMP files (which I converted from TIF files using a trial version of
Graphics Workshop ), and I didn't
have as much control as I would have liked over the framerate of the animation. As a result,
it looks pretty jerky, but if I had a better GIF creation tool available it would be much smoother.
Apple Movie - GIF version
Apple Movie - AVI version
Some notes about this application:
Much of the time I spent on this application was on designing an efficient, simple way for the
user to specify an animation. I eventually decided to go with using Visual C++ and Microsoft
Foundation Classes (MFC) to create the program, so my program would resemble most other Windows
applications, and utilize the user's familiarity with that interface. This also afforded me the
use of standard Windows controls, such as sliders, edit boxes, menus, and buttons. Having never
dealt with Visual C++ or MFC before, I took a great deal of time learning how to create the
program and make it's various components work together.
For the main interface of the program (the crystal ball interface), I was able to integrate most of code
from the Crystal Ball assignment, almost unmodified. I had to change it a little bit to extend its
implementation to include translation, but that's about it. I also had to add a lot of code to accomodate
other parts of the project, but the original Crystal Ball interface I wrote was basically untouched. It's
implemented in OpenGl, integrated into the Windows application interface.
Another main part of the program was interpolating the positions of the cube. The translation interpolation
is just simple linear interpolation between two points, with a uniformly spaced parameter. Rotation
interpolation was a little bit trickier. I did a lot of research on the web to figure out the best way
to implement it, and I decided to do it using Spherical Linear Interpolation (SLERP), with quaternions. The main
resources I used were this rotations calculator
tutorial on quaternions, both of which had available some free code that I studied and modified to be
useful for my project. Using this information, I was able to implement rotation interpolation in such a way that
I was able to store the rotations to be useful later, when applying the animation to a RIB file.
The last final part of this project was providing a way to apply the rotations to RIB files. I designed the
program to look in the user-provided RIB file for the first Atribute, and apply the translations and rotations
within the Attribute block. Unfortunately, this requires the user to be a little careful in the RIB files they
supply to the program -- there must be no translations within the Attribute block, otherwise whatever's in
the Attribute block will be rotated around a point other than its origin, creating unexpected results. If
you need to do any translations, they should be in a Transform block that surrounds the Attribute block. When
it applies the transformations, it simply creates a number of frames equal to the number of frames in the
animation, and copies the world into each frame, with the transformations added to each frame. The file instructs
Renderman to render each frame in a different file. The user can then use other graphics programs to put
them together in a movie (I used Graphics Workshop and GIF Consruction Set -- see above).
As an added bonus, I implemented a way for users to save and load their animation files for later use, which
I felt is a pretty handy feature that I hadn't previously expected to implement.
Here is a ZIP file of the project, containing all of the source code in entirety:
Here is a copy of the Help dialog from the program, explaining how to use the program:
Project Deliverables and Assessment:
I believe I've met I'll be goals for this project, and certainly exceeded my expectations in the elaborateness of
the Animation tool I created. My original plan was just to write a C program that would take in some configuration
file and generate a new RIB animation, but I really went overboard with creating a GUI-based Windows program,
having no previous experience with such a project at all. I spent a lot of time on this project, and am pleased
with the final result, especially considering I taught myself a great deal of this stuff on the fly, and that I
was working by myself. The one thing I would work on if I had more time would be to make the inner core
of the apple model look wetter, but unfortunately I had to sacrifice working on that to create OC Animation.
All in all, I feel I've really accomplished something with this project, perhaps more than on any other project
I've worked on here at Berkeley.