Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AY-6685_Maya USD: Rig in USD Asset as MayaReference prim #10

Open
2 tasks done
BigRoy opened this issue Dec 27, 2023 · 1 comment · May be fixed by #132
Open
2 tasks done

AY-6685_Maya USD: Rig in USD Asset as MayaReference prim #10

BigRoy opened this issue Dec 27, 2023 · 1 comment · May be fixed by #132
Assignees
Labels
sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition

Comments

@BigRoy
Copy link
Contributor

BigRoy commented Dec 27, 2023

Is there an existing issue for this?

  • I have searched the existing issues.

Please describe the feature you have in mind and explain what the current shortcomings are?

Working within a USD Pipeline usually means you want your animation output for e.g. a rig to be overlaid on top of a loaded USD Asset to merge the animated point data with the model and look of the asset, usually for use by downstream lighting department.

The USD reference usually provides:

- asset (referenced usd asset)
  - geo
  - mtl

The output data from a rig should then be overlaid over the /asset/geo path in the shot to move the character around.

Currently, publishing an animation from a rig usually means completely separate Alembic or USD data that would need to somehow be identified to get overlaid over a particular USD asset structure in a shot.

What if we could load an asset, and it itself, has a reference to the rig embedded?

How would you imagine the implementation of the feature?

Maya USD allows to embed maya scene files (mayaAscii or mayaBinary) to be included into USD as a MayaReference prim referencing the file. When a Maya USD Proxy finds such a prim it can enable the prim as a regular maya reference to load the native maya data, like for example a rig file.

I'd like to propose to - whenever publishing a rig from Maya to write out a USD Asset Contribution where an extra layer gets added to the USD asset representing the rig as a reference.

Basically someone (e.g. either in Maya or Houdini) lays out assets in a scene, by loading the asset USD. If that asset now contains the MayaReference prim (which can be loaded fine in Houdini; just the internal data of the maya scene couldn't be loaded) then in Maya one could now enable that reference inside the USD Asset to load the actual rig.

So assets laid out in any USD supporting host could in Maya be switched to their rig for animating. Nice!

In essence we'd need:

  1. On publishing a Maya rig, create a USD asset contribution that references in this rig version in a USD layer
  2. On Maya, when the Maya USD reference rig is loaded (and its detected its loaded within USD asset) then publish the animation cache as USD that gets added as a variant on the loaded asset in the shot's anim layer.

That way, the animator in Maya can just read a USD Layout with loaded assets, enable the reference, animate and publish.

Plus side to this would be, that when they've published their animation to the shot's layers they can also disable their reference and switch it over it to the published cache (since it's also a USD contribution). Meaning they can use the cached USD data as proxy in their scene whilst maybe e.g. continuing to animate on another character.

Are there any labels you wish to add?

  • I have added the relevant labels to the enhancement request.

Describe alternatives you've considered:

Loading rigs manually, then publishing and manually overlaying (e.g. referencing) the output over the USD data over an asset, after the fact.

Additional context:

No response

[cuID:OP-7978]

@BigRoy BigRoy transferred this issue from ynput/OpenPype Jul 3, 2024
@m-u-r-p-h-y m-u-r-p-h-y added type: enhancement Improvement of existing functionality or minor addition sponsored This is directly sponsored by a client or community member labels Sep 4, 2024
@m-u-r-p-h-y m-u-r-p-h-y changed the title Enhancement: Maya USD: Rig in USD Asset as MayaReference prim AY-6685_Maya USD: Rig in USD Asset as MayaReference prim Sep 4, 2024
@BigRoy BigRoy self-assigned this Sep 17, 2024
@BigRoy
Copy link
Contributor Author

BigRoy commented Sep 17, 2024

Just for reference. This is a simple Maya reference inside the USD data:

#usda 1.0

def Xform "Xform1" (
    variants = {
        string Representation = "MayaReference"
    }
    prepend variantSets = "Representation"
)
{
    variantSet "Representation" = {
        "MayaReference" {
            def MayaReference "MayaReference1"
            {
                bool mayaAutoEdit = 0
                string mayaNamespace = "test"
                asset mayaReference = @C:/Users/User/Desktop/test.ma@
            }

        }
    }
}

And some quick code to generate the relevant prim specs via Sdf:

from pxr import Usd, Sdf


layer = Sdf.Layer.CreateAnonymous()


parent = layer.pseudoRoot
prim_name = "rigMain"


def create_maya_reference_prim_spec(
    parent,
    prim_name: str,
    path: str,
    namespace: str):
    """Create MayaReference Prim Spec"""
    prim_spec = Sdf.PrimSpec(
        parent,
        prim_name,
        Sdf.SpecifierDef,
        "MayaReference"
    )
    reference_spec = Sdf.AttributeSpec(prim_spec, "mayaReference", Sdf.ValueTypeNames.Asset)
    reference_spec.default = path
    auto_edit_spec = Sdf.AttributeSpec(prim_spec, "mayaAutoEdit", Sdf.ValueTypeNames.Bool)
    auto_edit_spec.default = False
    namespace_spec = Sdf.AttributeSpec(prim_spec, "mayaNamespace", Sdf.ValueTypeNames.String)
    namespace_spec.default = namespace
    return prim_spec


create_maya_reference_prim_spec(
    layer.pseudoRoot,
    "rigMain",
    path="E:/test.ma",
    namespace="test"
)

print(layer.ExportToString())

Results in:

#sdf 1.4.32

def MayaReference "rigMain"
{
    bool mayaAutoEdit = 0
    string mayaNamespace = "test"
    asset mayaReference = @E:/test.ma@
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants