TimvanScherpenzeel / gltf-to-usdz-research

Research and proof of concept of converting glTF to USDZ for AR Quick Look (iOS 12+).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discussion

wave-electron opened this issue · comments

Hi Tim,

Firstly, thanks for sharing everything you've done with USDZ recently. There is a lack of information on this new format, I haven't found anything on creating a USDZ animation except the usda example of the spinning top in the pixar usd docs.

Just wanted to let you know that I successfully installed USD on my mac system version 10.13.5 today.

usdcat is converting between the usda -> usdc
usdview is working with gui.

It was a struggle getting the thing to build... it took nearly the whole day.

I followed your build instruction, however, at one stage during the build it complained about qt5 missing so I installed that as well. I also had other build problems because I screwed with

  sudo xcode-select --switch /Applications/Xcode-beta.app

as my version was name /Applications/Xcode-beta 10.app

screenshot

Anyway, thought I'd share just to let you know it does build eventually on Mac!

Hi Ashley, thanks for the heads up!

That is great to hear 👍. I suspect that I have some issues because I have multiple versions of Python on my machine and it is linking to the wrong one. I'll add the note about QT5 to the README.

If you are interested in helping out (and have the time), would you be able to convert these USDC files (from the AR Quick Look gallery from Apple) to USDA? It will help me get a better idea of how the USDA format is supposed to look so I can possibly remove unnecessary syntax.

USDC.zip

Many thanks in advance,

Tim

Hi Tim,

Sure I can help out with that, just give me a couple of days . I’ve also set up my own online Quick Look gallery. I’ll be adding more 3D assets each week as I model them over the coming months. I also worked out how to create a USDZ animation today.... its tagged animated on my gallery. I did it using the usd ascii file with a reference obj asset.

I really can’t thank you enough, alot of what you posted on this repo reallly filled in some missing bits of the puzzle for me.

Regards,

Ash

Hi Ash,

Awesome, thank you!

Animation is a bit tricky because as you most likely have noticed as well is that the shadow is generated on the first frame and doesn't get updated throughout. It will require some creative thinking to make it less noticeable (they show a nice example on https://developer.apple.com/videos/play/wwdc2018/603/ at around 24:30 onwards). I'm very curious about the skeletal animation.

That is great to hear 👍!

Tim

Thats right, the shadow gets referenced only on a single frame. Quick Look as a format certainly has its limitation, but still has its place in the scheme of things. My guess is most of the 3D authoring tools will release USDZ exporters. I know from a recent Cheetah3D discussion forum, the Developer Martin is willing to add USDZ support time permitting.

Thanks Ash,

I've had a look at the generated USDA files and it appears that the generated USDA file by gltf-to-usdz is very similar in structure so no really big new findings. Hopefully Apple will release an example soon with animation (especially skeleton animation). I've decided not to upload the USDA files to this repo as it might cause some copyright issues.

I'll consider this ticket as closed.

Re-opening to keep the discussion in a single thread in case other people want to join the conversation in the future. There is some good information in here and I think it would be good to keep it in one place.

I am joining here, although perhaps at this point there is not much to add. So far I have only manage to export OBJ that seems to link the Albedo map without issue. Other maps should work but apparently usdz_converter is not linking the map properly, depending on the OBJ. It is strange.

But I am still reading some of little documentations, including what you have written here.

Perhaps at some point somebody will actually make Blender Add-On. Perhaps with helps of Tim and Ashley here :]

I saw some USDZ from Ashley, animated gears one is interesting.
Tim's helmet USDZ which was converted from GLTF is also pretty awesome.

Ideally:
OBJ to USDZ should be a bit more straight forward.
DAE should just work with armature etc.

So far, I can see there is plugins for Maya, Houdini, Katana, but not for Blender yet.

I think I will try to study their Python tool to generate USDA (ASCII) and so the USDZ convertor then makes a bit more sense to pack it into a simple file for AR.

Hi @enzyme69,

Sound like great plans! I had the same issue with the usdz_converter where it would generate partial USDA files, something that Apple will have to fix. Because this tool generates the USDA file itself and passes that to the usdz_converter for conversion to USDZ this workflow has been working fine.

One of the best starting points for me was to watch https://developer.apple.com/videos/play/wwdc2018/603/ which covers many of the oddities (like the pivot point or shadow baking on the first frame).

Hi Jimmy,

Have you looked at Alembic exporter from Blender?

If its not listed as one of your exporters in Blender you should be able to enable it from add-ons.

I was able get a simple translation animation exported to Alembic file and then using xcrun file.abc file.usdz worked to create the animation.

With "animation", just now I am testing Alembic export from Blender and getting this error when converting the ABC into USDZ.

