An Open-Source subdivision surface library.

Related tags

Graphics OpenSubdiv
Overview

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

Prerequisite

For complete information, please refer OpenSubdiv documents: Building with CMake

  • General requirements:
Lib Min Version Note
CMake 2.8.6 Required
  • Osd optional requirements:
Lib Min Version Note
CUDA 4.0 cuda backend
TBB 4.0 TBB backend
OpenCL 1.1 CL backend
DX11 SDK DX backend
Metal 1.2 Metal backend
  • Requirements for building optional examples:
Lib Min Version Note
GLFW 3.0.0 GL examples
Ptex 2.0 ptex viewers
Zlib (required for Ptex under windows)
  • Requirements for building documentation:
Lib
Docutils
Doxygen
Graphviz

Build example to run glViewer and other example programs with minimal dependency

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, and create a build directory.
   git clone https://github.com/PixarAnimationStudios/OpenSubdiv
   mkdir build
   cd build

Windows (Visual Studio)

cmake ^
    -G "Visual Studio 15 2017 Win64" ^
    -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=*YOUR GLFW INSTALL LOCATION*" ^
    ..

cmake --build . --config Release --target install

Linux

cmake -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="*YOUR GLFW INSTALL LOCATION*" \
      ..

cmake --build . --config Release --target install

macOS

cmake -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="*YOUR GLFW INSTALL LOCATION*" \
      ..

cmake --build . --config Release --target install

iOS

  • 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
SDKROOT=$(xcrun --sdk iphoneos --show-sdk-path) cmake -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 STRINGIFY_LOCATION="*YOUR MACOS BUILD LOCATION*"/bin/stringify \
      -D CMAKE_TOOLCHAIN_FILE=../cmake/iOSToolchain.cmake -G Xcode \
      ..
  • 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

Useful cmake options and environment variables

-DCMAKE_BUILD_TYPE=[Debug|Release]

-DCMAKE_INSTALL_PREFIX=[base path to install OpenSubdiv]
-DCMAKE_LIBDIR_BASE=[library directory basename (default: lib)]
-DCMAKE_TOOLCHAIN_FILE=[toolchain file for crossplatform builds]

-DCUDA_TOOLKIT_ROOT_DIR=[path to CUDA Toolkit]
-DPTEX_LOCATION=[path to Ptex]
-DGLFW_LOCATION=[path to GLFW]
-DSTRINGIFY_LOCATION=[path to stringify utility]

