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
Comments
  • 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
  • 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 19
  • 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
  • Correct warning:

    Correct warning: "with mismatched bound [-Warray-parameter]" in level.cpp

    Warning from LLVM Clang 15:

    [build] /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/vtr/level.cpp:1133:64: warning: argument 'points' of type 'OpenSubdiv::v3_4_4::Vtr::Index[12]' (aka 'int[12]') with mismatched bound [-Warray-parameter]
    [build] Level::gatherTriRegularInteriorPatchPoints(Index fIndex, Index points[12], int rotation) const
    [build]                                                                ^
    [build] /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/vtr/../vtr/level.h:371:71: note: previously declared as 'OpenSubdiv::v3_4_4::Vtr::Index[]' (aka 'int[]') here
    [build]     int gatherTriRegularInteriorPatchPoints(      Index fIndex, Index patchVerts[], int rotation = 0) const;
    [build]                                                                       ^
    [build] 1 warning generated.N
    

    This stems from level.h/level.cpp:

    // level.h
        int gatherTriRegularInteriorPatchPoints(      Index fIndex, Index patchVerts[], int rotation = 0) const;
        int gatherTriRegularBoundaryVertexPatchPoints(Index fIndex, Index patchVerts[], int boundaryVertInFace) const;
        int gatherTriRegularBoundaryEdgePatchPoints(  Index fIndex, Index patchVerts[], int boundaryEdgeInFace) const;
        int gatherTriRegularCornerVertexPatchPoints(  Index fIndex, Index patchVerts[], int cornerVertInFace) const;
        int gatherTriRegularCornerEdgePatchPoints(    Index fIndex, Index patchVerts[], int cornerEdgeInFace) const;
    
    /// level.cpp
    int
    Level::gatherTriRegularInteriorPatchPoints(Index fIndex, Index points[12], int rotation) const
    
    int
    Level::gatherTriRegularBoundaryEdgePatchPoints(Index fIndex, Index points[], int boundaryFaceEdge) const
    

    gatherTriRegularInteriorPatchPoints do appear to expect exactly 12 points. But the other functions also appeared to expect a fixed set of items in the arrays.

    I did the minimal fix here and made the definition fit the declaration. But maybe the better fix is to update all definitions and declaration to reflect the fixed size of these array they expect?

    opened by thomthom 0
  • Corrections to allow for LLVM Clang builds on Windows.

    Corrections to allow for LLVM Clang builds on Windows.

    I ran into some issues while getting OSD building on Windows with LLVM Clang.

    My test configuration:

    mkdir build
    cmake ^
      -B build ^
      -S . ^
      -A x64 ^
      -T ClangCL ^
      -D CMAKE_TOOLCHAIN_FILE=C:/Users/Thomas/SourceTree/vcpkg/scripts/buildsystems/vcpkg.cmake ^
      -D CMAKE_CXX_FLAGS="-w" ^
      -D CMAKE_C_FLAGS="-w" ^
      -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_METAL=1 ^
      -D NO_GLFW_X11=1 ^
      -D NO_MACOS_FRAMEWORK=1
    
    cmake --build build
    

    Sample of errors this PR fixes:

    C:\Users\Thomas\SourceTree\OpenSubdiv\opensubdiv\far\catmarkPatchBuilder.cpp(767,43): error : use of undeclared identifier 'M_PI' [C:\Users\Thomas\SourceTree\OpenSubdiv\build\opensubdiv\far\far_obj.vcxproj]
    C:\Users\Thomas\SourceTree\OpenSubdiv\opensubdiv\far\catmarkPatchBuilder.cpp(767,64): error : use of undeclared identifier 'M_PI' [C:\Users\Thomas\SourceTree\OpenSubdiv\build\opensubdiv\far\far_obj.vcxproj]
    C:\Users\Thomas\SourceTree\OpenSubdiv\opensubdiv\far\catmarkPatchBuilder.cpp(145,30): error : use of undeclared identifier 'M_PI' [C:\Users\Thomas\SourceTree\OpenSubdiv\build\opensubdiv\far\far_obj.vcxproj]
    
     osd_static_gpu.vcxproj -> C:\Users\Thomas\SourceTree\OpenSubdiv\build\lib\Debug\osdGPU.lib
      Generating shader.gen.h
      In file included from C:\Users\Thomas\SourceTree\OpenSubdiv\examples\dxViewer\dxviewer.cpp:66:
    C:\Users\Thomas\SourceTree\OpenSubdiv\examples\dxViewer/../common/stopwatch.h(45,9): error : use of undeclared identifier 'gettimeofday' [C:\Users\Thomas\SourceTree\OpenSubdiv\build\examples\dxViewer\dxViewer.vcxproj]
    C:\Users\Thomas\SourceTree\OpenSubdiv\examples\dxViewer/../common/stopwatch.h(52,9): error : use of undeclared identifier 'gettimeofday' [C:\Users\Thomas\SourceTree\OpenSubdiv\build\examples\dxViewer\dxViewer.vcxproj]
      In file included from C:\Users\Thomas\SourceTree\OpenSubdiv\regression\far_perf\far_perf.cpp:39:
    C:\Users\Thomas\SourceTree\OpenSubdiv\regression\far_perf/../../examples/common/stopwatch.h(45,9): error : use of undeclared identifier 'gettimeofday' [C:\Users\Thomas\SourceTree\OpenSubdiv\build\regression\far_perf\far_perf.vcxproj]
    C:\Users\Thomas\SourceTree\OpenSubdiv\regression\far_perf/../../examples/common/stopwatch.h(52,9): error : use of undeclared identifier 'gettimeofday' [C:\Users\Thomas\SourceTree\OpenSubdiv\build\regression\far_perf\far_perf.vcxproj]
      far_regression.vcxproj -> C:\Users\Thomas\SourceTree\OpenSubdiv\build\bin\Debug\far_regression.exe
    
    C:\Users\Thomas\SourceTree\OpenSubdiv\opensubdiv\osd/../osd/types.h(79,21): error : expected unqualified-id [C:\Users\Thomas\SourceTree\OpenSubdiv\build\opensubdiv\osd\osd_gpu_obj.vcxproj]
    C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\minwindef.h(193,29): message : expanded from macro 'max' [C:\Users\Thomas\SourceTree\OpenSubdiv\build\opensubdiv\osd\osd_gpu_obj.vcxproj]
      In file included from C:\Users\Thomas\SourceTree\OpenSubdiv\opensubdiv\osd\glPatchTable.cpp:27:
    

    Note, I muted all warnings using -w because there was a lot of them. What is this project's policy/goal towards compiler warnings?

    opened by thomthom 0
  • error: arithmetic on a pointer to an incomplete type 'OpenSubdiv::v3_5_0::Far::PatchTable::PatchArray'

    error: arithmetic on a pointer to an incomplete type 'OpenSubdiv::v3_5_0::Far::PatchTable::PatchArray'

    I have been building OSD for my project on MSVC and Apple Clang for years. Recently I've run into a few issues with Apple Clang that prompted me to try to use LLVM Clang instead.

    I'm running into a strange error:

    [build] FAILED: ThirdParty/OpenSubdiv/opensubdiv/far/CMakeFiles/far_obj.dir/patchTable.cpp.o 
    [build] /usr/local/opt/llvm/bin/clang++ -DOPENSUBDIV_VERSION_STRING=\"3.5.0\" -I/Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -mmacosx-version-min=10.9   -Wall -Wextra -Wno-invalid-offsetof -Wno-strict-aliasing -Wno-overloaded-virtual -fPIC -Wno-error -Wno-deprecated-copy -Wno-format-pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-function -Wno-unused-parameter -std=c++20 -MD -MT ThirdParty/OpenSubdiv/opensubdiv/far/CMakeFiles/far_obj.dir/patchTable.cpp.o -MF ThirdParty/OpenSubdiv/opensubdiv/far/CMakeFiles/far_obj.dir/patchTable.cpp.o.d -o ThirdParty/OpenSubdiv/opensubdiv/far/CMakeFiles/far_obj.dir/patchTable.cpp.o -c /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/patchTable.cpp
    [build] In file included from /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/patchTable.cpp:25:
    [build] In file included from /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/../far/patchTable.h:30:
    [build] In file included from /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/../far/patchDescriptor.h:30:
    [build] In file included from /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/../far/types.h:30:
    [build] In file included from /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/../vtr/types.h:31:
    [build] /usr/local/opt/llvm/bin/../include/c++/v1/vector:540:52: error: arithmetic on a pointer to an incomplete type 'OpenSubdiv::v3_5_0::Far::PatchTable::PatchArray'
    [build]         {return static_cast<size_type>(__end_cap() - this->__begin_);}
    [build]                                        ~~~~~~~~~~~ ^
    [build] /usr/local/opt/llvm/bin/../include/c++/v1/vector:760:56: note: in instantiation of member function 'std::vector<OpenSubdiv::v3_5_0::Far::PatchTable::PatchArray>::capacity' requested here
    [build]       __annotate_contiguous_container(data(), data() + capacity(),
    [build]                                                        ^
    [build] /usr/local/opt/llvm/bin/../include/c++/v1/vector:431:7: note: in instantiation of member function 'std::vector<OpenSubdiv::v3_5_0::Far::PatchTable::PatchArray>::__annotate_delete' requested here
    [build]       __annotate_delete();
    [build]       ^
    [build] /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/patchTable.cpp:37:13: note: in instantiation of member function 'std::vector<OpenSubdiv::v3_5_0::Far::PatchTable::PatchArray>::~vector' requested here
    [build] PatchTable::PatchTable(int maxvalence) :
    [build]             ^
    [build] /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/../far/patchTable.h:549:12: note: forward declaration of 'OpenSubdiv::v3_5_0::Far::PatchTable::PatchArray'
    [build]     struct PatchArray;
    [build]            ^
    [build] In file included from /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/patchTable.cpp:25:
    
    (...)
    
    build] /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/far/../far/patchTable.h:577:12: note: forward declaration of 'OpenSubdiv::v3_5_0::Far::PatchTable::FVarPatchChannel'
    [build]     struct FVarPatchChannel;
    [build]            ^
    [build] fatal error: too many errors emitted, stopping now [-ferror-limit=]
    [build] 20 errors generated.
    

    I don't have a minimal repo yet. I build OSD with CPU support only, so I don't have all the libs setup to build everything. In testing with Examples and OpenGL on I was not able to reproduce.

    I'm wondering if anyone has encountered something similar before and could provide some pointers on why this fails with this particular compiler, but works in others. Or some suggestions to what I might try to narrow this down?

    opened by thomthom 7
  • Mismatched declaration and definition of array type

    Mismatched declaration and definition of array type

    I was testing Clang LLVM 15.0.5 on macOS. Caught this warning:

    [build] /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/vtr/level.cpp:1133:64: warning: argument 'points' of type 'OpenSubdiv::v3_5_0::Vtr::Index[12]' (aka 'int[12]') with mismatched bound [-Warray-parameter]
    [build] Level::gatherTriRegularInteriorPatchPoints(Index fIndex, Index points[12], int rotation) const
    [build]                                                                ^
    [build] /Users/thomas/SourceTree/subd/ThirdParty/OpenSubdiv/opensubdiv/vtr/../vtr/level.h:371:71: note: previously declared as 'OpenSubdiv::v3_5_0::Vtr::Index[]' (aka 'int[]') here
    [build]     int gatherTriRegularInteriorPatchPoints(      Index fIndex, Index patchVerts[], int rotation = 0) const;
    [build]                                                                       ^
    [build] 1 warning generated.
    

    It's declared as:

    int gatherTriRegularInteriorPatchPoints(      Index fIndex, Index patchVerts[], int rotation = 0) const;
    

    But defined as:

    int
    Level::gatherTriRegularInteriorPatchPoints(Index fIndex, Index points[12], int rotation) const
    

    Implementation suggests that the array is indeed expected to have exactly 12 items.

    opened by thomthom 1
  • OSD_REAL_CAST use with with implicit 1.0 compile error on Intel Mac mini (embedded Intel GPU)

    OSD_REAL_CAST use with with implicit 1.0 compile error on Intel Mac mini (embedded Intel GPU)

    when compiling OSD kernel for Intel GPU on Intel Mac mini getting compiler errors

    OpenCL Error: [CL_DEVICE_NOT_AVAILABLE] : OpenCL Error : Error: Build Program driver returned (10015) OpenCL Error: OpenCL Warning : clBuildProgram failed: could not build program for 0x1024500 (Intel(R) UHD Graphics 630) (err:-2) OpenCL Error: [CL_BUILD_ERROR] : OpenCL Build Error : Compiler build log: <program source>:912:18: error: call to 'convert_float' is ambiguous S *= OSD_REAL_CAST(1.0 / 12.0); ^~~~~~~~~~~~~ <program source>:97:27: note: expanded from macro 'OSD_REAL_CAST' #define OSD_REAL_CAST convert_float ^~~~~~~~~~~~~ /System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/A/lib/clang/3.5/include/cl_kernel.h:4251:16: note: candidate function __CLFN_CONVERT(convert_float, float); ^ /System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/A/lib/clang/3.5/include/cl_kernel.h:3988:56: note: expanded from macro '__CLFN_CONVERT' #define __CLFN_CONVERT(name, rtype) rtype __OVERLOAD__ name( uchar a); \ ^

    there are cases where implicit float:double conversions doesn't seem to be supported #elif defined(OSD_PATCH_BASIS_OPENCL)

    #define OSD_FUNCTION_STORAGE_CLASS static
    #define OSD_DATA_STORAGE_CLASS
    #define OSD_REAL float
    #define OSD_REAL_CAST convert_float`
    

    OpenSubdiv/opensubdiv/osd/patchBasisCommon.h there is 1 place using suffix "f" const OSD_REAL one6th = OSD_REAL_CAST(1.0f / 6.0f); other places don't

    looks suspicious if (totalOrder == 0) { S *= OSD_REAL_CAST(1.0 / 12.0); } else if (totalOrder == 1) { S *= OSD_REAL_CAST(1.0 / 6.0); } else { S *= OSD_REAL_CAST(1.0 / 2.0);

    git diff . diff --git a/opensubdiv/osd/patchBasisCommon.h b/opensubdiv/osd/patchBasisCommon.h index e65f742d..64ca4939 100644 --- a/opensubdiv/osd/patchBasisCommon.h +++ b/opensubdiv/osd/patchBasisCommon.h @@ -542,7 +542,7 @@ Osd_EvalBasisLinearTri(OSD_REAL s, OSD_REAL t,

         int totalOrder = ds + dt;
         if (totalOrder == 0) {
    
    •        S *= OSD_REAL_CAST(1.0 / 12.0);
      
    •        S *= OSD_REAL_CAST(1.0f / 12.0f);
      
             w[0]  = S * (1 - 2*M[1] - 4*M[2]          + 6*M[4] + 6*M[5] + 2*M[6]          - 6*M[8] - 4*M[9] -   M[10] - 2*M[11] + 2*M[13] +   M[14]);
             w[1]  = S * (1 + 2*M[1] - 2*M[2]          - 6*M[4]          - 4*M[6]          + 6*M[8] + 2*M[9] + 2*M[10] + 4*M[11] - 2*M[13] -   M[14]);
      

    @@ -557,7 +557,7 @@ Osd_EvalBasisLinearTri(OSD_REAL s, OSD_REAL t, w[10] = S * ( 2M[9] - 2M[13] - M[14]); w[11] = S * ( 2*M[13] + M[14]); } else if (totalOrder == 1) {

    •        S *= OSD_REAL_CAST(1.0 / 6.0);
      
    •        S *= OSD_REAL_CAST(1.0f / 6.0f);
      
             if (ds != 0) {
                 w[0]  = S * (-1          + 3*M[2] + 3*M[3]          - 3*M[5] - 2*M[6] - 3*M[7] +   M[9]);
      

    @@ -614,7 +614,7 @@ Osd_EvalBasisLinearTri(OSD_REAL s, OSD_REAL t, w[10] = S * ( M[2] - M[4] - M[5]); w[11] = S * ( M[4] + M[5]); } else {

    •            S *= OSD_REAL_CAST(1.0 / 2.0);
      
    •            S *= OSD_REAL_CAST(1.0f / 2.0f);
      
                 w[0]  = S * ( 1          - 2*M[2] -   M[3] +   M[5]);
                 w[1]  = S * (-1          + 2*M[2] + 2*M[3] -   M[5]);
      

    appears to fix the compiler error.
    there are then warnings that appear

    opened by wayne-arnold-adsk 1
Owner
Pixar Animation Studios
Pixar Animation Studios
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 730 Jan 4, 2023
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 66 Jan 6, 2023
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.4k Dec 29, 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 Jan 3, 2023
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.8k Jan 7, 2023
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 43 Dec 21, 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 428 Dec 21, 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.7k Dec 26, 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 48.2k Jan 2, 2023
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 692 Jan 9, 2023
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.5k Jan 8, 2023
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.4k Dec 26, 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.9k Jan 2, 2023
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.5k Dec 30, 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 2k Jan 8, 2023
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.6k Jan 4, 2023
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 11 Oct 10, 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 22 Jan 8, 2023
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 Oct 15, 2022