This is a side project I’ve been working on creating a Houdini HDA turntable tool for use in Solaris using USD. The goal with this project was to create an easily deployable turntable for use with built assets
The Solaris turntable is a Houdini based USD turntable designed to work in the Houdini Solaris stage. It has automatic camera functionality that will center the camera on whatever geometry you supply it regardless of its position in the world, and then rotate the object on its centroid. It can also be supplied with a custom camera. any HDRI can be piped in as well to change the lighting as desired
To make a new turntable start with your asset in the LOPS context, along with a dome light. Then create a new turntable node, and hook the asset to the first input, and the dome light to the last input.
Here is what you will see in the viewport when looking through the turntable camera inside the turntable node. For this example I’m using the ‘Tommy’ test geometry that ships with Houdini. You’ll notice that some shader balls and colour chart geometry is visible in the corner
Camera Settings
in the properties for the turntable node you will see something like this:
There are options to change the resolution / aspect ratio of the supplied camera with a dropdown of common resolutions for convenience. It can also be manually set to any dersired resolution. The shader ball and colour chart will update their position to fit in frame as well when the resolution is changed.
The ‘Focal length’ setting will automatically adjust the focal length of the camera along with its position taking the ‘zoom’ setting into consideration as well. A ‘zoom’ of 1 will position the asset fully filling the frame, while lower values will progressively zoom out
The ‘attitude’ setting will adjust the height of the camera while still maintaining focus on the subject, at attitude of 0 the camera is at the same height as the centroid of the object, and then adjusting up or down will raise or lower the camera around the centroid.
Subject Settings
These are the available subject (asset) specific settings available in the turntable tool properties
The ‘mid-grey shader’ checkbox will automatically override the materials in the full asset to a mid grey shader, checking it off will keep the materials untouched from when they came into the turntable node.
The frame range specifies what the start and end frame of the asset rotation are. by default the start frame is the first frame in the houdini timeline as specified by the ‘$FSTART’ expression. The end frame by default is halfway through the time line as specified by this expression
$FSTART + (($FEND – $FSTART)/2)
These values can be changed as desired
The start and end rotation values specify what angle the subject starts at and what value it ends at – in this case 0 to 360 degrees making a full rotation
The ‘override transforms’ settings allow you to apply offsets to the transformation and rotation of the subject, in this example it starts facing 45 degrees offset from facing down the Z axis.
Light Settings
The frame range and rotation settings here work the same as they do for the asset, except they rotate the light setup independently of the asset. By default is grabs the value for the end of the asset rotation provided earlier as the start frame, and ends at the last frame in the timeline using ‘$FEND’
There is also an override for the rotation of the light if a specific view needs to be dialed in.
Shadow Catcher
The shadow catcher checkbox toggles on and off a ground plane and sphere whose size are automatically calculated based on the bounding box of the provided asset
The show catcher geo is assigned a shadow matte material so that the render will contain a matte for the shadows hitting the ground
Calculating the camera position
Here is some of the vex used in positioning the camera based on the aperture, focal length, and zoom. To be continued
f@zoom = chf("zoom");
f@pixels = min(@pixelWidth, @pixelHeight);
v@dimensions = usd_attrib(0, "/turntable/subject", "dimensions");
if (@dimensions.x >= @dimensions.y) {
@pixels = @pixelWidth;
f@aperture = @horizontalAperture;
}else{
@pixels = @pixelHeight;
f@aperture = @verticalAperture;
}
//f@aperture = max(@verticalAperture, @horizontalAperture);
f@maxDimension = usd_attrib(0, "/turntable/subject", "maxDimension");
v@centroid = usd_attrib(0, "/turntable/subject", "centroid");
f@camDist = (@focalLength * @maxDimension * @pixels) / (@pixels * @zoom * @aperture);
v@xformOp:translate = set(@centroid.x,@centroid.y,@centroid.z + @camDist);
s[]@xformOpOrder = {"xformOp:translate"};
Leave a Reply