This is a rather philosophical post about the long term objectives of Hydra 2.0, with instancing used as a case study of sorts, and I’ll start by posing a question: should a Hydra 2.0 renderer rely on the ‘InstancedBy’ schema?
From the schema docs:
Many renderers need to know not what prototypes an instancer has, but rather what instancers a prototype has…
This value is computed based on the instancer topology of instancer prims in the scene.
This is extrinsic data, inherently tied to how much of the scene has been processed, and so isn’t something that would be relied upon by a consumer that expects scene graph data to be static during progressive evaluation, and would not want the entire scene to be processed in order to produce definitive data for a given prim.
The schema has a quite reasonable historical justification (in the context of both USD scene evaluation and the Storm renderer), but to me it seems inappropriate in the Hydra 2.0 ecosystem. It’s expensive to provide (being heavy on book-keeping), and is more suited to evaluation at the point of scene graph consumption: renderers are perfectly able to do this themselves*.
As I understand it, a generic Hydra filtering scene index (HdInstancedBySceneIndex) existed precisely to provide ‘instancedBy’ data as part of the scene flattening process for Hydra 1 render delegates, but interestingly this was removed (perhaps due to performance concerns?) with the introduction of USD-specific instancing scene indices. These are part of the pre-merge scene index bundle, meaning USD scene instancing isn’t really open for manipulation in the subsequent pipeline. (They’re also forced to work around a limitation in the Hydra 1 scene delegate instancing API that mandates a single instancer for any given prototype prim, but that is an aside.)
The suggestion here, then, is that hydra renderers (currently render delegates) move away from relying on ‘instancedBy’ data in favour of ‘instancerTopology’ and direct scene graph access. One would assume that compatibility could be provided via a generic scene index in the vein of HdInstancedBySceneIndex, but its removal suggests there are reasons to avoid this.
Assuming this proposal is actually aligned with the goals of Hydra 2.0, do we think there is a path to consensus?
* There is one additional piece of information that I think would be beneficial as part of a core Hydra schema: designation of a prim hierarchy as being a prototype (instance source) that is not itself part of the rendered scene. Conceptually, this is equivalent to marking a prim hierarchy invisible at a point above the prototype root, rather than at the root, since visibility would ideally be respected at any point in an instantiated hierarchy. This concept will be familiar to those with experience of instancing in Katana.