Warning: in _ReadXform at line 2984 of /Library/Caches/com.apple.xbs/Sources/ModelKit/ModelKit-1.94.15/ModelKit/extern/usd/pxr/usd/usdAbc/alembicReader.cpp -- Ignoring transform that doesn't inherit at samples at time 0.041667 at </cube>
Warning: in _PostUnsupportedValueWarning at line 215 of /Library/Caches/com.apple.xbs/Sources/ModelKit/ModelKit-1.94.15/ModelKit/extern/usd/pxr/usd/usdAbc/alembicReader.cpp -- Unsupported visibility detected in archive '/Users/jimmygunawan/CubeY.abc'. Using 'kVisibilityDeferred' instead.
Warning: in _ReadXform at line 2984 of /Library/Caches/com.apple.xbs/Sources/ModelKit/ModelKit-1.94.15/ModelKit/extern/usd/pxr/usd/usdAbc/alembicReader.cpp -- Ignoring transform that doesn't inherit at samples at time 0.041667 at </cube>

I'm not exactly sure what this "ignoring transform that doesn't inherit at samples at time 0.041667" means... but I've created several animations which seem to work, except sometimes scaling, and or orientation has to be fine tuned... sort of trial & error.

Maybe Blender Alembic output is not compatible with USDZ converter yet, the USDA of my Alembic is like below: (it's just a Torus randomly moving and rotating, baked anim)

@wave-electron If not too much trouble can you upload zipped Alembic from Maya? The USDA itself seems to be just pointing to the Alembic.

#usda 1.0
(
    endTimeCode = 200
    startTimeCode = 1
    timeCodesPerSecond = 24
    upAxis = "Y"
)

def Scope "Materials"
{

    def Material "StingrayPBS_0"
    {
        token inputs:frame:stPrimvarName = "Texture_uv"
        token outputs:displacement.connect = </Materials/StingrayPBS_0/pbrMat1.outputs:displacement>
        token outputs:surface.connect = </Materials/StingrayPBS_0/pbrMat1.outputs:surface>

        def Shader "pbrMat1"
        {
            uniform token info:id = "UsdPreviewSurface"
            float inputs:clearcoat = 0
            float inputs:clearcoatRoughness = 0
            color3f inputs:diffuseColor.connect = </Materials/StingrayPBS_0/color_map.outputs:rgb>
            float inputs:displacement = 0
            color3f inputs:emissiveColor.connect = </Materials/StingrayPBS_0/emissive_map.outputs:rgb>
            float inputs:ior = 1.5
            float inputs:metallic.connect = </Materials/StingrayPBS_0/metallic_map.outputs:r>
            normal3f inputs:normal.connect = </Materials/StingrayPBS_0/normal_map.outputs:rgb>
            float inputs:occlusion.connect = </Materials/StingrayPBS_0/ao_map.outputs:r>
            float inputs:opacity = 1
            float inputs:roughness.connect = </Materials/StingrayPBS_0/roughness_map.outputs:r>
            color3f inputs:specularColor = (1, 1, 1)
            int inputs:useSpecularWorkflow = 0
            token outputs:displacement
            token outputs:surface
        }

        

        def Shader "Primvar"
        {
            uniform token info:id = "UsdPrimvarReader_float2"
            float2 inputs:default = (0, 0)
            token inputs:varname.connect = </Materials/StingrayPBS_0.inputs:frame:stPrimvarName>
            float2 outputs:result
        }

        
        
    }

}
def "Mesh_0" (
    add references = @/Users/jimmygunawan/dancingTorus.abc@</Torus>
)
{
    rel material:binding = </Materials/StingrayPBS_0>
}

@TimvanScherpenzeel Hope you don't mind it's slightly off topic.

With GLTF, I am actually curious how dev and artist use it so far. Because I am from 3D background, I have only use GLTF when Facebook announce GLB (under 3MB) for their 3D post. I do see GLTF used interactively on web, from Verge3D.

What software has been using GLTF? Is it popular because of KhronosGroup and SubstancePainter?

Jimmy,

Great to see you got the animation working in USDZ! Unfortunately it seems Alembic -> USDZ has problems getting the textures right. The scaling and positioning of the textures is all strange. I've tried every combination of settings on the Alembic exporter. Its also apparently doing the same using the Maya Alembic exporter. You can follow the thread discussion on this issue here

So for now it looks like until Apple sorts out some of these teething problems with the usdz_converter its hard to progress much further in relation to animations.

@wave-electron I have not managed to export the Alembic animation somewhat. I have tested all kind of animation:

  • keyframed
  • bone based
  • vertex animation

None actually works... and with UV business, Apple also needs to fix that. Still early I guess, they still have July, August, September :)

Btw, if you have a simple Blend animation, I would like to check it out. You can zip and upload to Github.

@enzyme69 Yeah I had the same issue with Alembic not working on keyframed, boned based etc. We'll have to wait and see I guess

@wave-electron I am looking at your gears animation, still wondering how you manage to export those from Blender.

Hi @enzyme69, glTF has become the standard for publishing PBR 3D content on the web (when using WebGL). Glb, the binary representation, is seen as a final distribution format so it is highly optimized and GPU ready. One major advantage is that many of the tools the industry uses are showing interest in glTF so that means it will become much easier for these models to make their way to the web.

Some of use use Draco compression to lower the filesize, this however does require decoding it in the browser which has quite an upfront cost. Three.js has good support for loading glTF + Draco. Simply put, it is the smallest filesize you can get in the browser.

