USDZ / USDA - export block instances

Can Rhino export block instances in *.usdz format? If not, could this please be added?

I just searched online quickly and Blender has an experimental export option which apparently does that.

I put together a test file with the help of a few exported geometries and copilot helped me mix something together which doesn’t really work.

Is there anyone here who knows how to create a nested *.usda file?

#usda 1.0
(
    doc = """Generated from Composed Stage of root layer"""
    metersPerUnit = 0.001
    upAxis = "Y"
)

def Xform "Rhino"
{
    def Xform "Geometry"
    {
        def Mesh "square" (
            apiSchemas = ["MaterialBindingAPI"]
        )
        {
            uniform bool doubleSided = 1
                float3[] extent = [(0, 0, 0), (1000, 0, 1000)]
                int[] faceVertexCounts = [4]
                int[] faceVertexIndices = [3, 1, 0, 2]
                normal3f[] normals = [(0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)]
                point3f[] points = [(326, 0, 452), (326, 0, 358), (420, 0, 452), (420, 0, 358)]
                texCoord2f[] primvars:st1 = [(0, 0), (0, 1), (1, 0), (1, 1)] (
                    interpolation = "vertex"
            )
        }
    }

    def "Materials"
    {
        def Material "material1"
        {
            token outputs:surface.connect = </Rhino/Materials/material1/shader0.outputs:surface>

            def Shader "shader0"
            {
                uniform token info:id = "UsdPreviewSurface"
                float inputs:clearcoat = 0
                color3f inputs:diffuseColor = (0, 1, 0)
                color3f inputs:emissiveColor = (0, 0, 0)
                float inputs:ior = 1.56
                float inputs:metallic = 0
                float inputs:opacity = 1
                float inputs:roughness = 1
                int inputs:useSpecularWorkflow = 0
                token outputs:surface
            }
        }

        def Material "material2"
        {
            token outputs:surface.connect = </Rhino/Materials/material2/shader0.outputs:surface>

            def Shader "shader0"
            {
                uniform token info:id = "UsdPreviewSurface"
                float inputs:clearcoat = 0
                color3f inputs:diffuseColor = (0, 0, 1)
                color3f inputs:emissiveColor = (0, 0, 0)
                float inputs:ior = 1.56
                float inputs:metallic = 0
                float inputs:opacity = 1
                float inputs:roughness = 1
                int inputs:useSpecularWorkflow = 0
                token outputs:surface
            }
        }
    }


	def Xform "Instances"
	{
		def Xform "Instance1"
		{
			rel references = </Geometry/square>
			matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (100, 0, 0, 1) )
			rel material:binding = </Rhino/Materials/material1>
		}

		def Xform "Instance2"
		{
			rel references = </Geometry/square>
			matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (200, 100, 0, 1) )
			rel material:binding = </Rhino/Materials/material2>
		}
	}
}

two_mesh_squares.usda (2.7 KB)

For this particular file, iRhino shows just the one shape defined in “Geometry”

Yes, that should work.

Thanks for your reply.

two_rhino_blocks.3dm (57.2 KB)

The Rhino file contains two block instances with the same surface.

When I export blocks the *.usda file contains each geometry as separate definition. There’s mesh0 and mesh1. I’m expecting to have a *.usda file with one mesh and two transformations.

#usda 1.0
(
    doc = """Generated from Composed Stage of root layer 
"""
    metersPerUnit = 0.001
    upAxis = "Y"
)

def Xform "Rhino"
{
    def Xform "Geometry"
    {
        def Xform "srf"
        {
            def Mesh "mesh0" (
                apiSchemas = ["MaterialBindingAPI"]
            )
            {
                uniform bool doubleSided = 1
                float3[] extent = [(81.07489, 0, -47), (175.07489, 0, 47)]
                int[] faceVertexCounts = [4]
                int[] faceVertexIndices = [3, 1, 0, 2]
                rel material:binding = </Rhino/Materials/material_srf__97AB1102_2B55_4DEF_66EF2DC8>
                normal3f[] normals = [(0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)]
                point3f[] points = [(81.07489, 0, 47), (81.07489, 0, -47), (175.07489, 0, 47), (175.07489, 0, -47)]
                texCoord2f[] primvars:st1 = [(0, 0), (0, 1), (1, 0), (1, 1)] (
                    interpolation = "vertex"
                )
            }

            def Mesh "mesh1" (
                apiSchemas = ["MaterialBindingAPI"]
            )
            {
                uniform bool doubleSided = 1
                float3[] extent = [(-47, 0, -47), (47, 0, 47)]
                int[] faceVertexCounts = [4]
                int[] faceVertexIndices = [3, 1, 0, 2]
                rel material:binding = </Rhino/Materials/material_srf__97AB1102_2B55_4DEF_66EF2DC8>
                normal3f[] normals = [(0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)]
                point3f[] points = [(-47, 0, 47), (-47, 0, -47), (47, 0, 47), (47, 0, -47)]
                texCoord2f[] primvars:st1 = [(0, 0), (0, 1), (1, 0), (1, 1)] (
                    interpolation = "vertex"
                )
            }
        }
    }

    def "Materials"
    {
        def Material "material_srf__97AB1102_2B55_4DEF_66EF2DC8"
        {
            token outputs:surface.connect = </Rhino/Materials/material_srf__97AB1102_2B55_4DEF_66EF2DC8/shader0.outputs:surface>

            def Shader "shader0"
            {
                uniform token info:id = "UsdPreviewSurface"
                float inputs:clearcoat = 0
                color3f inputs:diffuseColor = (0, 0, 1)
                color3f inputs:emmisiveColor = (0, 0, 0)
                float inputs:ior = 1.56
                float inputs:metallic = 0
                float inputs:opacity = 0.9019608
                float inputs:roughness = 0.5
                int inputs:useSpecularWorkflow = 0
                token outputs:surface
            }
        }
    }
}


I see what you mean. No, that doesn’t work right now.
I logged the issue.
Thanks

1 Like