PDA

View Full Version : renderman C api


mr Bob
05-10-2007, 06:41 AM
Hi,
I thought I could write a rib using the renderman api and of course you cannot run it as a .rib. So does it need to be compiled and linked to the 3delight RI Libarary.Then when the program is run a rib file will be created which can then be rendered in the normal way ? Is my understanding of the procedure correct ?


this is the rib

/* - A small C program to use in renderman*/

#include <ri.h>

int main(int argc , char *argv[])
{
RiBegin(RI_NULL);
RiDisplay ( "C.tiff","idisplay","RGBA",RI_NULL);
RiProjection ("perspective" , RI_NULL);
RiWorldBegin();
RiTranslate(0,0,2);
RiSphere(1,-1,1,360,RI_NULL);
RiWorldEnd();
RiEnd();
return 0;
}


I have up until this point been writing .rib files and running them via a bat file I wrote ( below)

"C:\Program Files\3Delight\bin\shaderdl.exe" C:\Program Files\3Delight\shaders\plastic
"C:\Program Files\3Delight\bin\renderdl.exe" -progress -id D:\Renderman_shaders\rib_files\SimpleRib_C.rib

So my question boils down tois there a tool I can use to first compile a file that would run create a rib and then render.

B

pgregory
05-10-2007, 08:06 AM
Hi,

What you are using there is the RI 'C' api, not RIB. RIB stands for RenderMan Interface Bytestream, and is an ASCII serialisation of the RI api calls.

In order to render from the 'C' api, you can follow one of two paths, both will require a 'C' compiler. If you are on Linux or MacOSX, the compiler is provided for you (gcc), if you are on Windows, you can get various free compilers, Google for MinGW and MicroSoft Visual Studio Express.


Compile and link against a RIB client library, I believe one is provided with 3Delight, there are also ones provided with Aqsis and PRman. This basically converts your 'C' api calls to RIB, the resulting application will normally output the RIB stream to stdout, i.e. the console, then you can either save it, or 'pipe' it into your renderer. This approach has significant advantages over handcoded RIB, as you can harness the full power of 'C/C++' in the generation of your scenes.
Compile and link against a renderering library. Aqsis allows this, as does PRman, can't say for sure if 3Delight does, I suspect it probably will. This basically passes your RI api calls directly through to the renderer, bypassing the RIB generation phase.
There is more information about how to do this with Aqsis here (http://wiki.aqsis.org/dev/libraries), although the basic principles should apply equally well to most renderers that provide these libraries.

Hope this helps.


Paul Gregory

mr Bob
05-10-2007, 09:25 AM
Hi Paul , I thought as much ........

Thanks for the info and yes im using 3delight , yet to find a ri to rib method , the 3delight wikki is well lets say pretty poor on information. when I work it out I will let you know

B

nurcc
05-10-2007, 07:53 PM
So, RIB is not actually that complex, especially the ASCII version. If you look at the RISpec (on pixar's site (https://renderman.pixar.com/products/rispec/index.htm)), it has a list of all the RI calls and the corresponding RIB syntax. It shouldn't be that hard to make some functions that convert from one to another. The trickiest part is probably the va_args stuff. But if you're not stuck on matching RI function signatures, you can hack together something else which will spit out valid RIB files.

Mauritius
05-10-2007, 11:40 PM
So, RIB is not actually that complex, especially the ASCII version. If you look at the RISpec (on pixar's site (https://renderman.pixar.com/products/rispec/index.htm)), it has a list of all the RI calls and the corresponding RIB syntax. It shouldn't be that hard to make some functions that convert from one to another. The trickiest part is probably the va_args stuff. But if you're not stuck on matching RI function signatures, you can hack together something else which will spit out valid RIB files.
And why would you ever do that if you can choose between 3 free OSS and 4 commercial RIB client libraries? I've seen people putting out their own RIB many times and they get it wrong most of the time. :)

.mm

mr Bob
05-11-2007, 12:11 AM
Hey Moritz,
Last time we met , briefly was up on the goldcoast lot ....( Hell ) I could do with some pointers on 3delight fancy helping ? Ive sent you a PM

B

Mauritius
05-11-2007, 12:28 AM
Hi Paul , I thought as much ........
Thanks for the info and yes im using 3delight , yet to find a ri to rib method , the 3delight wikki is well lets say pretty poor on information. when I work it out I will let you know
B
The Ri to RIB method is simply specifying the RIB's name to RiBegin(). I think the resp. thread in the 3Delight forum has a similar answer by Olivier.
This is also documented in the Ri spec. 3Delight is RMan compliant. Which means it adheres to the spec. So to when working with the renderer, one should have the spec. at hand. The renderer's manual merely documents where this resp. implementation adds to or deviates from the spec. It does not (redundantly) quote information already found in the spec. I guess what I'm saying is: this information does neither belong in the 3Delight wiki nor in its manual. ;)

Speaking of RiBegin(). If called with an empty string (""), 3Delight will dump RIB to stdout. If called with RI_NULL, it will render the image directly. PRMan will dump RIB to stdout in both cases, afaik.

Cheers,

Moritz

CGTalk Moderation
05-11-2007, 12:28 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.