I have written a converter for glTF to glb (with Draco support) with a pre and post process hook to allow further manipulation of the file: https://github.com/timvanscherpenzeel/gltf-to-glb.

You can try it out here: https://timvanscherpenzeel.github.io/gltf-to-glb/ (WebGL, Three.js)

I updated my XCode 10 to Beta 4, now Alembic convert using usdz_converter which output USDA file with a lot more description. It's promising 👍 although as AR Quick Look, animation does not seem to load yet...

Maybe we just need to be more patience.

Btw, at some point, my usdview, usdcat (all kind of USD tools) actually works, but somewhat it never work again, I have been trying to properly do this with all kind of built, but failing, even trying all the VFXPro99 USD Build Club. I am getting Python crashing too.

Ideally, Pixar / Apple should give USD Add-On that works with Blender Python 3. And also the USD install compile should be a little simpler.

Previously, I was using Anaconda and all kind of Conda environment, but that seems to confuse Mac even more. I deleted all my Conda environment, back to Python 2 that comes with Mac. Now currently compiling the USD following the procedure described here in this GitHub.

I am closer to being able to convert GLTF to USDZ also, that part involving ThreeJS is not something I am familiar with.

#usda 1.0
(
    defaultPrim = "cube"
    doc = "/Users/jimmygunawan/Desktop/cube_usdz_001.blend"
    endTimeCode = 1176
    framesPerSecond = 24
    startTimeCode = 0
    timeCodesPerSecond = 1
    upAxis = "Y"
)

