The RI API
The original way that animation packages connected with RenderMan was through API calls. API stands for Applications Programming Interface. The RenderMan API is referred to as the RI API, where RI stands for RenderMan Interface. This method for connecting to the renderer is very powerful since you can use a plethora of programming tricks to pass information to the renderer. However, once the image is generated the data on the API calls is deleted and if you want to re-render the frame you must reanalyze the scene and make the same API calls with the new changes. This might not seem like a big deal, I mean you do it all the time with your 3D application. But wouldn't you agree that things would go a lot faster if while lighting a scene, you where able to export the geometry only once and then every time you re-render only export the light information?Well, that is one of the many advantages of using RIB.
The RenderMan Interface Byte stream (or RIB)
It is true that going through the API might be faster and more compact (disk space-wise), but most production houses use RIB more than API. So what is RIB you might ask?. Well, it is a file format that contains direct calls to the the RI API, so in other words it is an easier, more readable way to pass commands to the API. For example a RIAPI program to generate a simple constant color polygon might look like this:
#include
RtPoint Square[4]= {{.5,.5,.5},{.5,-.5,.5},{-.5,-.5,.5},{-.5,.5,.5}};
main()
{
RiBegin(RI_NULL);
RiWorldBegin();
RiSurface(“constant”,RI_NULL);
RiPolygon(4, RI_P,(RtPointer)Square,RI_NULL);
RiWorldEnd();
RiEnd();
}
and this is what its RIB counterpart would look like
WorldBegin
Surface "constant"
Polygon "P" [.5 .5 .5 .5 -.5 .5 -.5 -.5 .5 -.5 .5 .5]
WorldEnd
As you see RIB is a lot more straight forward and easy to read. The previous chunk of commands omits a lot of the calls that are usually used to setup a RIB properly, the reason why an image is successfully generated is because renderers usually insert the necessary RIB calls with some default value in order to render the image.
No comments:
Post a Comment