USD Asset Resolver - Practical Example/Reference Implementations

Hi everyone,

as part of the USD Survival Guide (Forum Post / Website) there is an asset resolver sub-section. Apart from giving an overview of what the asset resolver is/does, it also has some example resolvers.

In the last few weeks I’ve added some more updates and made the install process for Houdini easier, so I’d thought I’d re-share it here (separately from the guide post), to make it more visible in the forum.

You can now “1-Click” install the example resolvers via the update manager:
UsdAsserResolverUpdateManager

Here is the documentation on how to run it: USD Asset Resolver - Automatic Install

I hope this is useful for smaller studios in helping them get up and running with USD without having to do C++ coding.

Currently the repo holds these resolvers:

  • Production Resolvers
    • File Resolver - A file system based resolver similar to the default resolver with support for custom mapping pairs as well as at runtime modification and refreshing.
    • Cached Resolver - A resolver that first consults an internal resolver context dependent cache to resolve asset paths. If the asset path is not found in the cache, it will redirect the request to Python and cache the result. This is ideal for smaller studios, as this preserves the speed of C++ with the flexibility of Python.
  • RnD Resolvers
    • Python Resolver - Python based implementation of the file resolver. The goal of this resolver is to enable easier RnD by running all resolver and resolver context related methods in Python. It can be used to quickly inspect resolve calls and to setup prototypes of resolvers that can then later be re-written in C++ as it is easier to code database interactions in Python for initial research.
  • Proof Of Concept Resolvers
    • Http Resolver - A proof of concept http resolver. This is kindly provided and maintained by @charlesfleche in the arHttp: Offloads USD asset resolution to an HTTP server repository. For documentation, feature suggestions and bug reports, please file a ticket there. This repo handles the auto-compilation against DCCs and exposing to the automatic installation update manager UI.

Here are some resource links:
Website: USD Asset Resolver - GitHub Pages
GitHub: GitHub Repository
USDSurvivalGuide: Asset Resolver - Section

Currently we only auto-compile against Houdini, if someone from the other major DCC vendors is interested in adding their app to the list, please get in touch :slight_smile:

A video tutorial showing how to install and customize some of the resolvers, will follow some time in the next week. (Everything is also already covered in written form in the docs already.)

I’d love to hear your feedback! If you stumble upon any other interesting open source resolvers, let me know and we can try adding them too. I can also give a quick live demo in a working group if anyone is interested.

Cheers,
Luca

11 Likes

This is a great addition to an excellent resource. Thanks!

1 Like

Hi everyone,
there is now also a video tutorial available on how to install (and optionally build) the OpenUSD asset resolver production/reference implementations that are available in the above mentioned Usd Asset Resolver repository.

The tutorial covers how to use the automatic installation manager for Houdini, to easily install all resolvers with a few clicks, as well as how to build them yourself. We also look at how you can customize them to fit your needs without having to code in C++. This is especially useful for smaller studios, who often don’t have the C++ development resources.

You can view it here:

You can also view tutorials on our tutorials section in the UsdAssetResolver documentation.

Let me know what you think!
Cheers,
Luca

3 Likes

Thank you so much for this Luca

i successfully installed and test the resolver, and all test and examples works as expected, i’m trying to figure out how this can be used in our pipeline, but not sure how to “attack” this.

I got a path that looks like this
@./asset/char/mr-X/model/pub/latest/mr-X-model-latest.usd@

we want this path to resolve to an actual version on disk, so something like this.
F:/myMovie/char/asset/mr-X/model/pub/v004/mr-X-model-v004.usd

So in the case above we want to replace the word latest with v004 , and then add the achor path dependent on the os .

i guess we could use the mappingPairs and then add one entry for each layer in my stage, but imagine this could be a pain to maintain when new versions are published, and new layers are added to my stage. The mappingPairs has to be dynamically updated whenever something changes.

We are probably going about this in the wrong way, so any suggestions on how latest can resolve to an actual version on disk is appreciated

Btw. we talked at siggraph, thank you again for the your greate talk there :smiley:

Ok i think i understand this better now, the mappingPairs could probably be a good way to pin versions, and maybe this is also the intension behind it?

For resolving latest version, there’s probably better ways of doing this i guess. I played around with the Python Resolver, and got it to do what i want.
But as you stated, it should probably not be used in in bigger production scenes.

I also looked into the Cached Resolver, it almost does what i want, but i need access to the full assetPath. In other words, say i got a layer that is relative to another layer, like in the image bellow. Is there a way i can get the resolved full path inside ResolveAndCache?

I need access to the full path so i can extract the name of the asset and the asset type from the full path.
assetType = char
assetName = mychar

Thanks

Hey, sorry for the late reply.

So the idea is for non-pinned entries to be resolved and cached via the
Python exposed ResolveAndCache method.

The reason why it is currently not working is because the “CachedResolver” doesn’t pass relative paths (anything starting with “./” or “…/” through the ResolveAndCache), only paths that don’t start with “/”, “./” or “…/”. This is intentional to allow fast C++ based resolving of relative paths. (See the features here for more info.)

Someone else also contacted me recently and asked if we can add relative identifier support too, I’m currently working on it, should release some time in the next week. I’ll add some more production relevant examples too to make it easier to understand.

So your solutions are:

  1. Make all identifiers that should go through Python not start with “/”, “./” or “…/”
  2. Wait for the above mentioned update

Going with 1. is actually cleaner, because for 2. to work, we have to pre-process the identifier since the USD resolver resolve method is not anchor path aware. That means the update will expose hooking into the CreateIdentifier method and not the Resolve method. I’ll add more docs on that with the update.

Ok i think i understand this better now, the mappingPairs could probably be a good way to pin versions, and maybe this is also the intension behind it?

Yes that should be used for pinning.

About the OS based anchor path, that is something we could add in C++ too, I’ll keep it in mind for future updates. For now I’d recommend making your asset path this @asset/char/mr-X/model/pub/latest/mr-X-model-latest.usd@ and adding the OS drive ext in the ResolveAndCache method (or when you add a mapping pair value).

Sorry if this answer seems a bit chaotic, it should become clearer once the update is released.

Cheers,
Luca

1 Like

Hey,
I’ve just released the update that now allows exposing relative file paths to Python on the CachedResolver.

All you need to do is set the “AR_CACHEDRESOLVER_ENV_EXPOSE_RELATIVE_PATH_IDENTIFIERS” environment variable to “1” or “true”. Then the relative identifier creation is also run through Python and cached.

I’ve also added a small production case study example to further explain it and how it can be used as a opt-in mechanism to override relative paths.

Let me know if that solves your issues and if the documentation is understandable. If not I’m happy to enhance it :slight_smile:

Links:
CachedResolver - Docs - Relative File Path Identifier
CachedResolver - Production Case Study

2 Likes

Thank you so much Luca, this works perfect :slight_smile:

I was able to compile the resolvers for Maya 2024 on windows, i can share the modified cmake files with you.

Maya 2022 on the other hand, did not work, i think the reason may be that its using a older usd version 21.11. I will look closer into this as we are currently on maya 2022.5

Thanks Again