def Mesh "cube"
{
    float3[] extent.timeSamples = {
        1: [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)],
    }
    int[] faceVertexCounts.timeSamples = {
        1: [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
    }
    int[] faceVertexIndices.timeSamples = {
        1: [2, 1, 0, 3, 2, 0, 6, 5, 4, 5, 7, 4, 1, 6, 0, 6, 4, 0, 5, 2, 3, 7, 5, 3, 4, 7, 0, 7, 3, 0, 5, 6, 1, 2, 5, 1],
    }
    uniform token orientation = "leftHanded"
    point3f[] points (
        interpolation = "vertex"
    )
    point3f[] points.timeSamples = {
        1: [(-0.5, -0.5, 0.5), (0.5, -0.5, 0.5), (0.5, 0.5, 0.5), (-0.5, 0.5, 0.5), (-0.5, -0.5, -0.5), (0.5, 0.5, -0.5), (0.5, -0.5, -0.5), (-0.5, 0.5, -0.5)],
    }
    float2[] primvars:uv (
        interpolation = "faceVarying"
    )
    float2[] primvars:uv.timeSamples = {
        1: [(0.25, 0), (0.25, 0.25), (0, 0.25), (0, 0), (0.25, 0), (0, 0.25), (0.5, 0.25), (0.5, 0), (0.25, 0.25), (0.5, 0), (0.25, 0), (0.25, 0.25), (0.25, 0.5), (0, 0.5), (0.25, 0.25), (0, 0.5), (0.25, 0.5), (0.25, 0.25), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.25, 0.25), (0, 0.75), (0.25, 0.75), (0, 0.5), (0.25, 0.75), (0.25, 0.5), (0, 0.5), (0.25, 0.75), (0.5, 0.75), (0.5, 0.5), (0.25, 0.5), (0.25, 0.75), (0.5, 0.5)],
    }
    uniform token subdivisionScheme = "none"
    custom bool userProperties:meshtype
    bool userProperties:meshtype.timeSamples = {
        0: 0,
    }
    token visibility.timeSamples = {
        1: "inherited",
        2: "inherited",
        3: "inherited",
        4: "inherited",
        5: "inherited",
        6: "inherited",
        7: "inherited",
        8: "inherited",
        9: "inherited",
        10: "inherited",
        11: "inherited",
        12: "inherited",
        13: "inherited",
        14: "inherited",
        15: "inherited",
        16: "inherited",
        17: "inherited",
        18: "inherited",
        19: "inherited",
        20: "inherited",
        21: "inherited",
        22: "inherited",
        23: "inherited",
        24: "inherited",
        25: "inherited",
        26: "inherited",
        27: "inherited",
        28: "inherited",
        29: "inherited",
        30: "inherited",
        31: "inherited",
        32: "inherited",
        33: "inherited",
        34: "inherited",
        35: "inherited",
        36: "inherited",
        37: "inherited",
        38: "inherited",
        39: "inherited",
        40: "inherited",
        41: "inherited",
        42: "inherited",
        43: "inherited",
        44: "inherited",
        45: "inherited",
        46: "inherited",
        47: "inherited",
        48: "inherited",
        49: "inherited",
        50: "inherited",
    }
    custom uint[] xform:animChans
    uint[] xform:animChans.timeSamples = {
        1: [0, 1, 2, 4, 5, 6, 8, 9, 10],
    }
    custom bool xform:inherits
    bool xform:inherits.timeSamples = {
        1: 0,
        2: 0,
        3: 0,
        4: 0,
        5: 0,
        6: 0,
        7: 0,
        8: 0,
        9: 0,
        10: 0,
        11: 0,
        12: 0,
        13: 0,
        14: 0,
        15: 0,
        16: 0,
        17: 0,
        18: 0,
        19: 0,
        20: 0,
        21: 0,
        22: 0,
        23: 0,
        24: 0,
        25: 0,
        26: 0,
        27: 0,
        28: 0,
        29: 0,
        30: 0,
        31: 0,
        32: 0,
        33: 0,
        34: 0,
        35: 0,
        36: 0,
        37: 0,
        38: 0,
        39: 0,
        40: 0,
        41: 0,
        42: 0,
        43: 0,
        44: 0,
        45: 0,
        46: 0,
        47: 0,
        48: 0,
        49: 0,
        50: 0,
    }
    custom bool xform:isNotConstantIdentity
    bool xform:isNotConstantIdentity.timeSamples = {
        0: 1,
    }
    custom uchar xform:ops
    uchar xform:ops.timeSamples = {
        0: 48,
        24: 48,
        48: 48,
        72: 48,
        96: 48,
        120: 48,
        144: 48,
        168: 48,
        192: 48,
        216: 48,
        240: 48,
        264: 48,
        288: 48,
        312: 48,
        336: 48,
        360: 48,
        384: 48,
        408: 48,
        432: 48,
        456: 48,
        480: 48,
        504: 48,
        528: 48,
        552: 48,
        576: 48,
        600: 48,
        624: 48,
        648: 48,
        672: 48,
        696: 48,
        720: 48,
        744: 48,
        768: 48,
        792: 48,
        816: 48,
        840: 48,
        864: 48,
        888: 48,
        912: 48,
        936: 48,
        960: 48,
        984: 48,
        1008: 48,
        1032: 48,
        1056: 48,
        1080: 48,
        1104: 48,
        1128: 48,
        1152: 48,
        1176: 48,
    }
    custom matrix4d xform:vals
    matrix4d xform:vals.timeSamples = {
        1: ( (1, 0, 0, 0), (0, -1.6292068494294654e-7, 1, 0), (0, -1, -1.6292068494294654e-7, 0), (0, 0, 0, 1) ),
        2: ( (0.9993127584457397, -0.010776001960039139, 0.035466376692056656, 0), (-0.03544021025300026, 0.0026095565408468246, 0.9993683099746704, 0), (-0.010861747898161411, -0.9999385476112366, 0.0022258595563471317, 0), (0, 0, 0, 1) ),
        3: ( (0.9902790784835815, -0.04055813327431679, 0.13304999470710754, 0), (-0.1327449381351471, 0.010135669261217117, 0.9910984039306641, 0), (-0.041545651853084564, -0.9991257190704346, 0.0046532549895346165, 0), (0, 0, 0, 1) ),
        4: ( (0.9570634961128235, -0.08547136187553406, 0.2769911289215088, 0), (-0.27612096071243286, 0.022077593952417374, 0.960869312286377, 0), (-0.08824210613965988, -0.9960960149765015, -0.0024707734119147062, 0), (0, 0, 0, 1) ),
        5: ( (0.8837372064590454, -0.14151574671268463, 0.44607362151145935, 0), (-0.4454527795314789, 0.03782197833061218, 0.8945061564445496, 0), (-0.14345809817314148, -0.989213228225708, -0.02961389347910881, 0), (0, 0, 0, 1) ),
        6: ( (0.7622271180152893, -0.2045615315437317, 0.6141370534896851, 0), (-0.6171414852142334, 0.056612446904182434, 0.7848129272460938, 0), (-0.1953103244304657, -0.9772151708602905, -0.08309187740087509, 0), (0, 0, 0, 1) ),
        7: ( (0.5973126888275146, -0.2704327404499054, 0.755038857460022, 0), (-0.768189549446106, 0.07758288830518723, 0.6355041861534119, 0), (-0.23043926060199738, -0.959607720375061, -0.1614023894071579, 0), (0, 0, 0, 1) ),
        8: ( (0.40642812848091125, -0.335060179233551, 0.8500298261642456, 0), (-0.8817780613899231, 0.09986310452222824, 0.46097153425216675, 0), (-0.23933985829353333, -0.9368895292282104, -0.25486159324645996, 0), (0, 0, 0, 1) ),
        9: ( (0.2141517698764801, -0.3946551978588104, 0.8935246467590332, 0), (-0.9514591693878174, 0.12273108959197998, 0.28224530816078186, 0), (-0.22105279564857483, -0.9105955958366394, -0.3492152690887451, 0), (0, 0, 0, 1) ),
        10: ( (0.04429659619927406, -0.4458370506763458, 0.8940173983573914, 0), (-0.9818481206893921, 0.14577354490756989, 0.12134414166212082, 0), (-0.1844237893819809, -0.8831644058227539, -0.4312869608402252, 0), (0, 0, 0, 1) ),
        11: ( (-0.08610092103481293, -0.48565801978111267, 0.8698982000350952, 0), (-0.9856079816818237, 0.16901665925979614, -0.00319285923615098, 0), (-0.14547665417194366, -0.8576535582542419, -0.4932209253311157, 0), (0, 0, 0, 1) ),
        12: ( (-0.16796626150608063, -0.5114821195602417, 0.8427177667617798, 0), (-0.978111982345581, 0.19297650456428528, -0.07782650738954544, 0), (-0.12281786650419235, -0.8373445272445679, -0.5327003002166748, 0), (0, 0, 0, 1) ),
        13: ( (-0.19647081196308136, -0.5207122564315796, 0.8308176398277283, 0), (-0.9714004993438721, 0.21860060095787048, -0.09270846843719482, 0), (-0.13334280252456665, -0.8252711892127991, -0.5487687587738037, 0), (0, 0, 0, 1) ),
        14: ( (-0.1925722062587738, -0.5115574598312378, 0.826690137386322, 0), (-0.9578483700752258, 0.24394547939300537, -0.07217074930667877, 0), (-0.16623467206954956, -0.8130136728286743, -0.5418177247047424, 0), (0, 0, 0, 1) ),
        15: ( (-0.181060791015625, -0.4862575829029083, 0.8152056336402893, 0), (-0.9277867078781128, 0.26599738001823425, -0.04740220680832863, 0), (-0.20054572820663452, -0.7915736436843872, -0.5167034864425659, 0), (0, 0, 0, 1) ),
        16: ( (-0.16236494481563568, -0.448396772146225, 0.7972255945205688, 0), (-0.8841577172279358, 0.28434136509895325, -0.02014293149113655, 0), (-0.2342933714389801, -0.7622866034507751, -0.4764622747898102, 0), (0, 0, 0, 1) ),
        17: ( (-0.1371639370918274, -0.4017764925956726, 0.7732698321342468, 0), (-0.8300191164016724, 0.2986464202404022, 0.007940846495330334, 0), (-0.2654030919075012, -0.7263405323028564, -0.42447054386138916, 0), (0, 0, 0, 1) ),
        18: ( (-0.10641773045063019, -0.35015490651130676, 0.7438566088676453, 0), (-0.7685489058494568, 0.30876457691192627, 0.035394199192523956, 0), (-0.2919992506504059, -0.6850633025169373, -0.3642532527446747, 0), (0, 0, 0, 1) ),
        19: ( (-0.07133043557405472, -0.2970147728919983, 0.7097746729850769, 0), (-0.7030070424079895, 0.31485453248023987, 0.061104826629161835, 0), (-0.31269654631614685, -0.6401052474975586, -0.2992858290672302, 0), (0, 0, 0, 1) ),
        20: ( (-0.033212754875421524, -0.24535413086414337, 0.6722744107246399, 0), (-0.6366518139839172, 0.3174934983253479, 0.08441996574401855, 0), (-0.32684212923049927, -0.5935096144676208, -0.23275519907474518, 0), (0, 0, 0, 1) ),
        21: ( (0.006759620737284422, -0.1975134164094925, 0.6331523060798645, 0), (-0.5726146697998047, 0.3177667260169983, 0.10524142533540726, 0), (-0.33467260003089905, -0.547678530216217, -0.16727665066719055, 0), (0, 0, 0, 1) ),
        22: ( (0.04788053780794144, -0.15505795180797577, 0.5947098731994629, 0), (-0.5137382745742798, 0.3173149526119232, 0.12409457564353943, 0), (-0.33733612298965454, -0.5052558779716492, -0.10457554459571838, 0), (0, 0, 0, 1) ),
        23: ( (0.09030264616012573, -0.11873087286949158, 0.5595568418502808, 0), (-0.4623895585536957, 0.3183383047580719, 0.14216890931129456, 0), (-0.3367442786693573, -0.46895530819892883, -0.045161765068769455, 0), (0, 0, 0, 1) ),
        24: ( (0.13542306423187256, -0.08849533647298813, 0.5302416086196899, 0), (-0.42024704813957214, 0.3235607147216797, 0.1613316386938095, 0), (-0.33523130416870117, -0.44136613607406616, 0.01195530779659748, 0), (0, 0, 0, 1) ),
        25: ( (0.18618932366371155, -0.06367278844118118, 0.508694052696228, 0), (-0.3880530297756195, 0.3361671268939972, 0.18411071598529816, 0), (-0.33502036333084106, -0.4247678220272064, 0.06945443898439407, 0), (0, 0, 0, 1) ),
        26: ( (0.24254411458969116, -0.04227247089147568, 0.48669877648353577, 0), (-0.358906626701355, 0.3532273471355438, 0.2095392495393753, 0), (-0.3314341902732849, -0.41344133019447327, 0.12925906479358673, 0), (0, 0, 0, 1) ),
        27: ( (0.2996649146080017, -0.02296397089958191, 0.45515260100364685, 0), (-0.3263755440711975, 0.36937689781188965, 0.23351652920246124, 0), (-0.31807270646095276, -0.40065401792526245, 0.18919944763183594, 0), (0, 0, 0, 1) ),
        28: ( (0.35466423630714417, -0.005695092957466841, 0.41433218121528625, 0), (-0.29127436876296997, 0.38447603583335876, 0.25461268424987793, 0), (-0.29472488164901733, -0.3868280351161957, 0.24696458876132965, 0), (0, 0, 0, 1) ),
        29: ( (0.40491533279418945, 0.00960197951644659, 0.36529675126075745, 0), (-0.25468122959136963, 0.3984168767929077, 0.27183035016059875, 0), (-0.2620522081851959, -0.3723735809326172, 0.3002612888813019, 0), (0, 0, 0, 1) ),
        30: ( (0.44829675555229187, 0.02300606481730938, 0.30982422828674316, 0), (-0.21782077848911285, 0.41112205386161804, 0.2846454381942749, 0), (-0.22152747213840485, -0.35768648982048035, 0.3470968008041382, 0), (0, 0, 0, 1) ),
        31: ( (0.4833904802799225, 0.03460349887609482, 0.25025296211242676, 0), (-0.18193423748016357, 0.42254209518432617, 0.29299893975257874, 0), (-0.17528223991394043, -0.34314870834350586, 0.386025071144104, 0), (0, 0, 0, 1) ),
        32: ( (0.5096001625061035, 0.04448524862527847, 0.1892591267824173, 0), (-0.1481596678495407, 0.43265074491500854, 0.2972411811351776, 0), (-0.1258835643529892, -0.32912713289260864, 0.41631588339805603, 0), (0, 0, 0, 1) ),
        33: ( (0.5271704196929932, 0.05274486914277077, 0.12961344420909882, 0), (-0.11744532734155655, 0.4414394795894623, 0.29804033041000366, 0), (-0.07608061283826828, -0.31597375869750977, 0.438021183013916, 0), (0, 0, 0, 1) ),
        34: ( (0.5371057987213135, 0.05947710573673248, 0.0739603340625763, 0), (-0.09050793200731277, 0.44891121983528137, 0.296272337436676, 0), (-0.028565160930156708, -0.30402544140815735, 0.4519323408603668, 0), (0, 0, 0, 1) ),
        35: ( (0.5410048961639404, 0.06477662920951843, 0.024658335372805595, 0), (-0.067838154733181, 0.4550723731517792, 0.2929118275642395, 0), (0.014213666319847107, -0.2936040759086609, 0.4594397246837616, 0), (0, 0, 0, 1) ),
        36: ( (0.5408326387405396, 0.06873764842748642, -0.01629461906850338, 0), (-0.04974929615855217, 0.4599248468875885, 0.2889366149902344, 0), (0.05015362426638603, -0.28501665592193604, 0.46232059597969055, 0), (0, 0, 0, 1) ),
        37: ( (0.5386583209037781, 0.07145340740680695, -0.047243632376194, 0), (-0.03645949065685272, 0.4634566605091095, 0.28525227308273315, 0), (0.07751293480396271, -0.27855437994003296, 0.462481826543808, 0), (0, 0, 0, 1) ),
        38: ( (0.5363762974739075, 0.07301615923643112, -0.06677911430597305, 0), (-0.02819773554801941, 0.465631902217865, 0.2826341390609741, 0), (0.09484563767910004, -0.27449190616607666, 0.4616803526878357, 0), (0, 0, 0, 1) ),
        39: ( (0.5354160666465759, 0.07351695001125336, -0.07358817011117935, 0), (-0.025324558839201927, 0.4663800001144409, 0.28167110681533813, 0), (0.1008891761302948, -0.2730846107006073, 0.46123358607292175, 0), (0, 0, 0, 1) ),
        40: ( (0.5406517386436462, 0.07337670773267746, -0.07346296310424805, 0), (-0.02411024086177349, 0.4675863981246948, 0.2895977199077606, 0), (0.10099326819181442, -0.2811832129955292, 0.4624084532260895, 0), (0, 0, 0, 1) ),
        41: ( (0.5554569959640503, 0.07289633899927139, -0.07302375137805939, 0), (-0.020659739151597023, 0.4703124165534973, 0.31234297156333923, 0), (0.10109162330627441, -0.30441921949386597, 0.46506789326667786, 0), (0, 0, 0, 1) ),
        42: ( (0.578484833240509, 0.07190362364053726, -0.07209061831235886, 0), (-0.015283821150660515, 0.4724869728088379, 0.34861767292022705, 0), (0.10066574066877365, -0.34146419167518616, 0.4672049582004547, 0), (0, 0, 0, 1) ),
        43: ( (0.6083847284317017, 0.07016927748918533, -0.07042466849088669, 0), (-0.008401067927479744, 0.47141510248184204, 0.3971303701400757, 0), (0.09905948489904404, -0.3909723460674286, 0.46620073914527893, 0), (0, 0, 0, 1) ),
        44: ( (0.6437926292419434, 0.06746505945920944, -0.06778696179389954, 0), (-0.0006102364859543741, 0.46420806646347046, 0.45620813965797424, 0), (0.09563594311475754, -0.45119258761405945, 0.45923250913619995, 0), (0, 0, 0, 1) ),
        45: ( (0.6833255290985107, 0.0636114776134491, -0.06398739665746689, 0), (0.007299620192497969, 0.44823336601257324, 0.5235532522201538, 0), (0.08993063867092133, -0.5197257995605469, 0.44370269775390625, 0), (0, 0, 0, 1) ),
        46: ( (0.7255824208259583, 0.05851513892412186, -0.058923590928316116, 0), (0.01441732794046402, 0.4215717911720276, 0.5961838960647583, 0), (0.08178111910820007, -0.5934804677963257, 0.4176825284957886, 0), (0, 0, 0, 1) ),
        47: ( (0.7691513895988464, 0.05219544842839241, -0.05260922759771347, 0), (0.019846955314278603, 0.3834289610385895, 0.6705774664878845, 0), (0.07140161842107773, -0.6688375473022461, 0.38032084703445435, 0), (0, 0, 0, 1) ),
        48: ( (0.8126198053359985, 0.044800832867622375, -0.04519117996096611, 0), (0.022881753742694855, 0.33442479372024536, 0.7429918050765991, 0), (0.059378303587436676, -0.7419928312301636, 0.3321464955806732, 0), (0, 0, 0, 1) ),
        49: ( (0.8545882701873779, 0.03661404177546501, -0.036955296993255615, 0), (0.023167654871940613, 0.2766989469528198, 0.8098940253257751, 0), (0.046578336507081985, -0.8093976378440857, 0.27519690990448, 0), (0, 0, 0, 1) ),
        50: ( (0.8936808705329895, 0.028046678751707077, -0.028320154175162315, 0), (0.020808910951018333, 0.21380527317523956, 0.8683940768241882, 0), (0.0339946486055851, -0.8681904673576355, 0.2129405438899994, 0), (0, 0, 0, 1) ),
    }
}

