1# OpenSubdiv 2 3OpenSubdiv 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. 4 5OpenSubdiv 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". 6 7Feel free to use it and let us know what you think. 8 9For more details about OpenSubdiv, see [Pixar Graphics Technologies](http://graphics.pixar.com). 10 11| | Linux | Windows | macOS | 12|:-------:|:---------:|:---------:|:---------:| 13| dev | [![Build Status](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_apis/build/status/PixarAnimationStudios.OpenSubdiv?branchName=dev&jobName=Linux)](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_build/latest?definitionId=2&branchName=dev) | [![Build Status](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_apis/build/status/PixarAnimationStudios.OpenSubdiv?branchName=dev&jobName=Windows)](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_build/latest?definitionId=2&branchName=dev) | [![Build Status](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_apis/build/status/PixarAnimationStudios.OpenSubdiv?branchName=dev&jobName=macOS)](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_build/latest?definitionId=2&branchName=dev) | 14| release | [![Build Status](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_apis/build/status/PixarAnimationStudios.OpenSubdiv?branchName=release&jobName=Linux)](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_build/latest?definitionId=2&branchName=release) | [![Build Status](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_apis/build/status/PixarAnimationStudios.OpenSubdiv?branchName=release&jobName=Windows)](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_build/latest?definitionId=2&branchName=release) | [![Build Status](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_apis/build/status/PixarAnimationStudios.OpenSubdiv?branchName=release&jobName=macOS)](https://dev.azure.com/PixarAnimationStudios/OpenSubdiv/_build/latest?definitionId=2&branchName=release) | 15 16## Documents 17 * [User Documents](http://graphics.pixar.com/opensubdiv/docs/intro.html) 18 * [Doxygen API Documents](http://graphics.pixar.com/opensubdiv/docs/doxy_html/index.html) 19 * [Release Notes](http://graphics.pixar.com/opensubdiv/docs/release_notes.html) 20 21## Forum 22 * [OpenSubdiv Google Groups](https://groups.google.com/forum/embed/?place=forum/opensubdiv) 23 24## Prerequisite 25 For complete information, please refer OpenSubdiv documents: 26 [Building with CMake](http://graphics.pixar.com/opensubdiv/docs/cmake_build.html) 27 28 * General requirements: 29 30| Lib | Min Version | Note | 31| ----------------------------- | ----------- | ---------- | 32| [CMake](http://www.cmake.org) | 2.8.6 | *Required* | 33 34 * Osd optional requirements: 35 36| Lib | Min Version | Note | 37| ------------------------------------------------------------------ | ----------- | ----------------------------| 38| [CUDA](http://developer.nvidia.com/cuda-toolkit) | 4.0 | cuda backend | 39| [TBB](https://www.threadingbuildingblocks.org) | 4.0 | TBB backend | 40| [OpenCL](http://www.khronos.org/opencl) | 1.1 | CL backend | 41| [DX11 SDK](http://www.microsoft.com/download/details.aspx?id=6812) | | DX backend | 42| [Metal](https://developer.apple.com/metal/) | 1.2 | Metal backend | 43 44 * Requirements for building optional examples: 45 46| Lib | Min Version | Note | 47| -------------------------------------| ----------- | --------------------------------- | 48| [GLFW](http://www.glfw.org) | 3.0.0 | GL examples | 49| [Ptex](https://github.com/wdas/ptex) | 2.0 | ptex viewers | 50| [Zlib](http://www.zlib.net) | | (required for Ptex under windows) | 51 52 * Requirements for building documentation: 53 54| Lib | 55| ------------------------------------------- | 56| [Docutils](http://docutils.sourceforge.net) | 57| [Doxygen](http://www.doxygen.org) | 58| [Graphviz](https://graphviz.gitlab.io/) | 59 60 61## Build example to run glViewer and other example programs with minimal dependency 62 63### All platforms: 64 65 * Install cmake and GLFW 66 67 make sure GLFW install directories are configured as follows: 68 69``` 70 ${GLFW_LOCATION}/include/GLFW/glfw3.h 71 ${GLFW_LOCATION}/lib/libglfw3.a (linux) 72 ${GLFW_LOCATION}/lib/glfw3.lib (windows) 73``` 74 75 * Clone OpenSubdiv repository, and create a build directory. 76``` 77 git clone https://github.com/PixarAnimationStudios/OpenSubdiv 78 mkdir build 79 cd build 80``` 81 82### Windows (Visual Studio) 83 84``` 85cmake ^ 86 -G "Visual Studio 15 2017 Win64" ^ 87 -D NO_PTEX=1 -D NO_DOC=1 ^ 88 -D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 ^ 89 -D "GLFW_LOCATION=*YOUR GLFW INSTALL LOCATION*" ^ 90 .. 91 92cmake --build . --config Release --target install 93``` 94 95### Linux 96 97``` 98cmake -D NO_PTEX=1 -D NO_DOC=1 \ 99 -D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 \ 100 -D GLFW_LOCATION="*YOUR GLFW INSTALL LOCATION*" \ 101 .. 102 103cmake --build . --config Release --target install 104``` 105 106### macOS 107 108``` 109cmake -G Xcode -D NO_PTEX=1 -D NO_DOC=1 \ 110 -D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 \ 111 -D GLFW_LOCATION="*YOUR GLFW INSTALL LOCATION*" \ 112 .. 113 114cmake --build . --config Release --target install 115``` 116 117### iOS 118 119 * Because OpenSubdiv uses a self-built build tool (stringify) as part of the build process, you'll want to build for macOS and build the stringify target 120 121``` 122SDKROOT=$(xcrun --sdk iphoneos --show-sdk-path) cmake -D NO_PTEX=1 -D NO_DOC=1 \ 123 -D NO_OMP=1 -D NO_TBB=1 -D NO_CUDA=1 -D NO_OPENCL=1 -D NO_CLEW=1 \ 124 -D STRINGIFY_LOCATION="*YOUR MACOS BUILD LOCATION*"/bin/stringify \ 125 -D CMAKE_TOOLCHAIN_FILE=../cmake/iOSToolchain.cmake -G Xcode \ 126 .. 127``` 128 129 * This will produce an "OpenSubdiv.xcodeproj" that can be open and the targets 'mtlViewer' and 'mtlPtexViewer' (if NO_PTEX is ommitted and libPtex.a is installed in the iOS SDK) that can be run 130 131### Useful cmake options and environment variables 132 133```` 134-DCMAKE_BUILD_TYPE=[Debug|Release] 135 136-DCMAKE_INSTALL_PREFIX=[base path to install OpenSubdiv] 137-DCMAKE_LIBDIR_BASE=[library directory basename (default: lib)] 138-DCMAKE_TOOLCHAIN_FILE=[toolchain file for crossplatform builds] 139 140-DCUDA_TOOLKIT_ROOT_DIR=[path to CUDA Toolkit] 141-DPTEX_LOCATION=[path to Ptex] 142-DGLFW_LOCATION=[path to GLFW] 143-DSTRINGIFY_LOCATION=[path to stringify utility] 144 145-DNO_LIB=1 // disable the opensubdiv libs build (caveat emptor) 146-DNO_EXAMPLES=1 // disable examples build 147-DNO_TUTORIALS=1 // disable tutorials build 148-DNO_REGRESSION=1 // disable regression tests build 149-DNO_PTEX=1 // disable PTex support 150-DNO_DOC=1 // disable documentation build 151-DNO_OMP=1 // disable OpenMP 152-DNO_TBB=1 // disable TBB 153-DNO_CUDA=1 // disable CUDA 154-DNO_OPENCL=1 // disable OpenCL 155-DNO_OPENGL=1 // disable OpenGL 156-DNO_CLEW=1 // disable CLEW wrapper library 157-DNO_METAL=1 // disable Metal 158```` 159 160