USD wrapping ready for testing in daily builds

Paul DoylePaul Doyle Administrator, Fabric Employee Posts: 229 admin

Hi everyone - it took a fair bit of hoop-jumping and some help from people on the USD list (thanks!) but we are now ready for people to test our USD integration in Fabric.

The USD extension is based on v0.7.4 of USD and is available on Windows + Linux for now. OSX will follow.

The wrapping is not 100% complete, however it includes support for the following classes:

  • All Sdf Classes
  • All Math Classes
  • UsdAttribute, UsdEditTarget, UsdGeomBoundable, UsdGeomCamera, UsdGeomGprim, UsdGeomImageable, UsdGeomMesh, UsdGeomPointBased, UsdGeomPrimvar, UsdGeomSphere, UsdGeomXform, UsdGeomXformCommonAPI, UsdGeomXformOp, UsdGeomXformable, UsdInterpolation, UsdObject, UsdPrim, UsdPrimRange, UsdProperty, UsdReferences, UsdRelationship, UsdSchemaBase, UsdShadeInput, UsdShadeInterfaceAttribute, UsdShadeLook, UsdShadeMaterial, UsdShadeNodeGraph, UsdShadeParameter, UsdShadeShader, UsdStage, UsdTimeCode, UsdTyped

The currently supported scope allows users to:

  • Read and write USD files
  • Assemble scenes using references, variations and layers
  • Inject and retrieve custom metadata
  • Inspect USD files directly in the Canvas visual programming system

Known Limitations:

  • The Alembic file format plugin is not provided.
  • The ModelAPI classes are not provided for now ( will follow ).
  • The wrapping does not yet provide canvas nodes for all granular USD operation. This will follow once USD stabilizes into 1.0.

If you want to take a look then download the daily builds and get digging. If you need help or guidance then post here.

Cheers,

Paul

CEO at Fabric Software
Twitter

Tagged:

Comments

  • scaronscaron Fabric for Houdini Posts: 171

    Bleeding edge, love it!

  • createtheimaginablecreatetheimaginable Posts: 5
    edited May 1

    Hello Paul,

    I am running Canvas on CentOS 7 and I am getting a strange error, Canvas runs fine but when I try to load usd_simple_import.canvas it looks like Canvas cannot find the USD library files...

    [FABRIC:MT] Loaded extension GenericImporter in 65.477ms (cached)
    [FABRIC:MT] Loaded extension Kludge in 70.018ms (cached)
    [FABRIC:MT] [USD] Error encountered while loading extension; extension disabled
    [FABRIC:MT] [USD] Error description:
    unable to open 'libUSD-Linux-x86_64.so': libarch.so: cannot open shared object file: No such file or directory
    [FABRIC:MT] Loaded extension USD in 332.571ms
    [FABRIC:MT] [UsdImporter] Error encountered while loading extension; extension disabled
    [FABRIC:MT] [UsdImporter] Error description: unable to load extension USD:0.0.0
    [FABRIC:MT] Loaded extension UsdImporter in 8.694ms
    Error: execute(): cannot execute because of errors

    However I do see the libUSD-Linux-x86_64.so and libarch.so library files in the FabricEngine-escher-Linux-x86_64-20170428-175135/Exts/Builtin/USD/lib directory.

    Is anyone else running into this error?

    Any tips on what may be wrong?

    Thanks,

    Marcus

  • HelgeHelge Moderator, Fabric Employee Posts: 314 Fabric Employee

    hey @createtheimaginable can you try to also set the LD_LIBRARY_PATH to the FabricEngine-escher-Linux-x86_64-20170428-175135/Exts/Builtin/USD/lib directory? this should be using rpath but that doesn't seem to work for you. We'll address this in a future release.

    Research Engineer @ Fabric Software

  • createtheimaginablecreatetheimaginable Posts: 5

    Adding the LD_LIBRARY_PATH worked!

    I added the following 3 lines to the environment.sh file and that seems to fix it.

    LD_LIBRARY_PATH="$FABRIC_DIR/Exts/Builtin/USD/lib"
    export LD_LIBRARY_PATH
    echo " Just Set LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\""

    Do you need any beta testers?

    Does shading and texturing work in USD yet? Maybe we can try some cool example USD scene files as tests?

    I know Pixar just released version v0.7.5 yesterday...

    Marcus

  • HelgeHelge Moderator, Fabric Employee Posts: 314 Fabric Employee

    Hey @createtheimaginable

    good to know - thanks!

    Shading works as in the shade nodes are supported - but you'll have to implement your own conversion - since shading depends heavily on the renderer.

    We haven't upgraded to 0.7.5 yet - there doesn't seem to be a pressing issue either since hte changes are relatively small.

    Best!

    Research Engineer @ Fabric Software

  • Should not be too hard to get the translation animation of a USD cube working since translation animation of the McLaren 570S was talked about in the Fabric USD preview...

    Are the nodes there in the daily builds to do translation animation storing multiple values over time for the cube below? :)

    #usda 1.0
    (
        defaultPrim = "AnimatedCubeModel"
        endTimeCode = 149
        startTimeCode = 101
        upAxis = "Z"
    )
    
    def Xform "AnimatedCubeModel" (
        assetInfo = {
            asset identifier = @./AnimatedCubeModel.usda@
            string name = "AnimatedCubeModel"
        }
        kind = "component"
    )
    {
        def Xform "Geom"
        {
            def Mesh "Cube"
            {
                float3[] extent = [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)]
                int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
                int[] faceVertexIndices = [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4]
                point3f[] points = [(-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)]
                color3f[] primvars:displayColor = [(0.1, 0.1, 0.7)]
                double3 xformOp:translate.timeSamples = {
                    101: (-10, 0, 0),
                    125: (10, 0, 0),
                    149: (-10, 0, 0)
                }
                uniform token[] xformOpOrder = ["xformOp:translate"]
            }
        }
    }
    

    Marcus

  • HelgeHelge Moderator, Fabric Employee Posts: 314 Fabric Employee

    Hey @createtheimaginable,

    while the functionality is available in KL it's not yet available as low level canvas nodes. Since USD is still in flux we'll provide granular USD nodes once USD stabilizes towards 1.0. Until then you can already do all of the above mentioned in KL (or of course in Canvas function nodes).

    I hope this makes sense!

    Best!

    Research Engineer @ Fabric Software

  • createtheimaginablecreatetheimaginable Posts: 5
    edited May 12

    Hello Heige,

    Yes, that makes sense! :-)

    Are any of the KL examples to do animated translation available in the Fabric daily builds?

    Thanks,

    Marcus

  • HelgeHelge Moderator, Fabric Employee Posts: 314 Fabric Employee

    @createtheimaginable

    Here's a KL snippet which creates a file with transform animation and then also loads it. You can run the snippet with kl.exe on the command line. The test.usda file created should work fine in canvas as well using the UsdImporter.

    We recommend to read up on the USD docs - USD is sample format. As you can see in the KL code this is exactly the same as in the USD python examples / the USD C++ examples, since our extensions just maps the USD API to KL.

    Let me know if you have any questions!

    Best!

    Helge

    require USD;
    
    operator entry()
    {
      // create a USD file with animation
      {
        // create a new stage
        UsdStage s = UsdStage_CreateNew('test.usda');
    
        // create a transform prim
        UsdPrim transform = s.DefinePrim('/xfo', 'Xform');
    
        // we use the transform API since it is easiest.
        // you can also use the UsdGeomTransform and create
        // transformation ops manually.
        UsdGeomXformCommonAPI transformAPI(transform);
    
        // create some animation
        Vec3_d a = Vec3_d(-4.0, 0.0, 0.0);
        Vec3_d b = Vec3_d(4.0, 5.0, 0.0);
    
        for(Float32 seconds=0.0; seconds <= 10.0; seconds+=0.5)
        {
          // USD is a sampling file format,
          // we set the translation at different times
          Vec3_d p = a.linearInterpolate(b, seconds / 10.0);
          UsdTimeCode tc(seconds);
          transformAPI.SetTranslate(p, tc);
        }
    
        // create a sphere prim below the transform
        UsdPrim sphere = s.DefinePrim('/xfo/sphere', 'Sphere');
    
        // save the layer to disk
        s.GetRootLayer().Save();
      }
    
      // now let's load the USD file again
      {
        UsdStage s = UsdStage_Open('test.usda');
    
        // get the prim again, this time cast it to a geom xform
        UsdGeomXform transform = s.GetPrimAtPath('/xfo');
    
        // get the time samples
        Float64 times[];
        transform.GetTimeSamples(times);
        report(times);
    
        for(Size i=0;i<times.size();i++)
        {
          UsdTimeCode tc(times[i]);
    
          // get the transform again
          Mat44_d m;
          m.setTranslation(Vec3_d(1.0, 2.0, 3.0));
          Boolean resetsStack;
          transform.GetLocalTransformation(m, resetsStack, tc);
    
          // matrices in USD are ordered differently
          // than in fabric
          m = m.transpose();
    
          report(m.translation());
        }
    
      }
    }
    

    The resulting file looks like this:

    #usda 1.0
    
    def Xform "xfo"
    {
        double3 xformOp:translate.timeSamples = {
            0: (-4, 0, 0),
            0.5: (-3.5999999940395355, 0.2500000037252903, 0),
            1: (-3.199999988079071, 0.5000000074505806, 0),
            1.5: (-2.799999952316284, 0.7500000298023224, 0),
            2: (-2.399999976158142, 1.0000000149011612, 0),
            2.5: (-2, 1.25, 0),
            3: (-1.5999999046325684, 1.5000000596046448, 0),
            3.5: (-1.2000000476837158, 1.7499999701976776, 0),
            4: (-0.7999999523162842, 2.0000000298023224, 0),
            4.5: (-0.40000009536743164, 2.2499999403953552, 0),
            5: (0, 2.5, 0),
            5.5: (0.40000009536743164, 2.7500000596046448, 0),
            6: (0.8000001907348633, 3.0000001192092896, 0),
            6.5: (1.1999998092651367, 3.2499998807907104, 0),
            7: (1.5999999046325684, 3.4999999403953552, 0),
            7.5: (2, 3.75, 0),
            8: (2.4000000953674316, 4.000000059604645, 0),
            8.5: (2.8000001907348633, 4.2500001192092896, 0),
            9: (3.1999998092651367, 4.4999998807907104, 0),
            9.5: (3.5999999046325684, 4.749999940395355, 0),
            10: (4, 5, 0),
        }
        uniform token[] xformOpOrder = ["xformOp:translate"]
    
        def Sphere "sphere"
        {
        }
    }
    

    Research Engineer @ Fabric Software

  • This is great! This is enough for me to get started... :smile: Would love to see more over time...

    This is of interest since Epic announced support for Pixar's Universal Scene Description (USD) format in Unreal Engine in an upcoming release!

    https://youtu.be/K6tRt7c2elU?t=4093

Sign In or Register to comment.