Having multiple Pythons and all kind of confusing install via pip brew etc is giving me Python crashing, wondering if @TimvanScherpenzeel has this solved?

I haven't yet tried it again unfortunately, been busy with other projects and work. This is partly due to the fact that my personal computers don't run High Sierra and XCode 10, my Mac at work does.

Ok maybe when MacOS Mojave is official, and XCode 10 is also ready, I will retry this USD Built again.

So far:

  • It works once, and I can see 3D object inside usdview
  • Next time running, I got lots of errors, and things are not displayed properly.
  • Previously, I actually have Anaconda Python 3 and Python 2.7 as virtual env.
  • brew and pip are used together and I think it's causing so much dependencies issue
  • At some point I got desperate, deleting all the Anaconda and trying to run this using MacOS default Python 2
  • Been getting the Python dying and crashing like what you have
  • I reinstall Anaconda Python 2 as default
  • And now I am getting either these two: USD tools not running at all with PyQT confusion (multiple PyQT) or getting USD tools working, but not seeing 3D properly when the USDView app loaded, for example, and lots of GL errors.

However, Python USD seems to work. PYTHONPATH and PATH are also causing lots of issues I think.

Anyhow, will have to further test this.

Cool Quick Look gallery

So can the ARObjectScanningConfiguration and ARReferenceObject classes be used to create these 3D objects? Or how about the front facing camera and IR notch, does any of that support the ability to create these USDZ files?

