Skip to content

PixarAnimationStudios/OpenSubdiv

Repository files navigation

OpenSubdiv

OpenSubdiv is a set of open source libraries that implement high performance subdivision surface (subdiv) evaluation on massively parallel CPU and GPU architectures. This codepath is optimized for drawing deforming subdivs with static topology at interactive framerates. The resulting limit surface matches Pixar's Renderman to numerical precision.

OpenSubdiv is covered by the Apache license, and is free to use for commercial or non-commercial use. This is the same code that Pixar uses internally for animated film production. Our intent is to encourage high performance accurate subdiv drawing by giving away the "good stuff".

Feel free to use it and let us know what you think.

For more details about OpenSubdiv, see Pixar Graphics Technologies.

Linux Windows macOS
dev Build Status Build Status Build Status
release Build Status Build Status Build Status

Documents

Forum

Prerequisites and Building

The OpenSubdiv core libraries are implemented in C++ with no dependencies other than the C++ standard library.

The OpenSubdiv::Osd library contains additional conditionally compiled components which use specific external CPU and GPU APIs for evaluation and display and there are also optional interactive examples. Some of these optional aspects are enabled by default but can be disabled while configuring the OpenSubdiv build.

For complete information, please see: Building with CMake

Versions

These are the versions of external dependencies used to test the current release of OpenSubdiv. Generally, OpenSubdiv will also work with earlier and later versions of these external dependencies, but this represents versions known to work.

Core Dependencies Version Note
CMake 3.14 Required
Optional OpenSubdiv::Osd Dependencies Version Note
OpenGL 4.1+ OpenGL
Metal 3+ Metal
CUDA 12.6 CUDA
TBB 2021.12.0 oneTBB
OpenCL 1.1 OpenCL
DirectX11 11+ DirectX11
Optional Interactive Example Dependencies Version Note
GLFW 3.3.3 OpenGL example viewers
Ptex 2.4.2 Ptex example viewers
Zlib 1.2.13 Ptex example viewers
Optional Documentation Dependencies Version Note
Doxygen 1.14.0 C++ API Documentation
Docutils 0.21.2 general documentation
Pygments 2.19 general documentation

Building with minimal dependencies to run glViewer and other example programs

All platforms:

  • Install cmake and GLFW

make sure GLFW install directories are configured as follows:

   ${GLFW_LOCATION}/include/GLFW/glfw3.h
   ${GLFW_LOCATION}/lib/libglfw3.a (linux)
   ${GLFW_LOCATION}/lib/glfw3.lib (windows)
  • Clone OpenSubdiv repository
   git clone https://github.com/PixarAnimationStudios/OpenSubdiv
   cd OpenSubdiv

Windows (Visual Studio)

cmake -B buildDir ^
      -D CMAKE_INSTALL_PREFIX=instDir ^
      -G "Visual Studio 16 2019" -A x64 ^
      -D NO_PTEX=1 -D NO_DOC=1 ^
      -D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 ^
      -D "GLFW_LOCATION=C:\path\to\glfw" ^
      -S .

cmake --build buildDir --config Release --target install

Linux

cmake -B buildDir \
      -D CMAKE_INSTALL_PREFIX=instDir \
      -D NO_PTEX=1 -D NO_DOC=1 \
      -D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 \
      -D "GLFW_LOCATION=/path/to/glfw" \
      -S .

cmake --build buildDir --config Release --target install

macOS

cmake -B buildDir \
      -D CMAKE_INSTALL_PREFIX=instDir \
      -G Xcode \
      -D NO_PTEX=1 -D NO_DOC=1 \
      -D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 \
      -D "GLFW_LOCATION=/path/to/glfw" \
      -S .

cmake --build buildDir --config Release --target install

iOS

Use CMAKE_SYSTEM_NAME to have CMake use the appropriate cross-compilation toolchain when building for iOS.

SDKROOT=$(xcrun --sdk iphoneos --show-sdk-path) \
cmake -B buildDir \
      -D CMAKE_INSTALL_PREFIX=instDir \
      -G Xcode \
      -D CMAKE_SYSTEM_NAME=iOS \
      -D NO_PTEX=1 -D NO_DOC=1 \
      -D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 \
      -D NO_TUTORIALS=1 -D NO_EXAMPLES=1 -D NO_REGRESSION=1 -D NO_OPENGL=1 \
      -S .
  • This will produce an "OpenSubdiv.xcodeproj" that can be opened with Xcode.
  • Use SDKROOT=$(xcrun --sdk iphonesimulator --show-sdk-path) instead for an iOS-Sim target

Useful cmake options and environment variables

-DCMAKE_BUILD_TYPE=[Debug|Release]

-DCMAKE_INSTALL_PREFIX=[base path to install OpenSubdiv (default: Current directory)]
-DCMAKE_LIBDIR_BASE=[library directory basename (default: lib)]
-DCMAKE_SYSTEM_NAME=[target system name for cross-compilation builds, e.g. iOS]

-DCMAKE_PREFIX_PATH=[semicolon-separated list of directories specifying installation prefixes to be searched by the find_package() command (default: empty list)]

-DCUDA_SDK_ROOT_DIR=[path to CUDA]
-DCUDA_TOOLKIT_ROOT_DIR=[path to CUDA]
-DOSD_CUDA_NVCC_FLAGS=[CUDA options, e.g. --gpu-architecture]

-DGLFW_LOCATION=[path to GLFW for OpenGL example viewers]
-DPTEX_LOCATION=[path to Ptex for Ptex example viewers]

-DNO_LIB=1        // disable the opensubdiv libs build (caveat emptor)
-DNO_EXAMPLES=1   // disable examples build
-DNO_TUTORIALS=1  // disable tutorials build
-DNO_REGRESSION=1 // disable regression tests build
-DNO_PTEX=1       // disable Ptex examples
-DNO_DOC=1        // disable documentation build
-DNO_OMP=1        // disable OpenMP
-DNO_TBB=1        // disable TBB
-DNO_CUDA=1       // disable CUDA
-DNO_OPENCL=1     // disable OpenCL
-DNO_CLEW=1       // disable OpenCL loader library
-DNO_OPENGL=1     // disable OpenGL
-DNO_METAL=1      // disable Metal

-DOSD_PATCH_SHADER_SOURCE_GLSL=1  // GLSL Patch Shader Source
-DOSD_PATCH_SHADER_SOURCE_HLSL=1  // HLSL Patch Shader Source
-DOSD_PATCH_SHADER_SOURCE_MSL=1   // MSL Patch Shader Source

About

An Open-Source subdivision surface library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 52