USD Hydra: don't write images to disk
The idea is that Blender implements a custom Asset Resolver that is used by the Hydra render delegate.
Delegates that use the ArResolver API should be able to automatically resolve images and other files using a resolver bound by the Hydra runtime. As using the Ar API is not a requirement, the Python plugin could explicitly advertise support.
The implementation of the resolver would return the memory based on requested paths, with unknown paths being handled by the default resolver.
3 Comments
Can you be more specific how an Asset Resolver would help you not writing images to disk? Or is the issue that the hydra delegate cannot read images that are packaged inside the blend file. Keep in mind an asset resolver returns a string so it cannot read data from inside the blend file
ArResolver is not only used to resolve paths, but also as an API to read and write data. For instance, here USD's stb Hio implementation uses the default resolver for I/O: github.com/PixarAnimationStudios/OpenUSD/blob/2864f3d04f396432f22ec5d6928fc37d34bb4c90/pxr/imaging/hio/stbImage.cpp
Render delegates that want to support USDZ files need to implement asset reading using ArResolver to do so.
A custom resolver can provide its own memory by overwriting the
_OpenAssetfunction. Here is one example .I believe that a custom resolver can be bound using an
ArResolverContextBinderby the Hydra runtime. It could use a custom URI prefix to indicate Blender-internal paths (e.g.bln://texture_ID) and forward non-matching requests to the default resolver.hey thanks for the links. I wasn't aware AR can do that. In that case that would indeed be very useful. Would need to check if the way blender stores images internally is compatible with USD or if the data needs to be translated in some way.