Appears that Xcode 10 Beta 4 got a big update to the uzdz_converter command line. Comparison of Beta 4 to Beta 3 shown below.

  1. A new option for applying to materials not just groups. I haven't checked this yet but hopefully it solves the alembic texture issue.

  2. The -d option has now been changed to -a which makes sense!

  3. You also have some additional options for controlling the colors

-opacity
-specularColor
-useSpecularWorkflow
-ao_map
-color_default
-normal_default
-emissive_default
-metallic_default
-roughness_default
-ao_default

**XCODE 10 BETA 3**

USAGE:
<inFilePath> <outFilePath> [options...]
	Options:
                -x groupName                    Omit group with name.
                -g groupName                    Apply the subsequent material properties to the named group.
                -h                              Display help.
                -l                              Do not remove the generated .usda file when program exits.
                -d                              Create the .usda file in the destination folder.  Default is the users temporary directory.
                -v                              Verbose output.
                -color_map       filePath
                -normal_map      filePath
                -emissive_map    filePath
                -metallic_map    filePath
                -roughness_map   filePath
                -ao_map          filePath

(*) Specify infield only with -v (Verbose) to display group information.

**XCODE 10 BETA 4**

USAGE:
<inFilePath> <outFilePath> [options...]
	Options:
                -g groupName [groupNames ...]       Apply subsequent material properties to the named group(s).
                -m materialName [materialNames ...] Apply subsequent material properties to the named material(s).
                -h                                  Display help.
                -a                                  Generate a .usda intermediate file.  Default is .usdc.
                -l                                  Leave the intermediate .usd file in the source folder.
                -v                                  Verbose output.
                -f                    filePath      Read commands from a file.
                -texCoordSet          set           The name of the texturemap coordinate set to use if multiple exist (no quotes).
                -opacity              o             Floating point value 0.0 ... 1.0
                -specularColor        r g b         Floating point values 0.0 ... 1.0
                -useSpecularWorkflow  i             0 for false, non-zero for true
                -color_map            filePath
                -normal_map           filePath
                -emissive_map         filePath
                -metallic_map         filePath
                -roughness_map        filePath
                -ao_map               filePath
                -color_default        r g b a        Floating point values 0.0 ... 1.0
                -normal_default       r g b a
                -emissive_default     r g b a
                -metallic_default     r g b a
                -roughness_default    r g b a
                -ao_default           r g b a

