This is collating information from a few posts in the forum, here they are for reference:
ReadArchives allow you to replace one object for another at rendertime. Usually this is done so that you animate with a low-res shape in maya (or even just a locator), and at rendertime this is replaced with a hi-res shape that has already been saved to disk, in a native renderman format (.rib). In MtoR this would be achieved via a ribbox, in 3delight its done via the pre-geo mel option on a geometry attribute node. So assume we have a hi-res object, high.rib, ready to go, and we’ll make a cube in maya to be the lo-res proxy.
- create your cube
- 3delight→attrib nodes manager
- make sure attrib types is ‘geometry’, click create, select the cube, ‘attach’. if you look in the outliner, you’ll see the cube is now a member of the delightGeoAttribs node (it looks like a child of the node)
- select the delightGeoAttrib node, open the attribute editor
- in the pre geo MEL area, type
RiReadArchive -an “high.rib”;
- uncheck ‘export geometry’ in the geometry section, otherwise the cube will appear as well as your high.rib.
Thats it! When you render, your cube will be replaced by the contents of high.rib.
If you have to specify a path then insert forward slashes. ie if the high.rib is in C:\temp.....
RiReadArchive -an “C:/temp/high.rib”
The rib should be in a specific format, designed to be included in another scene. A rib normally contains information about the camera, the current frame, render settings etc, wheras a rib archive should only be geometry (the maya analogy is saving a scene vs exporting a single shape). In MtoR this is created with a specific archive-writer function. 3delight doesn’t have this function yet, but will in the next version hopefully. Regardless, you can fake it with some hand editing. Its not perfect, but its adequate for testing.
In the renderpass options under ‘output’ you can choose to render to rib. Give it a filename and render a frame, your rib will be created.
Now we need to delete the stuff we don’t need. A standard rib file contains options that float freely, and a frame description that involves a heirachicy of nodes. In most simple cases, there’s a frame (wrapped in FrameBegin/FrameEnd). Then a world is a child of the frame (WorldBegin/WorldEnd), then finally objects and attributes are children of the world. To make it ReadArchive friendly, you need to delete the frame and world information, so that only the geometry remains. This is easiest to see if you start exporting a simple shape like a cube, and make sure you delete and move sections of the rib cleanly. Delete the camera info as well, its no longer needed.
Finally, you have to to make sure that the hi-res shape follows the transform of the lo-res proxy in maya. The key to this is changing the ‘Transform’ line to ‘ConcatTransform’. This adds its own transform to the proxy rather than setting the transform in worldspace, essentially making it a child of the proxy.
By default the shader becomes embedded in the archived rib, so it won’t inherit a shader you apply to the lo-res proxy. This can apparently be worked around by using conditional statements in the pre/post geo mel, but I haven’t worked this out yet. This is hinted at in this post: http://www.3delight.com/en/modules/PunBB/viewtopic.php?id=140
The ribs exported from 3delight use objectInstance calls, so the object is initally created and given a number, say 1, then in the world-block its called in with
ObjectInstance 1. If you try and load this in as a readArchive, the numbers conflict with objects already in your scene. So far I’ve worked around this by setting the number to something else (say 99), but clearly this isn’t the right way to do it. Archives written by MtoR don’t use the object flag at all, so looks like they should be removed from 3delight ribs if they’re used as archives too. It should be possible to write a mel/python translator to make them archive friendly. Someone might’ve written one already, will have to investigate...
Also there’s another command, RiDelayedReadArchive, that’s meant to be even more memory efficient. RiReadArchive is essentially an include, whereas RiDelayedReadArchive will make the renderer only load in the external rib when required, saving memory. To do this you need to tell 3delight the bounding box of your object, but I haven’t worked out yet how maya units convert to 3delight units. I’m sure this is is clearly covered in the docs somewhere.