Anchoring a Prim to the face doesn't work

Aloha Quick Lookers,

I'm using the usdzconvert preview 0.64 to create *.usdz files, which I then edit in ascii *.usda format, and then recipe them as *.usdz. This way I was able to fix the scale (the original gltf's usually are in m=1, while the usdzconvert 0.64 always sets the result to m=0.01).

Now I was trying to follow the docs to anchor my Glasses prim on the users face and whatever I try, it will only ever place it on my tables surface.

If I import my *.usdz file into Reality Composer and export it to usdz It does get anchored to the face correctly.

Now when I open the Reality-Composer-Export-usdz it really doesn't look so different from my manually edited usdz (it just wraps the Geometry in another layer, I assume because the import-export through Reality-Composer).

What am I doing wrong?

Here's the Reality Composer generated usda:

#usda 1.0
(
    autoPlay = false
    customLayerData = {
        string creator = "com.apple.RCFoundation Version 1.5 (171.5)"
        string identifier = "9AAF5C5D-68AB-4034-8037-9BBE6848D8E5"
    }
    defaultPrim = "Root"
    metersPerUnit = 1
    timeCodesPerSecond = 60
    upAxis = "Y"
)

def Xform "Root"
{
    def Scope "Scenes" (
        kind = "sceneLibrary"
    )
    {
        def Xform "Scene" (
            customData = {
                bool preliminary_collidesWithEnvironment = 0
                string sceneName = "Scene"
            }
            sceneName = "Scene"
        )
        {
            token preliminary:anchoring:type = "face"
            quatf xformOp:orient = (0.70710677, 0.70710677, 0, 0)
            double3 xformOp:scale = (1, 1, 1)
            double3 xformOp:translate = (0, 0, 0)
            uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:orient", "xformOp:scale"]

 // ...

and here is my own , minimal, usdz with the same face-anchoring-token:

#usda 1.0
(
    autoPlay = false
    customLayerData = {
        string creator = "usdzconvert preview 0.64"
    }
    defaultPrim = "lupetto_local"
    metersPerUnit = 1
    timeCodesPerSecond = 60
    upAxis = "Y"
)

def Xform "lupetto_local" (
    assetInfo = {
        string name = "lupetto_local"
    }
    kind = "component"
)
{
    def Scope "Geom"
    {
        def Xform "Glasses"
        {
            token preliminary:anchoring:type = "face"
            double3 xformOp:translate = (0, 0.01799999736249447, 0.04600000008940697)
            uniform token[] xformOpOrder = ["xformOp:translate"]

// ...

I'd add the full files, but they are 2Mb of size and the max file size is 200kb. I could create a minimal example file with less geometry in case the above code is not enough.

Accepted Reply

So it seems just putting the line token preliminary:anchoring:type = "face" in was not enough.

What worked was writing a python script, importing the from pxr import Usd, Sdf, UsdGeom, Kind stuff and then creating a scene hierarchy with /Root/Scenes/Scene/Children/MyModel where the scene gets the anchor-token. The USD Classes reference (https://graphics.pixar.com/usd/docs/api/class_usd_stage.html) helped a little but It was way more complicated then I expected it to be.

Replies

So it seems just putting the line token preliminary:anchoring:type = "face" in was not enough.

What worked was writing a python script, importing the from pxr import Usd, Sdf, UsdGeom, Kind stuff and then creating a scene hierarchy with /Root/Scenes/Scene/Children/MyModel where the scene gets the anchor-token. The USD Classes reference (https://graphics.pixar.com/usd/docs/api/class_usd_stage.html) helped a little but It was way more complicated then I expected it to be.