(*) Specify infield only with -v (Verbose) to display group information.
(*) '#' in the first character position of a line in a command file interprets the line as a comment.






@wave-electron Today it's just been updated to XCode Beta 5 and I think they also added few more options. I like they added more options for mapping, it's become very streamlined to do things now.

Anyhow, so far no luck with Alembic on my side. If you can provide zipped Blend + USDA that works, I am curious how you set it up ...?

(I am also still following thread at USD-Interest Group.)

Did you manage to get the Alembic Texture working properly now? It's exciting if we can get animation working, just like Sketchfab 👍

My latest Alembic animation seems to work for transform animation after I do this:

  • Export Alembic using Blender, turn OFFSelected Only, Renderable Only, Visible Only
  • Brought back the Alembic into Blender
  • Export Alembic again.

So far, Blendshape is not working, maybe because it does not work that way. However, we might be able to animate visibility on and off, making a stop motion animation. it's gonna be super heavy though.

And one more thing: The animation needs to have an Empty / Root.

As a sidenote, I just installed Xcode Beta 5, and $ xcrun usdz_converter -h gives the exact same help as what you pasted from the Beta 4 above, that is to say:

USAGE:
<inFilePath> <outFilePath> [options...]
	Options:
                -g groupName [groupNames ...]       Apply subsequent material properties to the named group(s).
                -m materialName [materialNames ...] Apply subsequent material properties to the named material(s).
                -h                                  Display help.
                -a                                  Generate a .usda intermediate file.  Default is .usdc.
                -l                                  Leave the intermediate .usd file in the source folder.
                -v                                  Verbose output.
                -f                    filePath      Read commands from a file.
                -texCoordSet          set           The name of the texturemap coordinate set to use if multiple exist (no quotes).
                -opacity              o             Floating point value 0.0 ... 1.0
                -specularColor        r g b         Floating point values 0.0 ... 1.0
                -useSpecularWorkflow  i             0 for false, non-zero for true
                -color_map            filePath
                -normal_map           filePath
                -emissive_map         filePath
                -metallic_map         filePath
                -roughness_map        filePath
                -ao_map               filePath
                -color_default        r g b a        Floating point values 0.0 ... 1.0
                -normal_default       r g b a
                -emissive_default     r g b a
                -metallic_default     r g b a
                -roughness_default    r g b a
                -ao_default           r g b a

