Using a parent prim's name in reference as a variable?

I am looking at porting features of our internal scene description to USD (or at least evaluating the differences between them - which there are many).

One of the features of our scene description is a variable syntax which allows us to define the scene graph location (/character/bobA01/main) and which asset(s) (a usd file for shaders, or a model etc) may exist or may not (effectively its a templating mechanism) on the prim/scene graph location.

One of the features of this is that our “asset nodes” which resolve to asset versions on disk can use variables to define the resulting posix file path.

As a side note we have no “Asset.usda” file for an “Asset” our definintion of “Asset” is pretty loose and is made up of muliple “nodes” that are stacked next to each other which in turn build a payload/reference list.

In the example above we may have asset nodes for:

  • model
  • anim-cache
  • creature-cache
  • materials

these are payloads which contain a simple internal struture based on the ASWF Asset guilelines (their default prim is /ASSET)

The resulting file paths end up payloaded onto /character/bobA01 and compose together as excepted.

The animation is a shot cache which contains only the points which have been deformed and is layered with the model (asset).

Our variable syntax uses the parent hierarchy to determine the asset path locations.

The UI we have has variables in it and it forms a dict of tags basically…those tags are evaultaed by the expression engine and it gives back a path

  • /asset/$job/$seq/$shot/components/$node[-2].label-$node[-1].label/usdCache/anim

so when we evaluate that with the parent(s): /character/bobA01/main it becomes:

  • /asset/USD/TST_0100/TST_0100_0010/components/bobA01-main/usdCache/anim

If we need two bobs we simply duplicate /character/bobA01 and it becomes /character/bobA02 and the anim-cache location becomes:

  • /asset/USD/TST_0100/TST_0100_0010/components/bobA02-main/usdCache/anim

Currently we basically make everything unique - but the gotcha is these two share the same shaders, model, procedural fur etc.

Is there any way to use a parent prim’s name (when its referenced) in an SdfPath SdfReference/Payload?

Appologies if that makes zero sense!

Hi @patricknagle ! Question makes sense for sure. However, it’s not a behavior USD supports, for a couple of reasons. Starting from the position of wanting to provide predictable results, composition itself makes the prospect a little challenging, especially when you bring sub-root references and non-global inherits into the picture. When we sub-root reference something, we make sure to evaluate all the composition arcs on ancestor prims of the referenced prim, to ensure it gets all the opinions/contributions you’d expect. So presumably you’d want any references in that layerStack to use that layerStack’s namespace… but then the ancestral namespace is hidden/gone in the referencing stage, so it’d be a little mystifying figuring out how you get the substitution you did. But then also, it seems like for most reference substitutions you’re looking to use the root layer / stage’s namespace for parenting, which I think is different from the needs of subroot references.

Then there’s namespace editing… if you move a model-reference-prim from one scope to another, would you be expecting the model might radically change in response?

For non-composition asset paths (e.g. textures, volumes, etc), we hope to be getting to the project soon that will allow primvar substitution in the asset paths, and primvars can be inherited hierarchically down namespace. But that mechanism could never be applied for composition arcs, because it assumes lots and lots of scenegraph, value resolution, and schema behavior that is much higher-level than composition.

Asset resolvers, by design, can’t get access to any “stage level” data other than the asset path itself that is being resolved. I’m unable to come with any ideas about how you might get anything close to this behavior in USD, I’m afraid!

Hey,

I suspected as much. Our internal scene description does not have any composition element to it. We do have a similar ability to “scene reference” a sub-path into another scene description and this has brought up issues with the variable syntax in our asset paths. Especially when a node is pulling the name/attribute off a node 3-4 levels up the source scene description and then it’s being referenced into a scene description with only 2 levels of parents!

Regarding
Then there’s namespace editing… if you move a model-reference-prim from one scope to another, would you be expecting the model might radically change in response?

We can’t really move the model/shader etc reference in our scene description without “localising” the entire thing (which looses it’s connection to its original content). We can rename/move the parent nodes like /character/bobA01 to /characters/BobA01 which would effect the asset paths resolution. This is purely a convention that has become common place and built on…it tightly couples asset paths and the scene graph together and makes duplicating easy but can lead to things breaking and people not understanding why.

Thanks as always! The primvar stuff sounds super useful! Is there a proposal for that one that I could read?

Patrick

No proposal yet for primvar substitutions, sorry.