Convert Figma logo to code with AI

PixarAnimationStudios logoOpenUSD

Universal Scene Description

5,989
1,181
5,989
832

Top Related Projects

Advanced shading language for production GI renderers

A color management framework for visual effects and animation.

An Open-Source subdivision surface library.

Mitsuba 2: A Retargetable Forward and Inverse Renderer

2,090

BRDF Explorer

13,039

Official mirror of Blender

Quick Overview

OpenUSD (Universal Scene Description) is an open-source 3D scene description and file format developed by Pixar Animation Studios. It provides a flexible and extensible framework for exchanging 3D graphics data across various digital content creation tools and rendering systems. OpenUSD is designed to handle complex scenes with large amounts of data and supports collaborative workflows in film, animation, and game development.

Pros

  • Highly scalable and efficient for handling large, complex 3D scenes
  • Supports collaborative workflows with layer-based composition
  • Extensible architecture allowing for custom schemas and plugins
  • Wide industry adoption and integration with major 3D software packages

Cons

  • Steep learning curve due to its comprehensive feature set
  • Limited documentation for advanced use cases
  • Performance overhead for simple scenes or small-scale projects
  • Complexity may be overkill for basic 3D workflows

Code Examples

  1. Creating a simple USD stage:
from pxr import Usd, UsdGeom

stage = Usd.Stage.CreateNew("myScene.usda")
xformPrim = UsdGeom.Xform.Define(stage, "/myXform")
spherePrim = UsdGeom.Sphere.Define(stage, "/myXform/mySphere")
stage.Save()
  1. Adding a material to a USD prim:
from pxr import Usd, UsdShade

stage = Usd.Stage.Open("myScene.usda")
material = UsdShade.Material.Define(stage, "/myMaterial")
shader = UsdShade.Shader.Define(stage, "/myMaterial/myShader")
shader.CreateIdAttr("UsdPreviewSurface")
material.CreateSurfaceOutput().ConnectToSource(shader.ConnectableAPI(), "surface")

spherePrim = stage.GetPrimAtPath("/myXform/mySphere")
UsdShade.MaterialBindingAPI(spherePrim).Bind(material)
stage.Save()
  1. Querying and traversing a USD stage:
from pxr import Usd, UsdGeom

stage = Usd.Stage.Open("myScene.usda")
rootPrim = stage.GetPseudoRoot()

def traverse_stage(prim):
    print(prim.GetPath())
    for child in prim.GetChildren():
        traverse_stage(child)

traverse_stage(rootPrim)

Getting Started

To get started with OpenUSD:

  1. Install OpenUSD using your preferred method (build from source, use pre-built binaries, or package manager).
  2. Set up your environment variables (e.g., USD_INSTALL_ROOT, PYTHONPATH).
  3. Create a new Python script and import the necessary modules:
from pxr import Usd, UsdGeom, UsdShade

# Create a new USD stage
stage = Usd.Stage.CreateNew("myFirstScene.usda")

# Add a sphere to the stage
spherePrim = UsdGeom.Sphere.Define(stage, "/mySphere")

# Save the stage
stage.Save()

print("USD scene created successfully!")
  1. Run the script to create your first USD scene.

Competitor Comparisons

Advanced shading language for production GI renderers

Pros of OpenShadingLanguage

  • Specialized for shading and rendering tasks in computer graphics
  • Extensive documentation and examples for shader writing
  • Active community and regular updates

Cons of OpenShadingLanguage

  • Narrower scope compared to OpenUSD's broader application in 3D pipelines
  • Steeper learning curve for non-shader programmers
  • Less integration with other 3D software tools out of the box

Code Comparison

OpenShadingLanguage:

shader example(
    color input_color = color(1, 1, 1),
    output color result = color(0, 0, 0)
)
{
    result = input_color * noise("perlin", P);
}

OpenUSD:

from pxr import Usd, UsdGeom, Sdf

stage = Usd.Stage.CreateNew("example.usda")
xformPrim = UsdGeom.Xform.Define(stage, "/World")
spherePrim = UsdGeom.Sphere.Define(stage, "/World/Sphere")

The OpenShadingLanguage example shows a simple shader definition, while the OpenUSD code demonstrates creating a basic scene structure. OpenShadingLanguage focuses on material and shading aspects, whereas OpenUSD provides a broader framework for describing 3D scenes and assets.

A color management framework for visual effects and animation.

Pros of OpenColorIO

  • Specialized focus on color management, making it more efficient for color-specific tasks
  • Wider industry adoption in visual effects and animation pipelines
  • Simpler integration process for color-related workflows

Cons of OpenColorIO

  • Limited scope compared to OpenUSD's comprehensive 3D data interchange capabilities
  • Less flexibility for handling complex scene hierarchies and relationships
  • Fewer built-in tools for asset management and collaboration

Code Comparison

OpenColorIO:

namespace OCIO = OCIO_NAMESPACE;
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
OCIO::ConstProcessorRcPtr processor = config->getProcessor("input", "output");
processor->apply(pixelData, numPixels);

