The cri module is an alternative version of the ri module that uses the Python ctypes module to interface a renderer directly. The ctypes module is a foreign function library that is part of the standard Python libraries since Python 2.54.1. With previous versions of Python, the module has to be installed separately. The module can be used in combination with any renderer that implements the RenderMan API in a shared library. Using this module instead of the ri module has a number of advantages:
The disadvantage of using this module is that it depends on an external dynamic library that must implement the actual functionality. This means if you have not installed a renderer that ships with such a library you cannot use the module.
Before any RenderMan function can be used, a library has to be loaded using the loadRI() function. The returned module-like object can then be used just like the ri module.
| libName) |
None or the empty string, the return value is
just a reference to the ri module.
import cgkit.cri
ri = cgkit.cri.loadRI("3delight")
ri.RiBegin(ri.RI_NULL)
ri.RiWorldBegin()
ri.RiSurface("plastic")
ri.RiSphere(1,-1,1,360)
ri.RiWorldEnd()
ri.RiEnd()
The RenderMan function names can either be used with or without the "Ri" prefix. So the following is equivalent to the above:
ri.Begin(ri.RI_NULL)
ri.WorldBegin()
ri.Surface("plastic")
ri.Sphere(1,-1,1,360)
ri.WorldEnd()
ri.End()
The following table lists the library names for some renderers that are known to work with this module:
| Renderer | Library Name |
|---|---|
| 3Delight | 3delight |
| Aqsis | aqsislib / ri2rib |
| Pixie | ri |
| ri, ns) |
ri = cgkit.cri.loadRI("3delight")
cgkit.cri.importRINames(ri, globals())
RiBegin(RI_NULL)
RiWorldBegin()
RiSurface("plastic")
RiSphere(1,-1,1,360)
RiWorldEnd()
RiEnd()