-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 support
-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_OPENGL=1     // disable OpenGL
-DNO_CLEW=1       // disable CLEW wrapper library
-DNO_METAL=1      // disable Metal
Issues
  • mac os x 10.9.1 build failure | xcode 5.0.2

    mac os x 10.9.1 build failure | xcode 5.0.2

    • osd_static_gpu
    • osd_dynamic_gpu issues

    PhaseScriptExecution CMake\ Rules /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/OpenSubdiv.build/Debug/osd_dynamic_gpu.build/Script-BE90FE07BE8C40CDBF41F9AD.sh cd /Users/nik/Documents/code/github/OpenSubdiv /bin/sh -c /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/OpenSubdiv.build/Debug/osd_dynamic_gpu.build/Script-BE90FE07BE8C40CDBF41F9AD.sh

    echo "Building NVCC (Device) object opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o" Building NVCC (Device) object opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o cd /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir && /Applications/CMake\ 2.8-12.app/Contents/bin/cmake -E make_directory /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug cd /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir && /Applications/CMake\ 2.8-12.app/Contents/bin/cmake -D verbose:BOOL=ON -D build_configuration:STRING= -D generated_file:STRING=/Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o -D generated_cubin_file:STRING=/Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o.cubin.txt -P /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.cmake -- Removing /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E remove /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o -- Generating dependency file: /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.NVCC-depend /usr/local/cuda/bin/nvcc -M -D__CUDACC__ /Users/nik/Documents/code/github/OpenSubdiv/opensubdiv/osd/cudaKernel.cu -o /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.NVCC-depend -ccbin /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -m64 -DOPENSUBDIV_HAS_GCD -DOPENSUBDIV_HAS_TBB -DOPENSUBDIV_HAS_OPENCL -DOPENSUBDIV_HAS_CUDA -Xcompiler ,"-g" -Xcompiler -fPIC --gpu-architecture compute_11 -DNVCC -I/usr/local/cuda/include -I/Users/nik/Documents/code/github/OpenSubdiv/opensubdiv -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework -I/opt/local/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenCL.framework -I/Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd -I/usr/local/cuda/include -- Generating temporary cmake readable file: /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.depend.tmp "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -D input_file:FILEPATH=/Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.NVCC-depend -D output_file:FILEPATH=/Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.depend.tmp -P "/Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake" -- Copy if different /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.depend.tmp to /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.depend "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E copy_if_different /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.depend.tmp /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.depend -- Removing /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.depend.tmp and /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.NVCC-depend "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E remove /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.depend.tmp /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//osd_static_gpu_generated_cudaKernel.cu.o.NVCC-depend -- Generating /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o /usr/local/cuda/bin/nvcc /Users/nik/Documents/code/github/OpenSubdiv/opensubdiv/osd/cudaKernel.cu -dc -o /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o -ccbin /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -m64 -DOPENSUBDIV_HAS_GCD -DOPENSUBDIV_HAS_TBB -DOPENSUBDIV_HAS_OPENCL -DOPENSUBDIV_HAS_CUDA -Xcompiler ,"-g" -Xcompiler -fPIC --gpu-architecture compute_11 -DNVCC -I/usr/local/cuda/include -I/Users/nik/Documents/code/github/OpenSubdiv/opensubdiv -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework -I/opt/local/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenCL.framework -I/Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd -I/usr/local/cuda/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config(191): error: identifier "__char16_t" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config(192): error: identifier "__char32_t" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config(303): error: expected an identifier

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config(303): error: inline specifier allowed on function declarations only

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config(304): error: expected an expression

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config(305): error: expected a ";"

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstddef(49): error: expected an identifier

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstddef(49): error: inline specifier allowed on function declarations only

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstddef(51): error: expected an expression

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstddef(51): error: expected a "}"

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/cstddef(91): error: expected a declaration

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(174): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(176): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(177): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(181): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(182): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(186): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(187): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(206): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(207): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(214): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(215): error: identifier "nullptr_t" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(215): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(222): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(223): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(224): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(225): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(226): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(227): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(229): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(230): error: class "__is_integral<char16_t>" has already been defined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(230): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(232): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(233): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(234): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(235): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(236): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(237): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(238): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(239): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(246): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(247): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(248): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(249): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(257): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(259): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(261): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(265): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(266): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(273): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(274): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(276): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(281): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(282): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(296): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(296): error: identifier "__is_union" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(296): error: function call is not allowed in a constant expression

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(296): error: type name is not allowed

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(296): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(311): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(311): error: identifier "__is_class" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(311): error: function call is not allowed in a constant expression

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(311): error: type name is not allowed

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(311): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(328): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(329): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(336): error: identifier "__two" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(344): error: identifier "nullptr_t" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(346): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(346): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(348): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(355): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(363): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(364): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(372): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(372): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(380): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(380): error: identifier "__is_enum" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(380): error: function call is not allowed in a constant expression

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(380): error: type name is not allowed

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(380): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(401): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(401): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(407): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(407): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(414): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(414): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(420): error: identifier "nullptr_t" is undefined

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(420): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(425): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(425): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(433): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(433): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(528): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(528): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(531): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(536): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(543): error: integral_constant is not a template

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(543): error: not a class or struct name

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits(546): error: not a class or struct name

    Error limit reached. 100 errors detected in the compilation of "/tmp/tmpxft_00012066_00000000-6_cudaKernel.cpp1.ii". Compilation terminated. -- Removing /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E remove /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o CMake Error at osd_static_gpu_generated_cudaKernel.cu.o.cmake:264 (message): Error generating file /Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir//Debug/osd_static_gpu_generated_cudaKernel.cu.o

    make: *** [/Users/nik/Documents/code/github/OpenSubdiv_Bin/opensubdiv/osd/CMakeFiles/osd_static_gpu.dir/Debug/osd_static_gpu_generated_cudaKernel.cu.o] Error 1 Command /bin/sh failed with exit code 2

    opened by nyotis 27
  • Bug report for Mac compilation

    Bug report for Mac compilation

    Macbook Pro OS: Mac OS X ver. 10.6.8

    Compiling lib IlmBase 1.0.2:

    localhost:ilmbase-1.0.2 laurenceemms$ ./configure checking build system type... i686-apple-darwin10.8.0 checking host system type... i686-apple-darwin10.8.0 checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... no checking for nawk... no checking for awk... awk checking whether make sets $(MAKE)... yes checking whether to enable maintainer-specific portions of Makefiles... no checking for g++... g++ checking for C++ compiler default output file name... a.out checking whether the C++ compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for style of include used by make... GNU checking dependency style of g++... gcc3 checking for a BSD-compatible install... /usr/bin/install -c checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking dependency style of gcc... gcc3 checking whether ln -s works... yes checking for a sed that does not truncate output... /usr/bin/sed checking for egrep... grep -E checking for ld used by gcc... /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld... no checking for /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm checking how to recognise dependent libraries... pass_all checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... myes checking for unistd.h... ayes checking dlfcn.h usability... kyes checking dlfcn.h presence... eyes checking for dlfcn.h... yes checking how to run the C++ preprocessor... g++ -E checking for g77... no checking for f77... no checking for xlf... no checking for frt... no checking for pgf77... no checking for fort77... no checking for fl32... no checking for af77... no checking for f90... no checking for xlf90... no checking for pgf90... no checking for epcf90... no checking for f95... no checking for fort... no checking for xlf95... no checking for ifc... no checking for efc... no checking for pgf95... no checking for lf95... no checking for gfortran... no checking whether we are using the GNU Fortran 77 compiler... no checking whether accepts -g... no checking the maximum length of command line arguments... 196608 checking command to parse /usr/bin/nm output from gcc object... rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory checking if gcc supports -fno-rtti -fno-exceptions... rm: conftest.dSYM: is a directory no checking for gcc option to produce PIC... -fno-common checking if gcc PIC flag -fno-common works... rm: conftest.dSYM: is a directory yes checking if gcc static flag -static works... rm: conftest.dSYM: is a directory no checking if gcc supports -c -o file.o... rm: conftest.dSYM: is a directory yes checking whether the gcc linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin10.8.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool appending configuration tag "CXX" to libtool rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory checking for ld used by g++... /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld... no checking whether the g++ linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fno-common checking if g++ PIC flag -fno-common works... rm: conftest.dSYM: is a directory yes checking if g++ static flag -static works... rm: conftest.dSYM: is a directory no checking if g++ supports -c -o file.o... rm: conftest.dSYM: is a directory yes checking whether the g++ linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin10.8.0 dyld checking how to hardcode library paths into programs... immediate appending configuration tag "F77" to libtool checking whether make sets $(MAKE)... (cached) yes checking for the pthreads library -lpthreads... no checking whether pthreads work without any flags... yes checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE checking if more special flags are required for pthreads... -D_THREAD_SAFE checking for cc_r... gcc checking semaphore.h usability... yes checking semaphore.h presence... yes checking for semaphore.h... yes checking for library containing sem_init... none required checking whether to use POSIX unnamed semaphores... no (pshared not usable) configure: multithread true, LIBS = , CC = gcc, CXXFLAGS = -g -O2 -D_THREAD_SAFE checking for ANSI C header files... (cached) yes checking limits.h usability... yes checking limits.h presence... yes checking for limits.h... yes checking for unistd.h... (cached) yes checking for an ANSI C-conforming const... yes checking for inline... inline checking for size_t... yes checking for strerror... yes checking for complete iomanip support in C++ standard library... yes checking for gcc optimization flags... -pipe configure: creating ./config.status config.status: creating Makefile config.status: creating IlmBase.pc config.status: creating config/Makefile config.status: creating Half/Makefile config.status: creating HalfTest/Makefile config.status: creating Iex/Makefile config.status: creating IexTest/Makefile config.status: creating IlmThread/Makefile config.status: creating Imath/Makefile config.status: creating ImathTest/Makefile config.status: creating vc/Makefile config.status: creating config/IlmBaseConfig.h config.status: executing depfiles commands


    Summary for IlmBase features:

    OS X architectures default OS X SDK default

    OS X two-way universal build (deprecated) no

    localhost:ilmbase-1.0.2 laurenceemms$ make Making all in Half if g++ -DHAVE_CONFIG_H -I. -I. -I../config -I../config -pipe -g -O2 -D_THREAD_SAFE -Wno-long-double -MT eLut.o -MD -MP -MF ".deps/eLut.Tpo" -c -o eLut.o eLut.cpp;
    then mv -f ".deps/eLut.Tpo" ".deps/eLut.Po"; else rm -f ".deps/eLut.Tpo"; exit 1; fi cc1plus: error: unrecognized command line option "-Wno-long-double" make[1]: *** [eLut.o] Error 1 make: *** [all-recursive] Error 1 localhost:ilmbase-1.0.2 laurenceemms$ make Making all in Half if g++ -DHAVE_CONFIG_H -I. -I. -I../config -I../config -pipe -g -O2 -D_THREAD_SAFE -Wno-long-double -MT eLut.o -MD -MP -MF ".deps/eLut.Tpo" -c -o eLut.o eLut.cpp;
    then mv -f ".deps/eLut.Tpo" ".deps/eLut.Po"; else rm -f ".deps/eLut.Tpo"; exit 1; fi cc1plus: error: unrecognized command line option "-Wno-long-double" make[1]: *** [eLut.o] Error 1 make: *** [all-recursive] Error 1

    As a result I can't install OpenSubdiv on my Macbook Pro

    bug build platform-specifc 
    opened by lemms 25
  • Generate MSCV solution with static CRT?

    Generate MSCV solution with static CRT?

    Is it possible to have CMake generate a MSVC solution that uses static CRT? (/MT)

    I'm admittedly not that familiar with CMake and I'm not sure if this is something that is generic to using CMake or if the project has to build in support for it.

    My use case is that I'm writing an extension for an application where I'm implementing OpenSubdiv. The extensions for this application normally doesn't use installers but instead are packaged as simple ZIP packages that is unpacked. Hence I'm trying to avoid the need to depend on CRT.

    opened by thomthom 24
  • sample build problem

    sample build problem

    Hello.

    This is a sample build problem report. environment : win7 64b, no CUDA, VS2010

    I have generated "OpenSubdiv.sln" by cmake windows. I would like to try a glutViewer sample to see subdivision behavior. But example directory have a mayaViewer directory only.

    After I build the solution, following are built. far_regression hbr_baseline hbr_regression stringify

    How can I build a glutViewer sample?

    Regards.

    osd build platform-specifc 
    opened by kgussan 24
  • Request for dead-simple examples

    Request for dead-simple examples

    I strongly believe we need some dead-simple, self-contained, no gl-hoopla sample-code.

    I'm trying to use osd "just to do some evaluations" and am flailing-wildly and having to look through "a bunch" of files to figure out what's what.

    Monday I'll attempt to do something proper and send it, but having someone to help would be great !

    I'm thinking something where I've got some simple arrays of indices, vertex and texture data and then voila, I can do stuff.

    As it stands now there's code in the common/ section, but it's not terribly clear. And all the context bind/unbind stuff is still a mystery to me. I think the intent is to let me have a buffer (that I own) of "P" (etc) data and then somehow copy in/out of them, but I havent' quite grocked it.

    I think it's all there, I'm just wanting a really-dumb version to see what's what all in one spot.

    (unless it already exists !)

    thanks,

    -doug

    enhancement new feature example code 
    opened by dougepps 22
  • face-varying UV interpolation

    face-varying UV interpolation

    I was about to ask how to use Osd to generate face-varying UV coordinates and just noticed this sentence in the Beta and release information page:

    "Beta does not yet support face-varying UV interpolation. We’re planning on supporting this in release but can do it sooner if needed."

    Would it be possible to get this feature in the beta?

    Thanks Don

    question 
    opened by dboogert 22
  • Crash in MSCV Debug model with corner crease and CREASE_CHAIKIN

    Crash in MSCV Debug model with corner crease and CREASE_CHAIKIN

    Yes - this is very specific - bear with me.

    The crash happen under these conditions:

    • Visual Studio 2013 compiler. Crash happen only in Debug mode - Release work fine.
    • You have a creased vertex at the border of a mesh. Ie, not a solid manifold. Crease a vertex of a single quad.
    • You have CREASE_CHAIKIN creasing mode.
    • The Crease weight is less than or equal to the max refinement level. Crease weight higher than the refinement level works fine.

    image

    The crash occurs when ComputeVertexVertexMask returns. If you step through the code and use StepInto at the end it'll step into the destructor of LocalMask and Crease before it with crash inside the CRT (I think).

    I created a gist with modified far_tutorial0.cpp which reproduce it as simple as I can manage: https://gist.github.com/thomthom/242aa26f8f469a05d5a5

    I built OpenSubdiv using this Cmake config:

    cmake ^
      -G "Visual Studio 12 2013 Win64" ^
      -D NO_REGRESSION=1 ^
      -D NO_MAYA=1 ^
      -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_OPENGL=1 ^
      -D NO_DX=1 ^
      -D NO_CLEW=1 ^
      ..
    

    I don't know if this is an OSD bug or a MSVC Debug CRT bug - but I've reached as far as I can on this. I don't see an obvious cause or fix. But it's making it hard for me to debug my own application when some of my models keep crashing.

    I am using the dev branch which is currently at a state where it just merged the 3.0.4 release - no other commits after that.

    opened by thomthom 18
  • MSVC : 'and'/'not' : undeclared identifier (error C2065)

    MSVC : 'and'/'not' : undeclared identifier (error C2065)

    I am able to build the OpenSubdiv 3.0.3 library (no graphics, just the CPU evaluator stuff) on Windows (VS 2012)

    When I attempt to use it in a project, I get the 'and' and 'not' keyword undefined.

    I tried looking at the CMakeLists.txt files in the github source but could not find any obvious way to tell MSVC to honor the C++ standard keywords.

    Cheers

    opened by nyue 18
  • Patch factory generated invalid patch when SCHEMA equals SCHEME_BILINEAR

    Patch factory generated invalid patch when SCHEMA equals SCHEME_BILINEAR

    I created a very simple test case, just one triangle control face in my mesh. It seems when I set SchemaType = OpenSubdiv::Sdc::SCHEME_BILINEAR, the patch indices returned from PatchMap are all zeros ( 4 zero). The following are the modified far/tutorial_6 to show this bug.

    include <opensubdiv/far/topologyDescriptor.h>

    include <opensubdiv/far/primvarRefiner.h>

    include <opensubdiv/far/patchTableFactory.h>

    include <opensubdiv/far/patchMap.h>

    include <opensubdiv/far/ptexIndices.h>

    include

    include

    include

    include

    using namespace OpenSubdiv;

    // pyramid geometry from catmark_pyramid_crease0.h static int const g_nverts = 3; static float const g_verts[9] = { 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};

    static int const g_vertsperface[1] = { 3};

    static int const g_nfaces = 1; static int const g_faceverts[3] = { 0, 1, 2};

    // Creates a Far::TopologyRefiner from the pyramid shape above static Far::TopologyRefiner * createTopologyRefiner();

    //------------------------------------------------------------------------------ // Vertex container implementation. // struct Vertex {

    // Minimal required interface ----------------------
    Vertex() { }
    
    void Clear( void * =0 ) {
         point[0] = point[1] = point[2] = 0.0f;
    }
    
    void AddWithWeight(Vertex const & src, float weight) {
        point[0] += weight * src.point[0];
        point[1] += weight * src.point[1];
        point[2] += weight * src.point[2];
    }
    
    float point[3];
    

    };

    //------------------------------------------------------------------------------ // Limit frame container implementation -- this interface is not strictly // required but follows a similar pattern to Vertex. // struct LimitFrame {

    void Clear( void * =0 ) {
         point[0] =  point[1] =  point[2] = 0.0f;
        deriv1[0] = deriv1[1] = deriv1[2] = 0.0f;
        deriv2[0] = deriv2[1] = deriv2[2] = 0.0f;
    }
    
    void AddWithWeight(Vertex const & src,
        float weight, float d1Weight, float d2Weight) {
    
        point[0] += weight * src.point[0];
        point[1] += weight * src.point[1];
        point[2] += weight * src.point[2];
    
        deriv1[0] += d1Weight * src.point[0];
        deriv1[1] += d1Weight * src.point[1];
        deriv1[2] += d1Weight * src.point[2];
    
        deriv2[0] += d2Weight * src.point[0];
        deriv2[1] += d2Weight * src.point[1];
        deriv2[2] += d2Weight * src.point[2];
    }
    
    float point[3],
          deriv1[3],
          deriv2[3];
    

    };

    //------------------------------------------------------------------------------ int main(int, char **) {

    // Generate a FarTopologyRefiner (see far_tutorial_0 for details).
    Far::TopologyRefiner * refiner = createTopologyRefiner();
    
    // Adaptively refine the topology with an isolation level capped at 3
    // because the sharpest crease in the shape is 3.0f (in g_creaseweights[])
    int maxIsolation = 1;
    refiner->RefineAdaptive(
        Far::TopologyRefiner::AdaptiveOptions(maxIsolation));
    
    // Generate a set of Far::PatchTable that we will use to evaluate the
    // surface limit
    Far::PatchTableFactory::Options patchOptions;
    patchOptions.endCapType =
        Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS;
    
    Far::PatchTable const * patchTable =
        Far::PatchTableFactory::Create(*refiner, patchOptions);
    
    // Compute the total number of points we need to evaluate patchtable.
    // we use local points around extraordinary features.
    int nRefinerVertices = refiner->GetNumVerticesTotal();
    int nLocalPoints = patchTable->GetNumLocalPoints();
    
    // Create a buffer to hold the position of the refined verts and
    // local points, then copy the coarse positions at the beginning.
    std::vector<Vertex> verts(nRefinerVertices + nLocalPoints);
    memcpy(&verts[0], g_verts, g_nverts*3*sizeof(float));
    
    // Interpolate vertex primvar data : they are the control vertices
    // of the limit patches (see far_tutorial_0 for details)
    Vertex * src = &verts[0];
    for (int level = 1; level <=  refiner->GetMaxLevel(); ++level) {
        Vertex * dst = src + refiner->GetLevel(level-1).GetNumVertices();
        Far::PrimvarRefiner(*refiner).Interpolate(level, src, dst);
        src = dst;
    }
    
    // Evaluate local points from interpolated vertex primvars.
    patchTable->ComputeLocalPointValues(&verts[0], &verts[nRefinerVertices]);
    
    // Create a Far::PatchMap to help locating patches in the table
    Far::PatchMap patchmap(*patchTable);
    
    // Create a Far::PtexIndices to help find indices of ptex faces.
    Far::PtexIndices ptexIndices(*refiner);
    
    // Generate random samples on each ptex face
    int nsamples = 1,
        nfaces = ptexIndices.GetNumFaces();
    
    std::vector<LimitFrame> samples(nsamples * nfaces);
    
    srand( static_cast<int>(2147483647) );
    
    float pWeights[20], dsWeights[20], dtWeights[20];
    
    for (int face=0, count=0; face<nfaces; ++face) {
    
        for (int sample=0; sample<nsamples; ++sample, ++count) {
    
            float s = (float)rand()/(float)RAND_MAX,
                  t = (float)rand()/(float)RAND_MAX;
    
            // Locate the patch corresponding to the face ptex idx and (s,t)
            Far::PatchTable::PatchHandle const * handle =
                patchmap.FindPatch(face, s, t);
            assert(handle);
    
            Far::PatchDescriptor desc = patchTable->GetPatchDescriptor(*handle);
            Far::PatchParam patchParam = patchTable->GetPatchParam(*handle);
            Far::ConstIndexArray indices = patchTable->GetPatchVertices(*handle);   
    
            // Evaluate the patch weights, identify the CVs and compute the limit frame:
            patchTable->EvaluateBasis(*handle, s, t, pWeights, dsWeights, dtWeights);
    
            Far::ConstIndexArray cvs = patchTable->GetPatchVertices(*handle);
    
            LimitFrame & dst = samples[count];
            dst.Clear();
            for (int cv=0; cv < cvs.size(); ++cv) {
                dst.AddWithWeight(verts[cvs[cv]], pWeights[cv], dsWeights[cv], dtWeights[cv]);
            }
    
        }
    }
    
    { // Visualization with Maya : print a MEL script that generates particles
      // at the location of the limit vertices
    
        int nsamples = (int)samples.size();
    
        printf("file -f -new;\n");
    
        // Output particle positions for the tangent
        printf("particle -n deriv1 ");
        for (int sample=0; sample<nsamples; ++sample) {
            float const * pos = samples[sample].point;
            printf("-p %f %f %f\n", pos[0], pos[1], pos[2]);
        }
        printf(";\n");
        // Set per-particle direction using the limit tangent (display as 'Streak')
        printf("setAttr \"deriv1.particleRenderType\" 6;\n");
        printf("setAttr \"deriv1.velocity\" -type \"vectorArray\" %d ",nsamples);
        for (int sample=0; sample<nsamples; ++sample) {
            float const * tan1 = samples[sample].deriv1;
            printf("%f %f %f\n", tan1[0], tan1[1], tan1[2]);
        }
        printf(";\n");
    
        // Output particle positions for the bi-tangent
        printf("particle -n deriv2 ");
        for (int sample=0; sample<nsamples; ++sample) {
            float const * pos = samples[sample].point;
            printf("-p %f %f %f\n", pos[0], pos[1], pos[2]);
        }
        printf(";\n");
        printf("setAttr \"deriv2.particleRenderType\" 6;\n");
        printf("setAttr \"deriv2.velocity\" -type \"vectorArray\" %d ",nsamples);
        for (int sample=0; sample<nsamples; ++sample) {
            float const * tan2 = samples[sample].deriv2;
            printf("%f %f %f\n", tan2[0], tan2[1], tan2[2]);
        }
        printf(";\n");
    
        // Exercise to the reader : cross tangent & bi-tangent for limit
        // surface normal...
    
        // Force Maya DAG update to see the result in the viewport
        printf("currentTime -edit `currentTime -q`;\n");
        printf("select deriv1Shape deriv2Shape;\n");
    }
    

    }

    //------------------------------------------------------------------------------ static Far::TopologyRefiner * createTopologyRefiner() {

    typedef Far::TopologyDescriptor Descriptor;
    

    // Sdc::SchemeType type = OpenSubdiv::Sdc::SCHEME_CATMARK; Sdc::SchemeType type = OpenSubdiv::Sdc::SCHEME_BILINEAR;

    Sdc::Options options;
    options.SetVtxBoundaryInterpolation(Sdc::Options::VTX_BOUNDARY_EDGE_AND_CORNER);
    
    Descriptor desc;
    desc.numVertices = g_nverts;
    desc.numFaces = g_nfaces;
    desc.numVertsPerFace = g_vertsperface;
    desc.vertIndicesPerFace = g_faceverts;
    
    // Instantiate a FarTopologyRefiner from the descriptor.
    Far::TopologyRefiner * refiner =
        Far::TopologyRefinerFactory<Descriptor>::Create(desc,
            Far::TopologyRefinerFactory<Descriptor>::Options(type, options));
    
    return refiner;
    

    }

    opened by shengfuintel 16
  • Usage of Feature Adaptive Subdivision in OpenSubdiv

    Usage of Feature Adaptive Subdivision in OpenSubdiv

    Hi there! I am trying to create a solid/surface by stitching together the limiting bi-cubic b-spline surfaces resulting from the feature adaptive subdivision of the initial control cage. None of the examples supplied with the released versions of OpenSubdiv satisfy my requirements. Below is the snippet of code am using to generate the limiting bicubis bsplines. The input is a simple cube.

    refiner = Far::TopologyRefinerFactory::Create(desc, Far::TopologyRefinerFactory::Options(type, options));

    Far::TopologyRefiner::AdaptiveOptions options(subdivisionLevel); options.useSingleCreasePatch = false;

    refiner->RefineAdaptive(options);

    // Generate a set of Far::PatchTable that we will use to evaluate the // limiting surface Far::PatchTableFactory::Options patchOptions; patchOptions.endCapType = Far::PatchTableFactory::Options::ENDCAP_BSPLINE_BASIS;

    Far::PatchTable const* patchTable = Far::PatchTableFactory::Create(*refiner, patchOptions);

    // Compute the total number of points we need to evaluate patchtable. // we use local points around extraordinary features. int nRefinerVertices = refiner->GetNumVerticesTotal(); int nLocalPoints = patchTable->GetNumLocalPoints();

    // Create a buffer to hold the position of the refined verts and // local points, then copy the coarse positions at the beginning. subdivVertexVec.resize(nRefinerVertices + nLocalPoints); allSUbdivVertices = &subdivVertexVec[0];

    for (int i = 0; i < (int)meshInfo.m_facetVertices.size(); ++i) { allSUbdivVertices[i].SetPosition(meshInfo.m_facetVertices[i][0], meshInfo.m_facetVertices[i][1], meshInfo.m_facetVertices[i][2]); } // Adaptive refinement may result in fewer levels than maxIsolation. int nRefinedLevels = refiner->GetNumLevels();

    Far::PrimvarRefiner primvarRefiner(*refiner);

    SESubdivVertex* sourceVertices = allSUbdivVertices; for (int level = 1; level < nRefinedLevels; ++level) { SESubdivVertex* destinationVertices = NULL; int numLevelVertices = 0;

    		numLevelVertices = refiner->GetLevel(level - 1).GetNumVertices();
    
    		destinationVertices = sourceVertices + numLevelVertices;
    
    		primvarRefiner.Interpolate(level, sourceVertices, destinationVertices);
    
    		sourceVertices = destinationVertices;
    

    }

    // Evaluate local points from interpolated vertex primvars. patchTable->ComputeLocalPointValues(allSUbdivVertices, &allSUbdivVertices[nRefinerVertices]);

    int numPatchArrays = patchTable->GetNumPatchArrays();

    for (int array = 0; array < numPatchArrays; array++) { Far::PatchDescriptor patchDescriptor = patchTable->GetPatchArrayDescriptor(array);

    	if (patchDescriptor == Far::PatchDescriptor::REGULAR)
    	{
    		int numPatches = patchTable->GetNumPatches(array);
    
    		for (int patch = 0; patch < numPatches; patch++)
    		{
    				Far::ConstIndexArray controlVertexIndices;
    				SESubdivVertexVector patchControlVertices;
    
    				controlVertexIndices = patchTable->GetPatchVertices(array, patch);
    
    				for (int cv = 0; cv < controlVertexIndices.size(); cv++)
    				{
    					int index = controlVertexIndices[cv];
    					patchControlVertices.push_back(allSUbdivVertices[index]);
    				}
    
    				patchCVsVector.push_back(patchControlVertices);
    		}
    
    		for (int i = 0; i < (int)patchCVsVector.size(); i++)
    		{
    				DoubleVector patchControlVertexCoords;
    				PK_BSURF_t patchSurf = PK_ENTITY_null;
    				PK_UVBOX_t surfUVBox = { 0 };
    				PK_BODY_t sheetBody = PK_ENTITY_null;
    
    				for (int cv = 0; cv < patchCVsVector[i].size(); cv++)
    				{
    					const double* cvCoords = NULL;
    
    					cvCoords = patchCVsVector[i][cv].GetPosition();
    
    					patchControlVertexCoords.push_back(cvCoords[0]);
    					patchControlVertexCoords.push_back(cvCoords[1]);
    					patchControlVertexCoords.push_back(cvCoords[2]);
    				}
    
    				//Fit b-splines from the control vertices obtained above for each patch.
    			}
    		}
    	}
    

    The patches generated appear strange at one corner. They seem to all have one corner "folded up" as shown in the attached image.

    bicubic_patch

    Can you please verify whether what I am trying to achieve is feasible in OpenSubdiv with adaptive subdivision?

    Thanks, Vadi Mysore

    opened by VadiMysore 15
  • GLFW_LOCATION doesn't seem to work on OSX

    GLFW_LOCATION doesn't seem to work on OSX

    The docs claim -DGLFW_LOCATION should direct CMake to the correct version of GLFW, however I had to use GLFW_INCLUDE_DIR to get it to work.

    I have a system version of glfw in /usr/local/include (2.x) and another version that I was trying to explicitly use stored locally in my OpenSubdiv build directory. CMake would only find the 2.x glfw version until I used GLFW_INCLUDE_DIR.

    bug build platform-specifc 
    opened by jcowles 15
  • OpenGL Compute Evaluator: cache active program

    OpenGL Compute Evaluator: cache active program

    Client applications may keep track of the active shader program so as to not unnecessarily bind and unbind the same shader consecutively as switching shaders is costly.

    The current behavior of the OpenGL compute evaluator is to set the active shader to 0 (zero) after running its program(s) which might interfere with the aforementioned client applications' behavior, leading to bugs.

    Instead of unsetting any previously set shader program, cache the current program before using the evaluator program, and reset the active program to the previous one when done.

    In Blender, this lead to some rendering artifacts. See https://developer.blender.org/D15064 for more details on it.

    opened by diekev 1
  • Updating existing smooth uvs as opposed to call InterpolateFaceVarying operating on whole mesh

    Updating existing smooth uvs as opposed to call InterpolateFaceVarying operating on whole mesh

    I am sorry for bringing up this old issue, I am not sure if this has been fixed. As part of issue #74 now closed, user applezhao asked about the possibility of updating existing smooth UV buffers as opposed of computing uvs for the whole mesh?

    i'm wondering how to update fvardatas~ i mean i use fvardata as (u,v,groupID)~ this may be frequently modified. everytime need i rebuild the hbrmesh? or there's something like GpuVertexBuffer.updateData()?

    The lack of such feature makes it slow to obtain smooth mesh preview during any kind of interactive manipulation of a mesh. Are there any work arounds for such a situation? Are there any plans for this.

    Thank you

    opened by perrauo-adsk 7
  • Add CMake Config

    Add CMake Config

    Description

    This PR adds a CMake Config to OpenSubdiv and expose preprocessor macros for OpenSubdiv enabled features for clients to depend on them. This allow for a more robust and consistent way to pull OpenSubdiv as a dependency in other projects through CMake find_package calls. Moreover, this enhance the experience when using package manager such as microsoft/vcpkg and alikes.

    opened by theblackunknown 13
  • Color indexing in far tutorial_2_2 using wrong limit ?

    Color indexing in far tutorial_2_2 using wrong limit ?

    I believe we should be using ncolors rather than nuvs

    https://github.com/PixarAnimationStudios/OpenSubdiv/blob/release/tutorials/far/tutorial_2_2/far_tutorial_2_2.cpp#L336

    This tutorial example may also benefit from writing out to PLY as it supports point colors.

    If there is agreement, I can take a stab at the above.

    Cheers

    opened by nyue 1
  • SONAME is incorrect

    SONAME is incorrect

    SONAME is set to libosdCPU.so.3.4.4. It is supposed to be libosdCPU.so.3 or libosdCPU.so.3.4 to allow space for minor version updates not requiring rebuild of all dependencies. There should also be a corresponding shared link with the same name as SONAME.

    opened by yurivict 1