OpenUSD:

#include "pxr/usd/usd/stage.h"
#include "pxr/usd/usdGeom/sphere.h"

auto stage = pxr::UsdStage::CreateInMemory();
auto spherePrim = pxr::UsdGeomSphere::Define(stage, pxr::SdfPath("/mySphere"));
spherePrim.CreateRadiusAttr().Set(10.0);

OpenColorIO focuses on color transformation operations, while OpenUSD provides a more comprehensive framework for 3D scene description and manipulation. OpenColorIO is more specialized and efficient for color management tasks, but OpenUSD offers greater flexibility for complex 3D data interchange and scene composition.

An Open-Source subdivision surface library.

Pros of OpenSubdiv

  • Focused specifically on subdivision surface algorithms, providing highly optimized performance
  • Offers GPU acceleration for real-time rendering of subdivision surfaces
  • Smaller codebase, potentially easier to integrate into existing projects

Cons of OpenSubdiv

  • Limited scope compared to OpenUSD's comprehensive scene description capabilities
  • Lacks the extensive ecosystem and tooling support that OpenUSD provides
  • May require additional libraries or frameworks for complete 3D pipeline integration

Code Comparison

OpenSubdiv:

OpenSubdiv::Far::TopologyRefiner * refiner =
    OpenSubdiv::Far::TopologyRefinerFactory<OpenSubdiv::Far::TopologyDescriptor>::Create(
        desc, OpenSubdiv::Far::TopologyRefinerFactory<OpenSubdiv::Far::TopologyDescriptor>::Options(
            OpenSubdiv::Sdc::SchemeType::CATMARK));

OpenUSD:

from pxr import Usd, UsdGeom

stage = Usd.Stage.CreateNew("myScene.usda")
xformPrim = UsdGeom.Xform.Define(stage, "/myXform")
spherePrim = UsdGeom.Sphere.Define(stage, "/myXform/mySphere")

OpenSubdiv focuses on low-level subdivision algorithms, while OpenUSD provides a high-level scene description framework. OpenSubdiv's code deals directly with topology refinement, whereas OpenUSD's code demonstrates scene composition and geometry creation. OpenUSD offers a more comprehensive solution for 3D pipeline management, while OpenSubdiv excels in its specific domain of subdivision surfaces.

Mitsuba 2: A Retargetable Forward and Inverse Renderer

Pros of Mitsuba2

  • Specialized in physically-based rendering and light transport simulation
  • Supports advanced rendering techniques like bidirectional path tracing and photon mapping
  • Designed for research and experimentation in computer graphics

Cons of Mitsuba2

  • Narrower focus on rendering, lacking the broader asset management capabilities of OpenUSD
  • Smaller community and ecosystem compared to OpenUSD
  • Less integration with major 3D content creation tools

Code Comparison

Mitsuba2 (Scene definition):

scene = mi.load_file('scene.xml')
sensor = scene.sensors()[0]
scene.integrator().render(scene, sensor)

OpenUSD (Scene composition):

stage = Usd.Stage.CreateNew("myScene.usda")
xformPrim = UsdGeom.Xform.Define(stage, "/world")
spherePrim = UsdGeom.Sphere.Define(stage, "/world/sphere")

While both projects deal with 3D scenes, Mitsuba2 focuses on physically-based rendering, whereas OpenUSD provides a more comprehensive framework for managing and interchanging 3D assets across various applications and pipelines.

2,090

BRDF Explorer

Pros of BRDF

  • Focused on a specific aspect of rendering (Bidirectional Reflectance Distribution Functions)
  • Lightweight and easy to integrate into existing projects
  • Provides a simple viewer for visualizing BRDFs

Cons of BRDF

  • Limited scope compared to OpenUSD's comprehensive framework
  • Less active development and community support
  • Fewer features and tools for broader animation and VFX workflows

Code Comparison

BRDF (Python):

def cook_torrance(N, L, V, roughness, F0):
    H = normalize(L + V)
    NdotL = max(dot(N, L), 0.0)
    NdotV = max(dot(N, V), 0.0)
    NdotH = max(dot(N, H), 0.0)
    # ... (additional calculations)

OpenUSD (C++):

UsdGeomMesh mesh = UsdGeomMesh::Define(stage, SdfPath("/myMesh"));
mesh.CreatePointsAttr().Set(VtVec3fArray({
    GfVec3f(0, 0, 0), GfVec3f(1, 0, 0), GfVec3f(1, 1, 0)
}));
mesh.CreateFaceVertexCountsAttr().Set(VtIntArray({3}));
mesh.CreateFaceVertexIndicesAttr().Set(VtIntArray({0, 1, 2}));

The code snippets highlight the different focus areas of the two projects. BRDF deals with specific lighting calculations, while OpenUSD provides a broader framework for defining 3D scenes and assets.

13,039

Official mirror of Blender

Pros of Blender

  • Comprehensive 3D creation suite with modeling, animation, rendering, and more
  • Large, active community with extensive documentation and tutorials
  • Free and open-source software with regular updates

