To fully understand this tutorial, you will need some scripting knowledge (in this case Python) and some basic knowledge of the Softimage SDK. But YOU DO NOT need any compiler or developer's SDK installed, everything you need is in the 3Delight for Softimage package.
In this tutorial you will understand the benefit to use RIB archive rather than Softimage Stand-in or any other archive method.
RIB stand for RenderMan Interface Bytestream you can have more information on this subject in RenderMan Interface Version 3.2.
This document is available electronically at https://renderman.pixar.com/products/rispec/index.htm.
A RIB file is a set of commands meant to be interpreted by a RIB reader such as renderdl.
There is almost a one to one correspondence between the API calls and RIB commands.
For in depth documentation about RenderMan and the RenderMan API, consult the following two classics:
With 3Delight for Softimage, there are many way you can use RIB archive. You can completely convert your scene into a RIB archive and then use 3Delight Studio to render it with renderdl or you can use the stand-in ability to replace object inside your scene by RIB archive or you can use the RIB archive.
In this tutorial we will consentrate on the stand-in part and mainly why you should use the RIB archive.
What are the advantage of one versus the other one:
| Stand-in | RIB Property |
|---|---|
Simplify your scene size | Simplify your scene size |
Modular approach (update is easily done) | Modular approach (update is easily done) |
Scene is faster to save and load | Scene is faster to save and load |
Motion Blur and Depth of Field will react perfectly | Material can still be live |
Motion Blur and Depth of Field will react perfectly even if generated without Motion Blur activated | Material can be overridden like any object |
Camera projection is still working | |
You can add any property (Softimage as well as 3Delight) | |
Transforms are still modifiable | |
Motion Blur and Depth of Field will react perfectly even if generated without Motion Blur activated |
That is why the focus of this tutorial is related to the RIB archive. Since the RIB archive is a geometry property it needs an host that will support it. Most of the case it should be a simple representation of the real object. In this tutorial we will first show you how to create an host that will cover the bounding box of the original object. To be more pipeline oriented, we will use a simple Python script in order to generate the bounding box of a selected object:
Open Softimage’s script editor and add the following Python code (make sure the scripting language is set to Python)
import os
# First verify if you have an object selected
if( len( Application.Selection ) > 0 ):
object = Application.Selection( 0 )
# Get the bounding box of the object
bounding_box = Application.GetBBox( )
bb_x_min = bounding_box( 0 )
bb_y_min = bounding_box( 1 )
bb_z_min = bounding_box( 2 )
bb_x_max = bounding_box( 3 )
bb_y_max = bounding_box( 4 )
bb_z_max = bounding_box( 5 )
# Create the host of RIB property. We are using a mesh in order to use any SI property on it.
cube_bounding_box = Application.ActiveSceneRoot.AddGeometry( 'Cube', 'MeshSurface' )
cube_bounding_box.Name = object.Name + '_BBox'
cube_bbox_final_name = object.Name
cube_bounding_box.length = 1
# The host of the RIB property should cover the bounding box of the original object.
cube_bounding_box.PosX = ( bb_x_max + bb_x_min ) / 2
cube_bounding_box.PosY = ( bb_y_max + bb_y_min ) / 2
cube_bounding_box.PosZ = ( bb_z_max + bb_z_min ) / 2
cube_bounding_box.sclx = bb_x_max - bb_x_min
cube_bounding_box.scly = bb_y_max - bb_y_min
cube_bounding_box.sclz = bb_z_max - bb_z_min
Application.FreezeObj( cube_bounding_box )
This should have generate the bounding box of the selected object.
Now, that this is done, we need to create the RIB archive and assign it to the bounding box using the RIB archive.
To perform this action add the following code line to the previous file:
delight_pref = Application.Dictionary.GetObject( 'preferences.3Delight', False )
if( delight_pref != None ):
delight_pref.ExportMaterialsAndAttributes = False
delight_pref.ExportTransformations = False
# Promp a folder browser to select the location of your RIB File
rib_location = XSIUIToolkit.PickFolder( XSIUtils.ResolvePath( '[Project Path]' ), 'RIB Package Location' )
if( len( rib_location ) != 0 ):
rib_file = XSIUtils.ResolvePath( rib_location + os.sep + object.Name + '_RIB.[Frame #4].rib' )
# This will generate the object RIB for this Frame only
Application.ExportObjectRenderArchive( object, rib_file, int( XSIUtils.ResolvePath( '[Frame #4]' ) ), int( XSIUtils.ResolvePath( '[Frame #4]' ) ), 1, False, False )
# This will add the RIB Property to the object bounding box
rib_property = cube_bounding_box.AddProperty( '3Delight RIB Properties', False, object.Name + '_RIB_PROPERTY_3DELIGHT' )
# This will make sure we are using the delayed mode
rib_property.Parameters( 'ArchiveType' ).Value = 'Delayed'
# This will make sure we are rendering the RIB and not the bounding box object
rib_property.Parameters( 'EnableArchive' ).Value = True
# This will add the RIB file path to the RIB property
rib_property.Parameters( 'ArchiveName' ).Value = rib_file
Application.ResetTransform( cube_bounding_box, 'siCtr', 'siScl', 'siXYZ' )
Application.DeleteObj( object )
At this point, you have just exported your first object as a RIB file and use it for rendering.
You will see that when rendering the result will display the “real” object with the exact same look. Also with this solution, you will still be able to apply transforms to the RIB object and also you will be able to edit the shader, override it or even use camera projection on it.
This can be a major advantage when you are working on very complex scenes.