How pixaranimationstudios/opensubdiv works
Main Components
• Core Library Modules:
– There are several core modules spread across the “opensubdiv” directory, each implementing different aspects of subdivision surface processing. Key modules include:
• HBR (Hierarchical Basis Representation): Deals with the hierarchical mesh and editable topology.
• FAR (Feature Adaptive Refinement): Contains algorithms for patch table construction and adaptive refinement.
• OSD (OpenSubdiv): Implements high-performance evaluation kernels for different processing backends.
• SDC (Subdivision Scheme Computations): Provides subdivision scheme definitions and related algorithms.
• BFR (Barycentric Face Representations) and VTR (Vertex-based Refinement): Also play roles in generating limit surfaces and managing intermediate representations.
• Backend Implementations:
• Build and Configuration Infrastructure:
– CMakeLists.txt and the “cmake” directory (including Find* modules) set up the configuration, dependency resolution, and cross-platform build logic.
• Examples, Tutorials, and Regression Tests:
– The “examples”, “tutorials”, and “regression” directories show how the library is integrated into practical applications (e.g., glViewer, dxViewer, mtlViewer) and are valuable for understanding usage patterns.
• Documentation:
– The “documentation” directory and associated scripts provide additional architectural insights and usage guidelines.
Representing Relationships and Interactions
• Layered Architecture:
– At the base, represent the core build/configuration layer (with CMake and build scripts) that sets up the build environment and the proper detection of external libraries.
• Backend Abstraction Layer:
• Client and Example Applications:
• External Dependencies:
– Mark external libraries like GLFW, Ptex, CUDA, TBB, OpenCL, DX11 SDK, and Metal. Connect these to the relevant modules (e.g., note that some examples use GLFW for windowing and input, while backend modules depend on CUDA or Metal for GPU acceleration). Also, indicate dependencies on documentation tools (Doxygen, Graphviz, Docutils) for the documentation generation process.
Highlighting Architectural Patterns and Design Principles
• Modular, Layered Design:
– Emphasize the separation of concerns (build configuration, core processing, backend-specific evaluation, and example/demo applications).
• Extensibility:
– The use of various CMake build options (evidenced by the numerous “-DNO_*” flags) implies an extensible design where components (like PTex support or OpenMP) can be enabled or disabled.
• Abstraction and Backend Decoupling:
– The system design isolates the high-level algorithms from the hardware-specific implementations via abstraction layers (for instance, similar API calls in OSD that route to either CPU or GPU evaluators).