StereoKit is an easy-to-use open source mixed reality library for building HoloLens and VR applications with C# and OpenXR!

StereoKit is an easy-to-use open source mixed reality library for building HoloLens and VR applications with C# and OpenXR! Inspired by libraries like XNA and Processing, StereoKit is meant to be fun to use and easy to develop with, yet still quite capable of creating professional and business ready software.

Nick Klingensmith 668 Aug 8, 2022
OpenCorr is an open source C++ library for development of 2D, 3D/stereo, and volumetric digital image correlation

OpenCorr OpenCorr is an open source C++ library for development of 2D, 3D/stereo, and volumetric digital image correlation. It aims to provide a devel

Zhenyu Jiang 53 Jul 30, 2022
Open source Altium Database Library with over 147,000 high quality components and full 3d models.

Open source Altium Database Library with over 147,000 high quality components and full 3d models.

Mark 1.2k Jul 27, 2022
Vizzu is a free, open-source Javascript/C++ library for animated data visualizations and data stories.

Vizzu is a free, open-source Javascript/C++ library utilizing a generic dataviz engine that generates many types of charts and seamlessly animates between them

Vizzu 1.6k Aug 5, 2022
Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform AAA Open 3D Engine

Open 3D Engine (O3DE) is an Apache 2.0-licensed multi-platform 3D engine that enables developers and content creators to build AAA games, cinema-quality 3D worlds, and high-fidelity simulations without any fees or commercial obligations.

