RenderMan API

Who needs it? Anyone who needs to draw 12 spheres that's who. Placing 12 spheres would be a bit of a drag having to give 12 separate rib instructions.

With RenderMan API, we can write C programs and utilize its looping ability etc. (You can't write loops in rib). So if you haven't got any experience with C programming then I suggest you press the Back button.

Actually, if you know what a C compiler is - or at least how to download one for free then I'll let you stay.

What's an API? An API is a set of functions. (I won't bother confusing you by telling you that API stand for Application Programming Interface). These set of specialized RenderMan functions are used from C. They usually start with RI, so RISphere is used to create a sphere as you may strongly suspect.

You therefore need to install a C compiler. Since C is part of C++, you could install that. Since C++ is part of Visual C++, you could alternatively install that.

Here's a link to Bill Gates' free copy of Visual C++ Express. Click it while you can. Has Bill lost his marbles? Just shows what marriage does. Even saving the Africans. Well done Bill.

http://msdn.microsoft.com/vstudio/express/visualc/download/

On this page you'll alo find the free Visual Studio Games creator GDK. I haven't tried it yet.

Actually I use Visual Studio C++ version 6.0 which I've found to be compatible with the RenderMan API.

Where are these "extra" API functions?
If you installed 3Delight (see the RIB page) at the moment, they are probably sitting in the C:\Program Files\3Delight\lib folder in a file called 3Delight.lib with the corresponding header file ri.h in the C:\Program Files\3Delight\include folder.

In my case I moved them both to a working directory.

In the same working directory, create and save this file using your C++ editor. Save it as min.c.

#include "ri.h"
int main(int argc, char *argv[])
{
RiBegin("min.rib");
RiDisplay ("min.tiff","file","rgb",RI_NULL);
RiProjection ("perspective",RI_NULL);
RiWorldBegin();
RiTranslate(0,0,2);
RiSphere(1,-1,1,360,RI_NULL);
RiWorldEnd();
RiEnd();
return 0;
}

From the command prompt, type cl min.c.

(You will need to first make sure that your path is also set to the bin folder of your compiler for the cl command of the Visual C++ compiler to be recognized.)

This should produce a corresponding rib file called min.rib. Take a look at it with your text editor. It should be very similar to test.rib from the RIB page.

We could then call i-display as we did previously (see the RIB page) to produce the same a tiff image of the sphere.

 

 

Alternatively, if we wanted to produce a .tiff image directly without producing the intermediate rib file, replace RiBegin("min.rib"); in the code above with RiBegin("RI_NULL");.

If you find it a bit tedious to be using the command prompt, it is possible to use the Visual C++ IDE. Go to Tools, Options, Directories etc to set the include and lib folders so that you can run the compiler form the IDE.

Where to go from here?

Take a look at RenderMan Fast chapters 16 & 17.

The standard text is The RenderMan Companion by Steve Upstill.
I say "standard" because its old - written ions ago - pre-1990.
Apart from the text being a bit blotchy through presumably too many reprints its an oldie but goodie.
It makes no mention of rib.
A few commands have changed but when you are able to decypher it, its great.I have written a few notes to help with this - The RenderMan Companion Companion.

After much perseverence, grafting and searching, someone from a forum gave me a link to the source code for the book for which I should be eternally grateful. (So grateful that I can't even rememberl his name.)

Here is the link with acknowlegement to whats-his-name: http://renderman.org/RMR/Publications/RC/rcTop.htmld/index.html
(It also provides some very useful assistance with the decyphering.)

For help on the RI commands see: https://renderman.pixar.com/products/rispec/rispec_3_1/appendix.F.html

Also of great assistance is the site previously mentioned on the RIB page, http://www.linuxfocus.org/English/July1999/article81.html.
As well as finding Carlos looking very pleased with himself - and so he should be- his demonstration of animation is great.
It took me a while to realize that each key scene is a separate .tif file: camara_00.tif up to camara_49.tif if I remember rightly resulting from 50 corresponding rib instuctions so as well as littering your working directory, it makes up a pretty hefty rib file - called secundo.rib I think.
You even get to find out that azul is Spanish for blue.
Take care though that Carlos refers to his files as .tif whereas up to now we have known them as .tiff.