When you say made with USD
, Iām not sure what you mean. USD is a file format with various supporting apps such as usdcat
to pretty print the file.
If youāve read through chapter 8, you can take the final code and import the robot to see it animating. (Iām referring to the book Metal by Tutorials here, not the videos!)
In Renderer
, I changed the skeleton model loading to:
let skeleton = Model(name: "toy_robot_vintage.usdz")
skeleton.rotation = [0, .pi, 0]
skeleton.scale = [0.1, 0.1, 0.1]
In Mesh.swift, in Mesh
init()
, skeleton
will be nil for the robot, as it has no skeleton. You can verify this with print("skeleton: ", skeleton)
.
However, each mesh will have a TransformComponent
. You can verify this with print("Transform: ", mdlMesh.name, transform)
- thatās also in Mesh
ās init()
.
The robot is split up into several meshes
, and Model
will iterate through each mesh
in render(renderEncoder:uniforms:fragmentUniforms)
.
Compare this with skeleton.usda
, which has a skeleton rig with three joints, but only one mesh.
P.S. I made a bad choice of file name for the skeleton model! Please donāt confuse skeleton.usda
, which is the model, which could be called anything, with the Skeleton
struct, which holds the joints from any loaded Model
. In Renderer
, skeleton
refers to the model skeleton.usda
, whereas in Mesh
, skeleton
refers to any Model
ās joint hierarchy.