Views
SoftImageXSIToHoudini
From Odwiki
There is no solution to transport an entire scene into Houdini presently.
Contents |
[edit] To Houdini
[edit] Geometry
You can export Wavefront .obj files from XSI via File->Export->Obj and import them into Houdini. In Houdini you can use the FileSOP to bring your mesh in.
If you have non-deforming animation on your object you can write out a .chan file for the transformations and load it up into Houdini via a File CHOP. A simple modification of the camera script below will allow you to write out channel data for objects and lights.
For deforming objects, it's probably best to write a sequence of .obj files from XSI.
[edit] Camera Transformations
You can export the global positions of the camera via script which writes to a file and then in Houdini, you can use a FileChop to import the translation and rotation data.
Before running the script (below), it's advised that you "cut" your camera from its hierarchy to put it in world space. Just make sure the Camera's parent is the Scene_Root.
You should also plot all transformations of the camera to ensure a value is recorded for every frame when you run the script.
Here's a simple python script which will grab the camera's position per frame and write it out to a file:
[edit] The Camera Script
You can save this script as H_CamExporter.py if you wish.
"""
Change the values just below User Parameters. Should be quite clear
on what you need to do!
"""
#------------------------------------------------------------------
# USER PARAMETERS
#------------------------------------------------------------------
# Your Camera Name
Camera = "Camera"
# The full path to the file
File = "/home/HCam.chan"
# Start Frame
Start = 1
# End Frame
End = 100
#------------------------------------------------------------------
# FUNCTION
#------------------------------------------------------------------
def Export_HoudiniCam(Camera, File, Start, End):
# Pointer to Application
XSI = Application
# Open file for writing
f = open(File, 'w')
# Loop through the sequence of frames and write to file
for i in range(Start, End+1):
#Move the timeline to the val of i
XSI.SetValue("PlayControl.Current", i, "")
# Get Positions at current time
Posz = XSI.GetValue( "Scene_Root." + Camera + ".kine.global.pos.posz", i)
Posx = XSI.GetValue( "Scene_Root." + Camera + ".kine.global.pos.posx", i)
Posy = XSI.GetValue( "Scene_Root." + Camera + ".kine.global.pos.posy", i)
#Get Rotations at current time
Roty = XSI.GetValue( "Scene_Root." + Camera + ".kine.global.roty", i)
Rotx = XSI.GetValue( "Scene_Root." + Camera + ".kine.global.rotx", i)
Rotz = XSI.GetValue( "Scene_Root." + Camera + ".kine.global.rotz", i)
# Gather all the Positions and format for writing
Pos = "%f \t %f \t %f \t" % (Posx, Posy, Posz)
# Gather all the Rotations and format for writing
Rot = "%f \t %f \t %f" % (Rotx, Roty, Rotz)
# Information to write
Info = Pos + Rot
# Write Info to file and enter a new line
f.write (Info + "\n")
# Close the file
f.close
# Tell the user we are all done and give full path to file
print "Export of Houdini Camera Complete!"
print "The Houdini Camera file is located at: " + File
# A little beer humor
print "It's beer o'clock!"
return 1
#------------------------------------------------------------------
# FUNCTION CALLER
#------------------------------------------------------------------
Export_HoudiniCam(Camera, File, Start, End)
Run the above script to write out the data. Now in houdini all you need to do is fetch this file with a FileChop!
[edit] Camera Focal & Aperture
You will have to manually change the focal length and aperture of the Houdini camera to match that of the XSI camera.
You can use the following guidelines:
Houdini Aperture = XSI Film Aperture X Value / 0.03936981
Houdini Focal Length = XSI Focal Length