(*) Specify infield only with -v (Verbose) to display group information.
(*) '#' in the first character position of a line in a command file interprets the line as a comment.

It seems like still only a single input file is allowed, so to create a .usdz for a scene using multiple .obj files, they need to be merged into one .obj with multiple groups.

Great news! I had some time during lunch to rebuild USD using the following fix. It successfully builds and runs now! I've updated the README to match the new findings.

Just spotted this on Twitter: https://github.com/kcoley/gltf2usd, a glTF to USD converter written in Python with animation and glTF nodes support. Unfortunately it still relies on usdzip or usdz_converter to be installed.

I tested kcoley gltf2usd and seems broken or I did something wrong. Filed bug on that Github....

Have you manage to get any simple skeleton animation to work?

So far, GLTF + BIN, sometimes just GLTF, as animation seems like it supposed to be standard and straight forward, but somewhat convoluted.

Exporting animation from Blender out as GLTF using Khronos and Kupoman both gave me weird animation when tested on Clay-Viewer. Just an example.

DAE to GLTF is working better:
http://52.4.31.236/convertmodel.html

monster_test_001
@wave-electron @TimvanScherpenzeel

Updating the USD and retrying the GLTF (animation) to USD --> it's promising however, on iOS animation seems to be turned off...

@TimvanScherpenzeel Thanks for letting me know about that standalone USD library... thats going to make thinks alot easier! I got my first bone animation last night working in usdz -> I posted on www.fusionar.app . I noticed a few of my other usdz animations have broken after updating to ios12 beta 9... I've since worked out its has something to do with a material reference change which I need to fix on those usdz files.

I think Apple's standalone USD library is a strong indicator that scn files may eventually be exportable to usd/usdz... which would open things up to the masses!

Thanks as well @TimvanScherpenzeel
Using the precompiled library, in a python console running "from pxr import Tf" I get:
Python crashed. FATAL ERROR: Failed axiom: ' Py_IsInitialized() '
in operator() at line 148 of /tmp/USD/pxr/base/lib/tf/pyTracing.cpp

@jselikof I'm having the same issue here. I would recommend for now to build the library yourself using the instructions mentioned in the README (and adjust the sections in the build script as indicated). It appears that the standalone published binary is internally linking with the wrong installation of Python.

@TimvanScherpenzeel that issue went away when I launched Maya from the terminal. Maya wasn't picking up the environment variables otherwise.

Yesterday Google has open sourced a standalone cross-platform glTF to USDZ converter: https://github.com/google/usd_from_gltf

@TimvanScherpenzeel did you try? how is it? is it for USD or USDZ?