Cons of Blender

  • Steeper learning curve for beginners compared to OpenUSD
  • Less focused on interchange and pipeline integration
  • May require additional plugins for advanced USD support

Code Comparison

Blender (Python API):

import bpy

bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0))
bpy.ops.object.shade_smooth()

OpenUSD (Python API):

from pxr import Usd, UsdGeom

stage = Usd.Stage.CreateNew("cube.usda")
xform = UsdGeom.Xform.Define(stage, "/cube")
cube = UsdGeom.Cube.Define(stage, "/cube/shape")

Both examples create a simple cube, but Blender's API is more focused on direct manipulation within its environment, while OpenUSD emphasizes scene description and interchange. Blender offers a full-featured 3D creation suite, while OpenUSD specializes in universal scene description and pipeline integration.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Universal Scene Description

Universal Scene Description (USD) is an efficient, scalable system for authoring, reading, and streaming time-sampled scene description for interchange between graphics applications.

For more details, please visit the web site here.

Build Status

LinuxWindowsmacOS
devBuild StatusBuild StatusBuild Status
releaseBuild StatusBuild StatusBuild Status

Additional Documentation

Getting Help

Need help understanding certain concepts in USD? See Getting Help with USD or visit our forum.

If you are experiencing undocumented problems with the software, please file a bug.

Supported Platforms

USD is primarily developed on Linux platforms (CentOS 7), but is built, tested and supported on macOS and Windows.

It is also possible to build USD libraries that can be embedded in iOS and visionOS apps.

Please see VERSIONS.md for explicitly tested versions.

Dependencies

Required:

See 3rd Party Library and Application Versions for version information.

Additional dependencies are required for the following components. These components may be disabled at build-time. For further details see Advanced Build Configuration.

Imaging and USD Imaging

Required:

Optional:

Python Bindings

Required:

usdview

Required:

Getting and Building the Code

The simplest way to build USD is to run the supplied build_usd.py script. This script will download required dependencies and build and install them along with USD in a given directory.

Follow the instructions below to run the script with its default behavior, which will build the USD core libraries, Imaging, and USD Imaging components. For more options and documentation, run the script with the --help parameter.

See Advanced Build Configuration for examples and additional documentation for running cmake directly.

1. Install prerequisites (see Dependencies for required versions)

  • Required:
    • C++ compiler:
      • gcc
      • Xcode
      • Microsoft Visual Studio
    • CMake
  • Optional (Can be ignored by passing --no-python as an argument to build_usd.py)

2. Download the USD source code

You can download source code archives from GitHub or use git to clone the repository.

> git clone https://github.com/PixarAnimationStudios/OpenUSD
Cloning into 'OpenUSD'...

3. Run the script

Run the build_usd.py script to build and install USD. Note that the build script is structured with an out-of-source build in mind -- installing a build into the
directory where the repository was cloned is untested.

Linux:

For example, the following will download, build, and install USD's dependencies, then build and install USD into /path/to/my_usd_install_dir.

> python OpenUSD/build_scripts/build_usd.py /path/to/my_usd_install_dir
macOS:

In a terminal, run xcode-select to ensure command line developer tools are installed. Then run the script.

For example, the following will download, build, and install USD's dependencies, then build and install USD into /path/to/my_usd_install_dir.

> python OpenUSD/build_scripts/build_usd.py /path/to/my_usd_install_dir
iOS and visionOS:

When building from a macOS system, you can cross compile for iOS based platforms.

Cross compilation builds are restricted to building libraries that can be embedded in applications built for the target platform. It can be helpful to use a monolithic build when embedding USD (see Advanced Build Configuration).

These builds do not support Python bindings or command line tools.

Currently, these builds also do not support Imaging or USD Imaging.

For example, the following will download, build, and install USD's dependencies, then build and install USD for iOS into /path/to/my_usd_install_dir.

> python OpenUSD/build_scripts/build_usd.py --build-target iOS --build-monolithic /path/to/my_usd_install_dir

Or for visionOS:

> python OpenUSD/build_scripts/build_usd.py --build-target visionOS --build-monolithic /path/to/my_usd_install_dir
Windows:

Launch the "x64 Native Tools Command Prompt" for your version of Visual Studio and run the script in the opened shell. Make sure to use the 64-bit (x64) command prompt and not the 32-bit (x86) command prompt.

See https://docs.microsoft.com/en-us/cpp/build/how-to-enable-a-64-bit-visual-cpp-toolset-on-the-command-line for more details.

For example, the following will download, build, and install USD's dependencies, then build and install USD into C:\path\to\my_usd_install_dir.

C:\> python OpenUSD\build_scripts\build_usd.py "C:\path\to\my_usd_install_dir"

4. Try it out

Set the environment variables specified by the script when it finishes and launch usdview with a sample asset.

> usdview OpenUSD/extras/usd/tutorials/convertingLayerFormats/Sphere.usda

Contributing

If you'd like to contribute to USD (and we appreciate the help!), please see the Contributing page in the documentation for more information.