The Linux Foundation Projects
Skip to main content

In our last Explainer Series blog for developers, we explored the basics of OpenUSD, a revolutionary technology in the 3D graphics world. If you missed it, catch up here

Today, we will dive deeper into a critical component of OpenUSD: schemas. Schemas describe the data model and client API that enables the universal encoding and interchange of 3D and non-3D concepts. Let’s delve deeper into schemas, how they function, and how OpenUSD can be extended through custom schemas.

Defining OpenUSD Schemas

In the OpenUSD ecosystem, a schema is a blueprint that may define a new Prim type or Properties for describing a particular data model.  For example, a Geometry schema might specify how to define the vertices and topology of a 3D mesh, while a Shading schema could outline how to describe parameters for materials and textures.

Here’s a simple example to illustrate a schema for a sphere:

And here is a concrete usage of that schema, which implicitly uses the schema’s “fallback” value of 1.0 for the “radius” attribute and a 2x2x2 axis-aligned bounding box for the “extent” attribute defined above:

In this example, the Sphere schema defines the radius and extent attributes to describe the sphere’s geometry.

  • Data Modeling vs. Runtime Behaviors: While schemas dictate how data is structured, they do not define how the runtime interprets this data. This distinction is crucial for understanding how USD separates data modeling from functional implementation.
  • Types of Schemas: OpenUSD supports various types of schemas, including IsA (typed) schemas and API schemas. IsA schemas can be abstract (serving as base classes) or concrete (instantiable). API schemas, on the other hand, provide an interface for further enriching an already typed Prim in a mixin fashion.
    • IsA (Typed) Schemas
      • Concrete IsA Schemas: Instantiable and define specific types of Prims, such as a Camera or DomeLight.
      • Abstract IsA Schemas: Serve as base classes for other schemas and cannot be instantiated directly, like the Imageable schema.
    • API schemas
      • Non-Applied API Schemas: Only provide an interface to metadata or non-authoring API that has no effect on interchange.
      • Single or Multiple-Applied API Schemas: Define default Properties added to a Prim when applied, like the RigidBodyAPI for UsdPhysics. They can be applied once, or multiple times with different instance names, such as the CollectionAPI.
  • Codeless Schemas
    • Introduced in USD v21.08, codeless schemas populate their definitions into the schema registry without requiring compilation and linking of generated C++ code. They are thus easier and lighter-weight to deploy across different platforms, but do not offer pre-generated schema-specific C++ and Python API for data queries and writes.

Built-In Schemas

OpenUSD has a set of built-in schemas covering a wide range of 3D graphics concepts. These built-in schemas are well-documented and widely adopted, ensuring consistency and interoperability across different software applications. They include everything from OpenSubdiv-compliant meshes to shader nodes that can be connected to form networks. They include: 

  • Geometry: The UsdGeom schemas support a variety of geometric forms including OpenSubdiv-compliant meshes, transforms, curves, points, nurbs patches, and intrinsic solids. Key features include:
    • Primvars: Arbitrary hierarchical attributes that can interpolate across the geometry.
    • Geometric extents and computed bounding boxes.
    • Pruning visibility: Controlling the visibility of parts of the scene.
    • Purpose attribute: Provides conditional visibility for deploying proxies and guides;  can be useful for level-of-detail management.
  • Shading: The UsdShade schemas establish a system for creating and connecting shader nodes into networks, forming reusable materials. These materials can have a public interface of attributes to control parameters in the shader networks. UsdShade also facilitates the binding of materials to geometry, defining their response to lighting and physics.
  • Model and Asset: USD’s data aggregation capabilities enable the construction of large, complex scenes. To aid in managing these scenes, USD introduces:
    • Model Prim Classification: This allows the scene graph to be segmented into logical, manageable units for easier traversal and data management.
    • Asset Concept: It appears in two ways in USD:
      • As a core data type for referencing external files, ensuring clear identification of data for asset/path resolution.
      • In the AssetInfo schema, which records the assets referenced in a scene, maintained even in flattened scenes.

Overall, the built-in schemas provide a comprehensive approach to representing, manipulating, and rendering 3D graphics in USD, making it a robust system for complex scene assembly and management.

Custom Schemas

One of the most powerful features of OpenUSD is its extensibility, which is where custom schemas come into play. While the built-in schemas are generally comprehensive, project-specific or application-specific requirements may not be covered. In such cases, developers can create custom schemas that extend the existing ones or introduce entirely new functionalities.

For instance, if you’re working on a virtual reality project that requires a unique way of handling user interactions, you could develop a custom schema to manage these specific events.

(It is recommended to prefix schema prototypes with specificity such as “MyOrganization” above, to clarify that the schema is not yet standard and/or is not necessarily supported outside of USD applications supplied by “MyOrganization”.)

OpenUSD schemas, both built-in and custom, serve as the foundational pillars that bring structure, consistency, and extensibility to the 3D graphics ecosystem. By understanding the role and capabilities of these schemas, you can unlock the full potential of what OpenUSD has to offer, whether adhering to established standards or pioneering new frontiers with custom schemas.

The Schema Journey

  • Prototype: Work with custom Properties and iterate on the data model and runtime behaviors until stable.
  • Formalize: Create a custom schema from the prototyped Properties. Evaluate the tradeoffs of creating a typed or API schema and other considerations.
  • Review: The schema should be reviewed internally with canonical and test assets. During this phase evaluate behavior performance and portability tradeoffs of the schema.
  • Publish: Publish the schema and a whitepaper for review by the USD community, including a cross-industry review in the appropriate AOUSD working group(s). Iterate on the design until consensus is reached.
  • Standardize: AOUSD approves the new schema as a standard, with a plan to support it in all OpenUSD-compliant implementations.

Basic Guide To Creating Custom Schemas

Creating new Prim types can range from simple definitions to complex structures like a Mesh. Here’s a brief on generating new schema classes:

  1. Configure the Environment: Ensure Python modules like “jinja2” and “argparse” are installed.
  2. Define the Schema Class: A schema class is a container of a UsdPrim. It provides a specific API atop the underlying scene graph.
  3. Types of Schema Classes:
    1. IsA schema: Imparts a typeName to a Prim, can be concrete or abstract.
    2. API schema: Provides an interface but doesn’t specify a typeName.

See some example boilerplate for custom schema development.

Integrating Schemas in Workflow

Schemas can be integrated into existing workflows by attaching new API schemas to USD objects. For example, adding a PhysicsRigidBodyAPI to an object in a USD file enhances it with physics Properties.

OpenUSD schemas are crucial for modern 3D content creation, offering a standardized, flexible framework for complex virtual worlds. By understanding and leveraging these schemas, developers and artists can unlock immense potential in the realm of digital content.

Check out the AOUSD website to learn more about the organization. For more resources, visit our forum. Follow AOUSD on LinkedIn, Twitter, Facebook, Instagram, and YouTube.