Upgrading Houdini From USD 20.08 to 21.02
The current released version of Houdini, 18.5, is built with USD 20.08. Recently, we updated our development baseline to build against USD 21.02. What follows is a description of that process, from a developer perspective. The tasks involved are roughly grouped from least to most complicated.
Simple Renaming
"Master" was changed to "Prototype" in several methods. Regression test results that examined flattened stages needed to by updated because the flattened Prototype prim names now use "Prototype" in their names instead of "Master".
UsdRelationship::BlockTargets replaced by UsdRelationship::SetTargets({})
UsdCollectionAPI::ApplyCollection replaced by UsdCollectionAPI::Apply
UsdSkelCache::Populate and UsdSkelCache::ComputeSkelBindings take a new UsdPredicate argument
Rebuilding schemas
Several changes to schema class templates required regenerating our schema boilerplate code from the schema.usda file
UsdDefinition API changes
GetSchemaPrimSpec (and other methods) were deprecated then removed since 20.08
Had to update code to use newer APIs (GetSchemaPropertySpec mostly, in our case)
UsdGeomModelAPI:
For draw modes to work, the UsdGeomModelAPI schema must be applied to any primitive on which a draw mode is set. Previously the presence of the attribute was enough to make the draw mode work.
If we had been using the Usd APIs everywhere to set draw mode, this may have been a non-issue, but in some cases we were setting the draw mode using Sdf APIs, and this code had to be updated to also modify the apiSchemas metadata.
UsdLux:
UsdLux was updated so that many Light primitive attribute names include an "inputs:" prefix
Various uses of UsdLuxTokens in render delegates had to be updated (caught by compiler)
Generic attribute editing tools (in python and C++) that had been specialized for light editing had to be modified
Some of our code used the UsdLux.Light python APIs directly, and that code did not need to change, as those APIs continue to work as before (but editing the newly named attributes).
The bigger issue is dealing with existing USD files containing the wrong attribute names
Houdini will have to provide a tool to "upgrade" light primitives in existing USD files
UsdImagingValueCache removal:
Although no work was really required as a result of the removal of the value cache, some code changes had to be made to take advantage of this removal. In Karma, when rendering with motion blur, we would use the SamplePrimvar API to get multiple time samples of primvar values. But this call would bypass the value cache. So we also had to call the Get API on the primvar (and throw away the returned value) just to make sure the value didn't live on in the value cache forever.
Indirectly, the removal of the value cache also meant that our UsdImagingPrimAdapter for Houdini field primitives also had to be updated to implement a Get method to return its attributes. Without this change, rendering of Houdini volumes didn't work (though VDB volumes worked fine).
UsdGeomCamera:
UsdGeomCamera gained a new "exposure" attribute which will need to be supported in the Houdini GL and Karma render delegates. This work has not yet been done.
Hydra Instancing changes
HdRenderDelegate::CreateRPrim and CreateInstancer no longer take an instancerId parameter when constructing the HdPrim
Instancers are expected to be set up during the Sync phase instead, like most other render delegate data
Benefits systems that prefer to do traversals at Sync time rather than instancer creation time
To get a render delegate to compile:
Requires modifications to all HdRPrim constructor signatures
Requires modification to HdInstancer constructor
Stopping there creates a properly built render delegate that doesn't do instancing. To make instancing work again:
Needed to add a Sync method to HdInstancer subclass
HdRPrims need to update and Sync their instancer hierarchy in their Sync methods
The HdChangeTracker::DirtyInstancer flag needs to be added to GetInitialDirtyBitsMask return value for all HdRPrims that implement that method
Ar::2.0
This implementation is not production ready at this point, so we did not enable it in the build
License: CC BY 4.0, Copyright Contributors to the ASWF USD working group.