O3DE 5.1k Jul 30, 2022
An open-source implementation of Autodesk's FBX

SmallFBX An open-source implementation of Autodesk's FBX that is capable of import & export mesh, blend shape, skin, and animations. Mainly intended t

Seiya Ishibashi 41 Jun 30, 2022
The open-source tool for creating of 3D models

The open-source tool for creating of 3D models

3D geoinformation research group at TU Delft 406 Jul 30, 2022
Cocos2d-x is a suite of open-source, cross-platform, game-development tools used by millions of developers all over the world.

Cocos2d-x is a suite of open-source, cross-platform, game-development tools used by millions of developers all over the world.

cocos2d 16.3k Aug 4, 2022
Tesseract Open Source OCR Engine (main repository)

Tesseract OCR Table of Contents Tesseract OCR About Brief history Installing Tesseract Running Tesseract For developers Support License Dependencies L

null 46.1k Jul 31, 2022
A completely free, open-source, 2D game engine built on proven torque technology.

Torque2D 4.0 Early Access 1 MIT Licensed Open Source version of Torque2D from GarageGames. Maintained by the Torque Game Engines team and contribution

Torque Game Engines 547 Jul 31, 2022
Open-Source Vulkan C++ API

Vulkan-Hpp: C++ Bindings for Vulkan The goal of the Vulkan-Hpp is to provide header only C++ bindings for the Vulkan C API to improve the developers V

