quick look configuration how to write a usdz with?

this week i was watching https://developer.apple.com/videos/play/wwdc2024/10105/

with the amazing "configuration" feature to change the color or mesh straight in quick look, but i tried a lot with goarounds but nothing bring me to success

how do i write in the usda files? anytiome i overwrite the usda even with just a "{}" inside... Reality composer pro rejects the file to be open again

where is the developer man in the tutorial writing the usda?

how is the usda compressed in usdz? (none of the compressors i tried accepeted the modified usda file)

this is the code it's suggested in the video

#usda 1.0 ( defaultPrim = "iPhone" )

def Xform "iPhone" ( variants = { string Color = "Black_Titanium" } prepend variantSets = ["Color"] ) { variantSet "Color" = { "Black_Titanium" { } "Blue_Titanium" { } "Natural_Titanium" { } "White_Titanium" { } } }

but i dont understand how to do it with my own files,

Based on what I read in https://developer.apple.com/documentation/RealityKit/validating-usd-files, the APIs that Apple provides don't (currently?) provide any support for writing out USD files, and specifically for variants - the tooling of the various renderers allows you to select between variants, but it expects the variants to already be defined within the USD file.

There is a Entity.write(to: URL) capability that is new this year, but it creates a proprietary .reality format that isn't a stock USD(a/z) file. Based on my digging, the .reality file is a possibly a super-set of USD, because when it was created, the analog to capabilities needed in RealityKit didn't exist in the USD spec. Which may be (I suspect) still the case today.

i have to process your answer trying to understand it

thank you very much for your explanation... now i have to truly understand it... 😄

I recommend following the tutorial on Pixar's website to learn more about variants and how to author them using the USD API https://openusd.org/docs/Authoring-Variants.html

Additionally, you can also author variants inside 3D applications like Maya and Houdini, but I recommend first starting with the API tutorial above. If you don't have the USD API, you can get it for Python by running pip3 install usd-core. Note that you will need Python installed for this to work.

To convert a USDA file to USDZ, you can use the usdzip command, that is provided as part of macOS 15.

To create the USDZ file, you would run

usdzip output.usdz -a input.usda This will create a file called output.usdz

For example, if I save this text from the Pixar tutorial as input.usda, and run the command above, I will be get back a USDZ file that can be used by the configurator.

#usda 1.0
(
    defaultPrim = "hello"
)

def Xform "hello" (
    variants = {
        string shadingVariant = "green"
    }
    prepend variantSets = "shadingVariant"
)
{
    custom double3 xformOp:translate = (4, 5, 6)
    uniform token[] xformOpOrder = ["xformOp:translate"]

    def Sphere "world"
    {
        float3[] extent = [(-2, -2, -2), (2, 2, 2)]
        color3f[] primvars:displayColor
        double radius = 2
    }

    variantSet "shadingVariant" = {
        "blue" {
            over "world"
            {
                color3f[] primvars:displayColor = [(0, 0, 1)]
            }
        }

        "green" {
            over "world"
            {
                color3f[] primvars:displayColor = [(0, 1, 0)]
            }
        }

        "red" {
            over "world"
            {
                color3f[] primvars:displayColor = [(1, 0, 0)]
            }
        }
    }
}

@Graphics and Games Engineer

Thanks for your explanation! I got a different problem. Would highly appreciate if you could help.

I try to show/hide different meshes. Unfortunately, all examples I could find were about changing the material/color.

I created an .usd with USD Composer and set up the different variants. When I view it in the USD Viewer, I can switch between the different meshes. However, when I convert the .usd to .usdz an want to look at it on my iPhone toggling between my variants doesn’t change anything. Could you please give an example how to archive that? I will also attach my file.

Many thanks!

quick look configuration how to write a usdz with?
 
 
Q