The Khronos Group 2.3k Aug 6, 2022
ZBar Bar Code Reader is an open source software suite for reading bar codes from various sources

ZBar Bar Code Reader is an open source software suite for reading bar codes from various sources

null 2.3k Aug 4, 2022
Open-source, cross-platform, C++ game engine for creating 2D/3D games.

GamePlay v3.0.0 GamePlay is an open-source, cross-platform, C++ game framework/engine for creating 2D/3D mobile and desktop games. Website Wiki API De

gameplay3d 3.8k Aug 6, 2022
Dust3D is a cross-platform open-source 3D modeling software

Dust3D is a cross-platform open-source 3D modeling software. Auto UV unwrapping, auto rigging with PBR Material support, pose and motion authoring all in one.

Jeremy HU 2.4k Aug 9, 2022
appleseed is an open source, physically-based global illumination rendering engine primarily designed for animation and visual effects.

appleseed is an open source, physically-based global illumination rendering engine primarily designed for animation and visual effects.

appleseedhq 1.9k Aug 2, 2022
The official Open-Asset-Importer-Library Repository. Loads 40+ 3D-file-formats into one unified and clean data structure.

Open Asset Import Library (assimp) A library to import and export various 3d-model-formats including scene-post-processing to generate missing render

Open Asset Import Library 8.1k Aug 7, 2022
ROS package for visualizing Open Motion Planning Library (OMPL) algorithms in 2D with Rviz.

OMPL 2D Rviz Visualizer Visualizing, animating and debugging Open Motion Planning Library (OMPL) algorithms in ROS Rviz. The package allows OMPL plann

Phone Thiha Kyaw 9 May 24, 2022
Open rTMS (Transcranial Magnetic Stimulation)

openrTMS Open rTMS (Transcranial Magnetic Stimulation) This is a fork based off of the Open rTMS (v_0_2) project last updated in 2014. New Features (2

Samy Kamkar 17 Jul 5, 2022
An integration of Live++ for Open 3D Engine

LivePlusPlus_O3DE_Gem An integration of https://liveplusplus.tech/ for Open 3D Engine (Windows only). See Open 3D Engine at https://github.com/o3de/o3

Olex Lozitskiy 10 Jul 27, 2022