Merge branch 'release/v3_1_0_RC2'

This commit is contained in:
David G Yu 2016-10-13 21:47:04 -07:00
commit 098004c294
42 changed files with 748 additions and 395 deletions

View File

@ -284,6 +284,8 @@ option(NO_DX "Disable DirectX support")
option(NO_TESTS "Disable all tests")
option(NO_GLTESTS "Disable GL tests")
option(OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES "Enable true derivative evaluation for Gregory basis patches" OFF)
set(OSD_GPU FALSE)
# Check for dependencies
@ -516,6 +518,10 @@ else()
endif()
endif()
if( OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES )
add_definitions(-DOPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES)
endif()
# Link examples & regressions dynamically against Osd
if( OSD_GPU )
set( OSD_LINK_TARGET osd_dynamic_cpu osd_dynamic_gpu )

View File

@ -46,7 +46,6 @@ For more details about OpenSubdiv, see [Pixar Graphics Technologies](http://grap
| Lib (URL) | Min Version | Note |
| --------------------------------------------- | ----------- | ------------------- |
| GLFW <br> http://www.glfw.org | 3.0.0 | GL examples |
| Maya SDK <br> http://www.autodesk.com/maya | 2013 | maya plugin example |
| Ptex <br> https://github.com/wdas/ptex | 2.0 | ptex viewers |
| Zlib <br> http://www.zlib.net | | (required for Ptex under windows)|
| Docutils <br> http://docutils.sourceforge.net | | documents |

View File

@ -85,17 +85,16 @@ if (DOCUTILS_FOUND AND PYTHONINTERP_FOUND)
hedits.rst
hbr_overview.rst
intro.rst
intro_30.rst
license.rst
mod_notes.rst
maya_osdpolysmooth.rst
osd_overview.rst
osd_shader_interface.rst
porting.rst
references.rst
release_30.rst
release_31.rst
release_notes.rst
release_notes_2x.rst
roadmap.rst
sdc_overview.rst
subdivision_surfaces.rst
tutorials.rst

View File

@ -109,7 +109,6 @@ The following configuration arguments can be passed to the CMake command line.
-DPTEX_LOCATION=[path to Ptex]
-DGLEW_LOCATION=[path to GLEW]
-DGLFW_LOCATION=[path to GLFW]
-DMAYA_LOCATION=[path to Maya]
-DTBB_LOCATION=[path to Intel's TBB]
-DICC_LOCATION=[path to Intel's C++ Studio XE]
@ -117,7 +116,6 @@ The following configuration arguments can be passed to the CMake command line.
-DNO_EXAMPLES=1 // disable examples build
-DNO_TUTORIALS=1 // disable tutorials build
-DNO_REGRESSION=1 // disable regression tests build
-DNO_MAYA=1 // disable Maya plugin build
-DNO_PTEX=1 // disable PTex support
-DNO_DOC=1 // disable documentation build
-DNO_OMP=1 // disable OpenMP
@ -130,12 +128,12 @@ The following configuration arguments can be passed to the CMake command line.
Environment Variables
_____________________
The paths to Maya, Ptex, GLFW, GLEW and other dependencies can also be specified
The paths to Ptex, GLFW, GLEW and other dependencies can also be specified
through the following environment variables:
.. code:: c++
MAYA_LOCATION, PTEX_LOCATION, GLFW_LOCATION, GLEW_LOCATION
PTEX_LOCATION, GLFW_LOCATION, GLEW_LOCATION
Automated Script
________________
@ -170,7 +168,6 @@ build that can be run in GitShell :
-D "OPENCL_INCLUDE_DIRS:string=c:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2/OpenCL/common/inc" \
-D "_OPENCL_CPP_INCLUDE_DIRS:string=c:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2/OpenCL/common/inc" \
-D "OPENCL_LIBRARIES:string=c:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2/OpenCL/common/lib/x64/OpenCL.lib" \
-D "MAYA_LOCATION:string=c:/Program Files/Autodesk/Maya2013.5" \
-D "PTEX_LOCATION:string=c:/Users/opensubdiv/demo/src/ptex/x64" \
..

View File

@ -52,13 +52,6 @@ of the software.
* - | `dxViewer <dxviewer.html>`_
- | `dxPtexViewer <dxptexviewer.html>`_
.. list-table:: **Plugin examples**
:class: quickref
:widths: 50
* - | `Maya osdPolySmooth <maya_osdpolysmooth.html>`_
----
Common Keyboard Controls

View File

@ -10,5 +10,4 @@ Other `examples <code_examples.html>`__ \ :
`glFVarViewer <glfvarviewer.html>`__, \
`dxViewer <dxviewer.html>`__, \
`dxPtexViewer <dxptexviewer.html>`__, \
`mayaPolySmooth <maya_osdpolysmooth.html>`__, \

View File

@ -1,104 +0,0 @@
..
Copyright 2013 Pixar
Licensed under the Apache License, Version 2.0 (the "Apache License")
with the following modification; you may not use this file except in
compliance with the Apache License and the following modification to it:
Section 6. Trademarks. is deleted and replaced with:
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor
and its affiliates, except as required to comply with Section 4(c) of
the License and to reproduce the content of the NOTICE file.
You may obtain a copy of the Apache License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the Apache License with the above modification is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the Apache License for the specific
language governing permissions and limitations under the Apache License.
Maya osdPolySmooth
------------------
.. contents::
:local:
:backlinks: none
DESCRIPTION
===========
The Maya OsdPolySmooth node takes a base mesh and generates an OpenSubdiv subdivided mesh.
.. image:: images/osdpolysmooth.png
:width: 400px
:align: center
:target: images/osdpolysmooth.png
.. container:: notebox
**Note:**
This plugin is not representative of actual workflows in the application. The
intended use is for quick comparisons with Renderman's interpolation settings.
Usage
=====
Once the plugin is loaded in Maya:
- Select a poly mesh
- Polygons -> Edit Mesh -> OSD Subdivide Meshes
Attributes (9)
==============
inputPolymesh, output, recommendedIsolation, subdivisionLevels, vertBoundaryMethod,
fvarBoundaryMethod, fvarPropagateCorners, smoothTriangles, creaseMethod,
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| Long Name (Short Name) | Type | Default | Flags |
+=========================================================================================+======+==========+====================================+
| inputPolymesh (ip) | mesh | | input hidden connectable storable |
| This is a description for this attribute | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| output (out) | mesh | | hidden connectable storable output |
| This is a description for this attribute | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| subdivisionLevels (sl) | int | 2 | input connectable storable |
| The number of recursive quad subdivisions to perform on each face. | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| recommendedIsolation (ri) | int | | output connectable storable |
| The recommended levels of subdivision required to account for crease sharpness | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| vertBoundaryMethod (vbm) | enum | EdgeOnly | input connectable storable |
| Controls how boundary edges and vertices are interpolated. | | | |
| - Smooth, Edges: *InterpolateBoundaryEdgeOnly* | | | |
| - Smooth, Edges and Corners: *InterpolateBoundaryEdgeAndCorner* | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| fvarBoundaryMethod (fvbm) | enum | None | input connectable storable |
| Controls how boundaries are treated for face-varying data (UVs and Vertex Colors). | | | |
| - Bi-linear (None): *InterpolateBoundaryNone* | | | |
| - Smooth (Edge Only): *InterpolateBoundaryEdgeOnly* | | | |
| - Smooth (Edges and Corners: *InterpolateBoundaryEdgeAndCorner* | | | |
| - Smooth (ZBrush and Maya "Smooth Internal Only"): *InterpolateBoundaryAlwaysSharp* | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| fvarPropagateCorners (fvpc) | bool | false | input connectable storable |
| Check all faces to see if two edges side by side are facevarying boundary edges | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| smoothTriangles (stri) | bool | true | input connectable storable |
| Apply a special subdivision rule be applied to all triangular faces that was | | | |
| empirically determined to make triangles subdivide more smoothly. | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
| creaseMethod (crm) | enum | 0 | input connectable storable |
| Controls how boundary edges and vertices are interpolated. | | | |
| - Normal: No Crease sharpness smoothing | | | |
| - Chaikin: Improves the appearance of multiedge creases with varying weight | | | |
+-----------------------------------------------------------------------------------------+------+----------+------------------------------------+
.. include:: examples_see_also.rst

View File

@ -39,17 +39,9 @@
<li><a href="contributing.html">Contributing</a></li>
<li><a href="cmake_build.html">Building OpenSubdiv</a></li>
<li><a href="code_examples.html">Code Examples</a></li>
<li><a href="roadmap.html">Roadmap</a></li>
<li><a href="references.html">References</a></li>
</ul>
<p></p>
<li><a href="intro_30.html">Release 3.0</a></li>
<ul>
<li><a href="intro_30.html">Overview</a></li>
<li><a href="porting.html">Porting Guide: 2.0 to 3.0</a></li>
<li><a href="compatibility.html">Subdivision Compatibility</a></li>
</ul>
<p></p>
<li><a href="subdivision_surfaces.html">Subdivision Surfaces</a>
<ul>
<li><a href="subdivision_surfaces.html#introduction">Introduction</a></li>
@ -102,7 +94,17 @@
<li><a href="additional_resources.html#videos">Videos</a>
</ul>
<p></p>
<li><a href="release_notes.html">Release Notes</a></li>
<li><a href="release_notes.html">Releases</a>
<ul>
<li><a href="release_31.html">Release 3.1</a></li>
<li><a href="release_30.html">Release 3.0</a></li>
<ul>
<li><a href="intro_30.html">Overview</a></li>
<li><a href="porting.html">Porting Guide: 2.0 to 3.0</a></li>
<li><a href="compatibility.html">Subdivision Compatibility</a></li>
</ul>
<li><a href="release_notes.html">Release Notes</a></li>
</ul>
<p></p>
<li><a href="doxy_html/index.html" target="_blank">Doxygen</a></li>
</ul>

View File

@ -0,0 +1,51 @@
..
Copyright 2013 Pixar
Licensed under the Apache License, Version 2.0 (the "Apache License")
with the following modification; you may not use this file except in
compliance with the Apache License and the following modification to it:
Section 6. Trademarks. is deleted and replaced with:
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor
and its affiliates, except as required to comply with Section 4(c) of
the License and to reproduce the content of the NOTICE file.
You may obtain a copy of the Apache License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the Apache License with the above modification is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the Apache License for the specific
language governing permissions and limitations under the Apache License.
Overview of Release 3.1
-----------------------
.. contents::
:local:
:backlinks: none
----
Release 3.1
===========
Face-Varying Patches
********************
Varying and Face-Varying Evaluation
***********************************
2nd Order Derivative Evaluation
*******************************
Separate Levels of Feature Isolation
************************************
Sharp Patches for Infinitely Sharp Features
*******************************************

View File

@ -22,8 +22,8 @@
language governing permissions and limitations under the Apache License.
3.0 Release Notes
-----------------
3.0 - 3.1 Release Notes
-----------------------
.. contents::
:local:
@ -77,6 +77,22 @@ Release 3.1.0 is a significant release with several new features, important bug
- Fixed compatibility issues with VS2015
- Fixed some bugs with HUD sliders in the example viewers
Release 3.1.0 RC2
=================
**Changes**
- Added and updated test shapes and updated example viewers
**Bug Fixes**
- Fixed the names of some methods added to Far::PatchTable
- Fixed issues discovered during testing
Release 3.1.0 RC1
=================
**Changes**
- First Release Candidate
Release 3.0.5
=============
@ -203,7 +219,7 @@ Release 3.0.0 RC2
- Fixed glViewer/farViewer stability bugs
Release 3.0.0 RC1
Release 3.0.0 RC1
=================
**Changes**

View File

@ -1,156 +0,0 @@
..
Copyright 2013 Pixar
Licensed under the Apache License, Version 2.0 (the "Apache License")
with the following modification; you may not use this file except in
compliance with the Apache License and the following modification to it:
Section 6. Trademarks. is deleted and replaced with:
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor
and its affiliates, except as required to comply with Section 4(c) of
the License and to reproduce the content of the NOTICE file.
You may obtain a copy of the Apache License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the Apache License with the above modification is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the Apache License for the specific
language governing permissions and limitations under the Apache License.
Roadmap
-------
.. contents::
:local:
:backlinks: none
----
3.x Release Cycle
=================
For more details, please see the `Release Notes <release_notes.html>`_.
3.0 Master Release (Q2 2015)
* freeze subdivision 'specification' (enforce backward compatibility)
3.1 Supplemental Release (Q3/Q4 2015)
* include any noteworthy omissions arising from 3.0
* add support for bi-cubic face-varying limit patches
* add support for higher order differentiation of limit patches
3.2 Future Release (2016)
* TBD
Near Term
=========
The following is a short list of topics already expressed as priorities and
receiving ongoing attention -- some being actively prototyped to varying
degrees.
Feature parity for Loop subdivision
+++++++++++++++++++++++++++++++++++
The more popular Catmark scheme has long received more attention and effort
than the Loop scheme. Given OpenSubdiv claims to support both, additional
effort is required to bring Loop to the same level of functionality as
Catmark. With the feature-adaptive analysis now scheme-independent, the
addition of triangular patches to the PatchTables will go a long way towards
that goal. Prototype patch gathering and evaluation methods have already
been tested within the existing code base and discussions on extending the
internal patch infra-structure are underway.
Improved support for infinitely sharp features
++++++++++++++++++++++++++++++++++++++++++++++
The current implementation of adaptive feature isolation requires infinitely
sharp creases to be pushed to the highest level of isolation -- eventually
representing the result with a regular patch. The surface is therefore both
inefficient and incorrect. Patches with a single infinitely sharp edge can be
represented exactly with regular boundary patches and could be isolated at a
much higher level. Continuity with dart patches is necessary in such cases,
and approximating more sharp irregular regions with alternate patch types
(e.g. Gregory or Bezier) will help this goal and others.
Dynamic feature adaptive isolation (DFAS)
+++++++++++++++++++++++++++++++++++++++++
Adaptive feature isolation can produce a large number of patches, especially
when the model contains a lot of semi-sharp creases. We need a LOD solution
that can dynamically isolate features based on distance to view-point. (Note:
paper from Matthias Niessner & Henry Schafer)
Longer Term
===========
The following is a list of pending projects and future directions for
OpenSubdiv.
Implement a "high-level" API layer
++++++++++++++++++++++++++++++++++
One of the original goals of the OpenSubdiv project is to provide a robust
and simple API to display subdivision surfaces interactively. Now that the
algorithms and code-base have matured, we would like to foster a consistent
implementation of subdivision surfaces suitable for adoption in the lower
layers of the graphics stack, such as GPU drivers. We have been working on
the draft of a "specification document" detailing the workings of a high-
level interface for subdivision surface data and functionality. We need an
implementation of this high-level API.
Note: this document drafting has been started at Pixar with partners.
"Next-gen" back-ends
++++++++++++++++++++
Implement Osd Evaluator and Patch Drawing for next-gen GPU APIs such as
Mantle, Metal, DX12, Vulkan.
A means to control edge curvature
+++++++++++++++++++++++++++++++++
Edge sharpness provides insufficient control over the overall contour of the
surfaces. Artists often duplicate edge-loops around semi-sharp edges in
order to control the local surface curvature. Ideally, they would like to be
able to specify a radius of curvature that produces circular rounded edges.
This will likely require the introduction of non-uniform rational splines
(NURCCS ?) in OpenSubdiv.
Always in Need of Improvement
=============================
And finally, a few topics that always benefit from continual improvement.
Any and all contributions in this area are greatly appreciated.
Regression testing
++++++++++++++++++
OpenSubdiv currently ships with some regression testing code which can be
run using CTest. It's always great to have more regression testing that
covers more of the code base.
* Implement a robust regression harness for numerical correctness
* Implement a cross-platform regression harness for GPU drawing correctness
* Implement a cross-platform regression harness for performance (speed & memory)
* Implement code coverage analysis
Documentation
+++++++++++++
In order to facilitate adoption of OpenSubdiv, we need to provide clear,
concise and comprehensive documentation of all APIs. In particular:
* Update and flesh out high-level ReST documentation
* Clean up the Doxygen documentation
* Expand code tutorials

View File

@ -114,7 +114,8 @@ enum HudCheckBox { kHUD_CB_DISPLAY_CONTROL_MESH_EDGES,
kHUD_CB_ANIMATE_VERTICES,
kHUD_CB_ANIMATE_PARTICLES,
kHUD_CB_RANDOM_START,
kHUD_CB_FREEZE };
kHUD_CB_FREEZE,
kHUD_CB_INF_SHARP_PATCH };
enum DrawMode { kUV,
kVARYING,
@ -130,6 +131,7 @@ int g_currentShape = 0,
g_level = 3,
g_kernel = kCPU,
g_endCap = kEndCapBSplineBasis,
g_infSharpPatch = 0,
g_numElements = 3;
int g_running = 1,
@ -545,6 +547,23 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level) {
g_orgPositions=shape->verts;
g_positions.resize(g_orgPositions.size(), 0.0f);
// compute model bounding
float min[3] = { FLT_MAX, FLT_MAX, FLT_MAX};
float max[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX};
for (size_t i=0; i <g_orgPositions.size()/3; ++i) {
for(int j=0; j<3; ++j) {
float v = g_orgPositions[i*3+j];
min[j] = std::min(min[j], v);
max[j] = std::max(max[j], v);
}
}
for (int j=0; j<3; ++j) {
g_center[j] = (min[j] + max[j]) * 0.5f;
g_size += (max[j]-min[j])*(max[j]-min[j]);
}
g_size = sqrtf(g_size);
float speed = g_particles ? g_particles->GetSpeed() : 0.2f;
// save coarse topology (used for coarse mesh drawing)
@ -565,11 +584,14 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level) {
{
bool adaptive = (sdctype == OpenSubdiv::Sdc::SCHEME_CATMARK);
bool doInfSharpPatch = (g_infSharpPatch!=0 && adaptive);
if (adaptive) {
// Apply feature adaptive refinement to the mesh so that we can use the
// limit evaluation API features.
Far::TopologyRefiner::AdaptiveOptions options(level);
options.considerFVarChannels = true;
options.useInfSharpPatch = doInfSharpPatch;
topologyRefiner->RefineAdaptive(options);
} else {
Far::TopologyRefiner::UniformOptions options(level);
@ -600,6 +622,7 @@ createOsdMesh(ShapeDesc const & shapeDesc, int level) {
poptions.SetEndCapType(
Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS);
}
poptions.useInfSharpPatch = doInfSharpPatch;
poptions.generateFVarTables = true;
poptions.generateFVarLegacyLinearPatches = false;
@ -1068,6 +1091,14 @@ setSamples(bool add) {
createOsdMesh(g_defaultShapes[g_currentShape], g_level);
}
//------------------------------------------------------------------------------
static void
fitFrame() {
g_pan[0] = g_pan[1] = 0;
g_dolly = g_size;
}
//------------------------------------------------------------------------------
static void
keyboard(GLFWwindow *, int key, int /* scancode */, int event, int /* mods */) {
@ -1078,6 +1109,8 @@ keyboard(GLFWwindow *, int key, int /* scancode */, int event, int /* mods */) {
switch (key) {
case 'Q': g_running = 0; break;
case 'F': fitFrame(); break;
case '=': setSamples(true); break;
case '-': setSamples(false); break;
@ -1183,6 +1216,10 @@ callbackCheckBox(bool checked, int button) {
case kHUD_CB_FREEZE:
g_freeze = checked;
break;
case kHUD_CB_INF_SHARP_PATCH:
g_infSharpPatch = checked;
createOsdMesh(g_defaultShapes[g_currentShape], g_level);
return;
}
}
@ -1242,7 +1279,10 @@ initHUD() {
}
#endif
int endcap_pulldown = g_hud.AddPullDown("End cap (E)", 10, 140, 200,
g_hud.AddCheckBox("Inf Sharp Patch (I)", g_infSharpPatch!=0,
10, 130, callbackCheckBox, kHUD_CB_INF_SHARP_PATCH, 'i');
int endcap_pulldown = g_hud.AddPullDown("End cap (E)", 10, 150, 200,
callbackEndCap, 'e');
g_hud.AddPullDownButton(endcap_pulldown, "BSpline",
kEndCapBSplineBasis,

View File

@ -213,7 +213,7 @@ struct FVarData
glDeleteBuffers(1, &buffer);
Far::ConstPatchParamArray fvarParam = patchTable->GetFVarPatchParam();
Far::ConstPatchParamArray fvarParam = patchTable->GetFVarPatchParams();
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);

View File

@ -60,6 +60,8 @@ static void initShapes() {
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound0", catmark_fvar_bound0, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound3", catmark_fvar_bound3, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_project0", catmark_fvar_project0, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test3", catmark_gregory_test3, kCatmark ) );

View File

@ -102,7 +102,8 @@ enum HudCheckBox { kHUD_CB_DISPLAY_CONTROL_MESH_EDGES,
kHUD_CB_DISPLAY_CONTROL_MESH_VERTS,
kHUD_CB_ANIMATE_VERTICES,
kHUD_CB_FREEZE,
kHUD_CB_BILINEAR };
kHUD_CB_ADAPTIVE,
kHUD_CB_INF_SHARP_PATCH };
int g_kernel = kCPU,
g_isolationLevel = 5; // max level of extraordinary feature isolation
@ -118,7 +119,8 @@ int g_running = 1,
g_freeze=0,
g_repeatCount;
bool g_bilinear=false;
bool g_adaptive=true,
g_infSharpPatch=false;
float g_rotate[2] = {0, 0},
g_dolly = 5,
@ -310,13 +312,30 @@ createMesh(ShapeDesc const & shapeDesc, int level) {
// save rest pose
g_orgPositions = shape->verts;
if (g_bilinear) {
// compute model bounding
float min[3] = { FLT_MAX, FLT_MAX, FLT_MAX};
float max[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX};
for (size_t i=0; i <g_orgPositions.size()/3; ++i) {
for(int j=0; j<3; ++j) {
float v = g_orgPositions[i*3+j];
min[j] = std::min(min[j], v);
max[j] = std::max(max[j], v);
}
}
for (int j=0; j<3; ++j) {
g_center[j] = (min[j] + max[j]) * 0.5f;
g_size += (max[j]-min[j])*(max[j]-min[j]);
}
g_size = sqrtf(g_size);
if (!g_adaptive) {
Far::TopologyRefiner::UniformOptions options(level);
options.fullTopologyInLastLevel = true;
refiner->RefineUniform(options);
} else {
Far::TopologyRefiner::AdaptiveOptions options(level);
options.useSingleCreasePatch = false;
options.useInfSharpPatch = g_infSharpPatch;
refiner->RefineAdaptive(options);
}
@ -833,6 +852,14 @@ setSamples(bool add) {
rebuildMesh();
}
//------------------------------------------------------------------------------
static void
fitFrame() {
g_pan[0] = g_pan[1] = 0;
g_dolly = g_size;
}
//------------------------------------------------------------------------------
static void
keyboard(GLFWwindow *, int key, int /* scancode */, int event, int /* mods */) {
@ -843,6 +870,8 @@ keyboard(GLFWwindow *, int key, int /* scancode */, int event, int /* mods */) {
switch (key) {
case 'Q': g_running = 0; break;
case 'F': fitFrame(); break;
case '=': setSamples(true); break;
case '-': setSamples(false); break;
@ -916,8 +945,11 @@ callbackCheckBox(bool checked, int button) {
case kHUD_CB_FREEZE:
g_freeze = checked;
break;
case kHUD_CB_BILINEAR:
g_bilinear = checked;
case kHUD_CB_ADAPTIVE:
g_adaptive = checked;
rebuildMesh();
case kHUD_CB_INF_SHARP_PATCH:
g_infSharpPatch = checked;
rebuildMesh();
}
}
@ -947,8 +979,11 @@ initHUD() {
10, 50, callbackCheckBox, kHUD_CB_ANIMATE_VERTICES, 'm');
g_hud.AddCheckBox("Freeze (spc)", g_freeze != 0,
10, 70, callbackCheckBox, kHUD_CB_FREEZE, ' ');
g_hud.AddCheckBox("Bilinear Stencils (`)", g_bilinear != 0,
10, 190, callbackCheckBox, kHUD_CB_BILINEAR, '`');
g_hud.AddCheckBox("Adaptive (`)", g_adaptive != 0,
10, 190, callbackCheckBox, kHUD_CB_ADAPTIVE, '`');
g_hud.AddCheckBox("Inf Sharp Patch (I)", g_infSharpPatch != 0,
10, 210, callbackCheckBox, kHUD_CB_INF_SHARP_PATCH, 'i');
int compute_pulldown = g_hud.AddPullDown("Compute (K)", 250, 10, 300, callbackKernel, 'k');
g_hud.AddPullDownButton(compute_pulldown, "CPU", kCPU);
@ -978,7 +1013,7 @@ initHUD() {
for (int i = 1; i < 11; ++i) {
char level[16];
sprintf(level, "Lv. %d", i);
g_hud.AddRadioButton(3, level, i==g_isolationLevel, 10, 210+i*20, callbackLevel, i, '0'+(i%10));
g_hud.AddRadioButton(3, level, i==g_isolationLevel, 10, 250+i*20, callbackLevel, i, '0'+(i%10));
}
int pulldown_handle = g_hud.AddPullDown("Shape (N)", -300, 10, 300, callbackModel, 'n');

View File

@ -57,6 +57,9 @@ static void initShapes() {
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin0", catmark_chaikin0, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin1", catmark_chaikin1, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_chaikin2", catmark_chaikin2, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_single_crease", catmark_single_crease, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_inf_crease0", catmark_inf_crease0, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_inf_crease1", catmark_inf_crease1, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fan", catmark_fan, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_flap", catmark_flap, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_flap2", catmark_flap2, kCatmark ) );
@ -91,7 +94,6 @@ static void initShapes() {
g_defaultShapes.push_back( ShapeDesc("catmark_tent", catmark_tent, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_torus", catmark_torus, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_torus_creases0", catmark_torus_creases0, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_single_crease", catmark_single_crease, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris0", catmark_smoothtris0, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_smoothtris1", catmark_smoothtris1, kCatmark ) );
// g_defaultShapes.push_back( ShapeDesc("catmark_square_hedit0", catmark_square_hedit0, kCatmark ) );

View File

@ -425,10 +425,9 @@ void GetGregoryWeights(PatchParam const & param,
}
}
//#define _USE_BEZIER_PSEUDO_DERIVATIVES
// dclyde's note: skipping half of the product rule like this does seem to change the result a lot in my tests.
// This is not a runtime bottleneck for cloth sims anyway so I'm just using the accurate version.
#ifdef _USE_BEZIER_PSEUDO_DERIVATIVES
#ifndef OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES
// Approximation to the true Gregory derivatives by differentiating the Bezier patch
// unique to the given (s,t), i.e. having F = (g^+ * f^+) + (g^- * f^-) as its four
// interior points:

View File

@ -501,8 +501,10 @@ PatchTable::getFVarValues(int channel) {
ConstIndexArray
PatchTable::getPatchFVarValues(int patch, int channel) const {
FVarPatchChannel const & c = getFVarPatchChannel(channel);
int ncvs = c.desc.GetNumControlVertices();
return ConstIndexArray(&c.patchValues[patch * ncvs], ncvs);
int ncvsPerPatch = c.desc.GetNumControlVertices();
int ncvsThisPatch = c.patchParam[patch].IsRegular()
? c.desc.GetRegularPatchSize() : ncvsPerPatch;
return ConstIndexArray(&c.patchValues[patch * ncvsPerPatch], ncvsThisPatch);
}
ConstIndexArray
PatchTable::GetPatchFVarValues(PatchHandle const & handle, int channel) const {
@ -536,18 +538,18 @@ PatchTable::GetPatchFVarPatchParam(int arrayIndex, int patchIndex, int channel)
return getPatchFVarPatchParam(getPatchIndex(arrayIndex, patchIndex), channel);
}
ConstPatchParamArray
PatchTable::GetPatchArrayFVarPatchParam(int array, int channel) const {
PatchTable::GetPatchArrayFVarPatchParams(int array, int channel) const {
PatchArray const & pa = getPatchArray(array);
FVarPatchChannel const & c = getFVarPatchChannel(channel);
return ConstPatchParamArray(&c.patchParam[pa.patchIndex], pa.numPatches);
}
ConstPatchParamArray
PatchTable::GetFVarPatchParam(int channel) const {
PatchTable::GetFVarPatchParams(int channel) const {
FVarPatchChannel const & c = getFVarPatchChannel(channel);
return ConstPatchParamArray(&c.patchParam[0], (int)c.patchParam.size());
}
PatchParamArray
PatchTable::getFVarPatchParam(int channel) {
PatchTable::getFVarPatchParams(int channel) {
FVarPatchChannel & c = getFVarPatchChannel(channel);
return PatchParamArray(&c.patchParam[0], (int)c.patchParam.size());
}
@ -610,7 +612,7 @@ PatchTable::EvaluateBasisFaceVarying(
float wDss[], float wDst[], float wDtt[],
int channel) const {
PatchParam param = GetPatchFVarPatchParam(handle.arrayIndex, handle.patchIndex, channel);
PatchParam param = getPatchFVarPatchParam(handle.patchIndex, channel);
PatchDescriptor::Type patchType = param.IsRegular()
? PatchDescriptor::REGULAR
: GetFVarChannelPatchDescriptor(channel).GetType();

View File

@ -208,6 +208,8 @@ public:
/// @param dst Destination buffer for the computed local point
/// face-varying values
///
/// @param channel face-varying channel
///
///
template <class T> void
ComputeLocalPointValuesFaceVarying(T const *src, T *dst, int channel = 0) const;
@ -321,10 +323,10 @@ public:
PatchParam GetPatchFVarPatchParam(int array, int patch, int channel = 0) const;
/// \brief Returns the face-varying for a given patch in \p array in \p channel
ConstPatchParamArray GetPatchArrayFVarPatchParam(int array, int channel = 0) const;
ConstPatchParamArray GetPatchArrayFVarPatchParams(int array, int channel = 0) const;
/// \brief Returns an array of face-varying patch param for \p channel
ConstPatchParamArray GetFVarPatchParam(int channel = 0) const;
ConstPatchParamArray GetFVarPatchParams(int channel = 0) const;
//@}
@ -513,7 +515,7 @@ private:
IndexArray getFVarValues(int channel);
ConstIndexArray getPatchFVarValues(int patch, int channel) const;
PatchParamArray getFVarPatchParam(int channel);
PatchParamArray getFVarPatchParams(int channel);
PatchParam getPatchFVarPatchParam(int patch, int channel) const;
private:

View File

@ -249,7 +249,8 @@ public:
// Methods to query patch properties for classification and construction.
bool IsPatchEligible(int levelIndex, Index faceIndex) const;
bool IsPatchSmoothCorner(int levelIndex, Index faceIndex) const;
bool IsPatchSmoothCorner(int levelIndex, Index faceIndex,
int fvcFactory = -1) const;
bool IsPatchRegular(int levelIndex, Index faceIndex,
int fvcFactory = -1) const;
@ -503,28 +504,36 @@ PatchTableFactory::BuilderContext::IsPatchEligible(
bool
PatchTableFactory::BuilderContext::IsPatchSmoothCorner(
int levelIndex, Index faceIndex) const
int levelIndex, Index faceIndex, int fvcFactory) const
{
Level const & level = refiner.getLevel(levelIndex);
// Ignore the face-varying channel if the topology for the face is not distinct
int fvcRefiner = GetDistinctRefinerFVarChannel(levelIndex, faceIndex, fvcFactory);
Vtr::ConstIndexArray fVerts = level.getFaceVertices(faceIndex);
if (fVerts.size() != 4) return false;
Level::VTag vTags[4];
vTags[0] = level.getVertexTag(fVerts[0]);
vTags[1] = level.getVertexTag(fVerts[1]);
vTags[2] = level.getVertexTag(fVerts[2]);
vTags[3] = level.getVertexTag(fVerts[3]);
level.getFaceVTags(faceIndex, vTags, fvcRefiner);
//
// Test the subdivision rules for the corners, rather than just the boundary/interior
// tags, to ensure that inf-sharp vertices or edges are properly accounted for (and
// the cases appropriately excluded) if inf-sharp patches are enabled:
//
int boundaryCount = (vTags[0]._boundary && (vTags[0]._rule == Sdc::Crease::RULE_CREASE))
int boundaryCount = 0;
if (options.useInfSharpPatch) {
boundaryCount = (vTags[0]._infSharpEdges && (vTags[0]._rule == Sdc::Crease::RULE_CREASE))
+ (vTags[1]._infSharpEdges && (vTags[1]._rule == Sdc::Crease::RULE_CREASE))
+ (vTags[2]._infSharpEdges && (vTags[2]._rule == Sdc::Crease::RULE_CREASE))
+ (vTags[3]._infSharpEdges && (vTags[3]._rule == Sdc::Crease::RULE_CREASE));
} else {
boundaryCount = (vTags[0]._boundary && (vTags[0]._rule == Sdc::Crease::RULE_CREASE))
+ (vTags[1]._boundary && (vTags[1]._rule == Sdc::Crease::RULE_CREASE))
+ (vTags[2]._boundary && (vTags[2]._rule == Sdc::Crease::RULE_CREASE))
+ (vTags[3]._boundary && (vTags[3]._rule == Sdc::Crease::RULE_CREASE));
}
int xordinaryCount = vTags[0]._xordinary
+ vTags[1]._xordinary
+ vTags[2]._xordinary
@ -562,8 +571,6 @@ PatchTableFactory::BuilderContext::IsPatchRegular(
//
bool isRegular = ! fCompVTag._xordinary || fCompVTag._nonManifold;
// Reconsider when using inf-sharp patches in presence of inf-sharp features:
if (options.useInfSharpPatch && (fCompVTag._infSharp || fCompVTag._infSharpEdges)) {
if (fCompVTag._nonManifold || !fCompVTag._infIrregular) {
@ -615,12 +622,10 @@ PatchTableFactory::BuilderContext::IsPatchRegular(
}
}
// Legacy option -- reinterpret a smooth corner as sharp if specified:
if (options_approxSmoothCornerWithSharp) {
// Legacy option -- reinterpret an irregular smooth corner as sharp if specified:
if (!isRegular && options_approxSmoothCornerWithSharp) {
if (fCompVTag._xordinary && fCompVTag._boundary && !fCompVTag._nonManifold) {
if (fvcRefiner < 0) {
isRegular = IsPatchSmoothCorner(levelIndex, faceIndex);
}
isRegular = IsPatchSmoothCorner(levelIndex, faceIndex, fvcRefiner);
}
}
return isRegular;
@ -734,9 +739,20 @@ PatchTableFactory::BuilderContext::GetIrregularPatchCornerSpans(
level, faceIndex, i, singularEdgeMask, cornerSpans[i], fvcRefiner);
}
}
if (options.useInfSharpPatch) {
if (vTags[i]._corner) {
cornerSpans[i]._sharp = true;
} else if (options.useInfSharpPatch) {
cornerSpans[i]._sharp = vTags[i]._infIrregular && (vTags[i]._rule == Sdc::Crease::RULE_CORNER);
}
// Legacy option -- reinterpret an irregular smooth corner as sharp if specified:
if (!cornerSpans[i]._sharp && options_approxSmoothCornerWithSharp) {
if (vTags[i]._xordinary && vTags[i]._boundary && !vTags[i]._nonManifold) {
int nFaces = cornerSpans[i].isAssigned() ? cornerSpans[i]._numFaces
: level.getVertexFaces(fVerts[i]).size();
cornerSpans[i]._sharp = (nFaces == 1);
}
}
}
}
@ -1262,7 +1278,7 @@ PatchTableFactory::populateAdaptivePatches(
int ofs = pidx * desc.GetNumControlVertices();
arrayBuilder.fptr[fvc] = &table->getFVarValues(fvc)[ofs];
arrayBuilder.fpptr[fvc] = &table->getFVarPatchParam(fvc)[pidx];
arrayBuilder.fpptr[fvc] = &table->getFVarPatchParams(fvc)[pidx];
}
}
}
@ -1386,12 +1402,7 @@ PatchTableFactory::populateAdaptivePatches(
// Build the irregular patch array
arrayBuilder = &arrayBuilders[IR];
// Leaving the corner span "size" to zero, as constructed, indicates to use the full
// neighborhood -- we only need to identify a subset when using inf-sharp patches
if (context.options.useInfSharpPatch) {
context.GetIrregularPatchCornerSpans(
patch.levelIndex, patch.faceIndex, irregCornerSpans);
}
context.GetIrregularPatchCornerSpans(patch.levelIndex, patch.faceIndex, irregCornerSpans);
// switch endcap patchtype by option
switch(context.options.GetEndCapType()) {

View File

@ -713,7 +713,7 @@ PrimvarRefiner::interpFVarFromEdges(int level, T const & src, U & dst, int chann
Mask eMask(eVertWeights, 0, eFaceWeights);
bool isLinearFVar = parentFVar.isLinear();
bool isLinearFVar = parentFVar.isLinear() || (_refiner._subdivType == Sdc::SCHEME_BILINEAR);
if (isLinearFVar) {
eMask.SetNumVertexWeights(2);
eMask.SetNumEdgeWeights(0);
@ -848,7 +848,7 @@ PrimvarRefiner::interpFVarFromVerts(int level, T const & src, U & dst, int chann
Vtr::internal::FVarLevel const & parentFVar = parentLevel.getFVarLevel(channel);
Vtr::internal::FVarLevel const & childFVar = childLevel.getFVarLevel(channel);
bool isLinearFVar = parentFVar.isLinear();
bool isLinearFVar = parentFVar.isLinear() || (_refiner._subdivType == Sdc::SCHEME_BILINEAR);
Vtr::internal::StackBuffer<float,32> weightBuffer(2*parentLevel.getMaxValence());
@ -964,7 +964,7 @@ PrimvarRefiner::interpFVarFromVerts(int level, T const & src, U & dst, int chann
Vtr::Index cVertValue = cVertValues[cSibling];
dst[cVertValue].Clear();
if (cValueTags[cSibling].isCorner()) {
if (isLinearFVar || cValueTags[cSibling].isCorner()) {
dst[cVertValue].AddWithWeight(src[pVertValue], 1.0f);
} else {
//

View File

@ -181,7 +181,7 @@ public:
/// @param values Destination buffer for the interpolated primvar
/// data
///
/// @param start (skip to )index of first value to update
/// @param start index of first value to update
///
/// @param end Index of last value to update
///
@ -390,16 +390,7 @@ public:
/// @param vderivs Destination buffer for the interpolated 'v'
/// derivative primvar data
///
/// @param uuderivs Destination buffer for the interpolated 'uu'
/// derivative primvar data
///
/// @param uvderivs Destination buffer for the interpolated 'uv'
/// derivative primvar data
///
/// @param vvderivs Destination buffer for the interpolated 'vv'
/// derivative primvar data
///
/// @param start (skip to )index of first value to update
/// @param start index of first value to update
///
/// @param end Index of last value to update
///
@ -411,6 +402,26 @@ public:
update(controlValues, vderivs, _dvWeights, start, end);
}
/// \brief Updates 2nd derivative values based on the control values
///
/// \note The destination buffers ('uuderivs', 'uvderivs', & 'vderivs') are
/// assumed to have allocated at least \c GetNumStencils() elements.
///
/// @param controlValues Buffer with primvar data for the control vertices
///
/// @param uuderivs Destination buffer for the interpolated 'uu'
/// derivative primvar data
///
/// @param uvderivs Destination buffer for the interpolated 'uv'
/// derivative primvar data
///
/// @param vvderivs Destination buffer for the interpolated 'vv'
/// derivative primvar data
///
/// @param start index of first value to update
///
/// @param end Index of last value to update
///
template <class T>
void Update2ndPartials(T const *controlValues, T *uuderivs, T *uvderivs, T *vvderivs,
int start=-1, int end=-1) const {

View File

@ -401,6 +401,8 @@ LimitStencilTableFactory::Create(TopologyRefiner const & refiner,
PatchTableFactory::Options options;
options.SetEndCapType(
Far::PatchTableFactory::Options::ENDCAP_GREGORY_BASIS);
options.useInfSharpPatch = !uniform &&
refiner.GetAdaptiveOptions().useInfSharpPatch;
patchtable = PatchTableFactory::Create(refiner, options);

View File

@ -118,6 +118,23 @@ public:
Index FindEdge(Index v0, Index v1) const { return _level->findEdge(v0, v1); }
//@}
//@{
/// @name Methods to inspect other topological properties of individual components:
///
/// \brief Return if the edge is non-manifold
bool IsEdgeNonManifold(Index e) const { return _level->isEdgeNonManifold(e); }
/// \brief Return if the vertex is non-manifold
bool IsVertexNonManifold(Index v) const { return _level->isVertexNonManifold(v); }
/// \brief Return if the edge is a boundary
bool IsEdgeBoundary(Index e) const { return _level->getEdgeTag(e)._boundary; }
/// \brief Return if the vertex is a boundary
bool IsVertexBoundary(Index v) const { return _level->getVertexTag(v)._boundary; }
//@}
//@{
/// @name Methods to inspect feature tags for individual components:
///
@ -157,16 +174,46 @@ public:
/// the way in which vertices associated with the face are accessed -- an
/// array of fixed size containing the indices for each corner is provided
/// for inspection, iteration, etc.
///
/// When the face-varying topology around a vertex "matches", it has the
/// same limit properties and so results in the same limit surface when
/// collections of adjacent vertices match. Like other references to
/// "topology", this includes consideration of sharpness. So it may be
/// that face-varying values are assigned around a vertex on a boundary in
/// a way that appears to match, but the face-varying interpolation option
/// requires sharpening of that vertex in face-varying space -- the
/// difference in the topology of the resulting limit surfaces leading to
/// the query returning false for the match. The edge case is simpler in
/// that it only considers continuity across the edge, not the entire
/// neighborhood around each end vertex.
/// \brief Return the number of face-varying channels (should be same for all levels)
int GetNumFVarChannels() const { return _level->getNumFVarChannels(); }
int GetNumFVarChannels() const { return _level->getNumFVarChannels(); }
/// \brief Return the total number of face-varying values in a particular channel
/// (the upper bound of a face-varying value index)
int GetNumFVarValues(int channel = 0) const { return _level->getNumFVarValues(channel); }
/// \brief Access the face-varying values associated with a particular face
ConstIndexArray GetFaceFVarValues(Index f, int channel = 0) const { return _level->getFaceFVarValues(f, channel); }
ConstIndexArray GetFaceFVarValues(Index f, int channel = 0) const {
return _level->getFaceFVarValues(f, channel);
}
/// \brief Return if face-varying topology around a vertex matches
bool DoesVertexFVarTopologyMatch(Index v, int channel = 0) const {
return _level->doesVertexFVarTopologyMatch(v, channel);
}
/// \brief Return if face-varying topology across the edge only matches
bool DoesEdgeFVarTopologyMatch(Index e, int channel = 0) const {
return _level->doesEdgeFVarTopologyMatch(e, channel);
}
/// \brief Return if face-varying topology around a face matches
bool DoesFaceFVarTopologyMatch(Index f, int channel = 0) const {
return _level->doesFaceFVarTopologyMatch(f, channel);
}
//@}
//@{

View File

@ -635,6 +635,11 @@ namespace {
return true;
}
// Any remaining locally extra-ordinary face-varying boundaries warrant selection:
if (compVTag._xordinary && featureMask.selectXOrdinaryInterior) {
return true;
}
// If no smooth corners, too many boundaries/sharp-features and need to isolate:
if (!(compVTag._rule & Sdc::Crease::RULE_SMOOTH)) {
return true;

View File

@ -256,7 +256,7 @@ TopologyRefinerFactoryBase::prepareComponentTagsAndSharpness(TopologyRefiner& re
// correct (or relevant) if non-manifold:
//
vTag._boundary = (boundaryEdgeCount > 0);
vTag._corner = isSharpenedCorner;
vTag._corner = isTopologicalCorner && vTag._infSharp;
if (vTag._corner) {
vTag._xordinary = false;
} else if (vTag._boundary) {

View File

@ -96,7 +96,7 @@ CpuPatchTable::CpuPatchTable(const Far::PatchTable *farPatchTable) {
// face-varying param
Far::ConstPatchParamArray
fvarParam = farPatchTable->GetPatchArrayFVarPatchParam(j, fvc);
fvarParam = farPatchTable->GetPatchArrayFVarPatchParams(j, fvc);
for (int k = 0; k < numPatches; ++k) {
PatchParam param;
//param.patchParam = patchParamTable[patchIndex];

View File

@ -56,7 +56,12 @@ GLSLPatchShaderSource::GetCommonShaderSource() {
/*static*/
std::string
GLSLPatchShaderSource::GetPatchBasisShaderSource() {
return std::string(patchBasisShaderSource);
std::stringstream ss;
#if defined(OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES)
ss << "#define OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES\n";
#endif
ss << std::string(patchBasisShaderSource);
return ss.str();
}
/*static*/

View File

@ -58,7 +58,12 @@ HLSLPatchShaderSource::GetCommonShaderSource() {
/*static*/
std::string
HLSLPatchShaderSource::GetPatchBasisShaderSource() {
return std::string(patchBasisShaderSource);
std::stringstream ss;
#if defined(OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES)
ss << "#define OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES\n";
#endif
ss << std::string(patchBasisShaderSource);
return ss.str();
}
/*static*/

View File

@ -464,10 +464,9 @@ void OsdGetGregoryPatchWeights(
}
}
//#define _USE_BEZIER_PSEUDO_DERIVATIVES
// dclyde's note: skipping half of the product rule like this does seem to change the result a lot in my tests.
// This is not a runtime bottleneck for cloth sims anyway so I'm just using the accurate version.
#ifdef _USE_BEZIER_PSEUDO_DERIVATIVES
#ifndef OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES
// Approximation to the true Gregory derivatives by differentiating the Bezier patch
// unique to the given (s,t), i.e. having F = (g^+ * f^+) + (g^- * f^-) as its four
// interior points:

View File

@ -25,7 +25,7 @@
#ifndef OPENSUBDIV3_VERSION_H
#define OPENSUBDIV3_VERSION_H
#define OPENSUBDIV_VERSION v3_1_0
#define OPENSUBDIV_VERSION v3_1_0_RC2
#define OPENSUBDIV_VERSION_NUMBER 30100

View File

@ -385,6 +385,15 @@ FVarLevel::completeTopologyFromFaceValues(int regularBoundaryValence) {
}
}
//
// Some non-manifold cases can have multiple fvar-values but without any discts
// edges that would previously have identified mismatch (e.g. two faces meeting
// at a common vertex), so deal with that case now that we've counted values:
//
if (!vIsManifold && !vertexMismatch[vIndex]) {
vertexMismatch[vIndex] = (uniqueValueCount > 1);
}
//
// Update the value count and offset for this vertex and cumulative totals:
//
@ -965,7 +974,6 @@ FVarLevel::gatherValueSpans(Index vIndex, ValueSpan * vValueSpans) const {
}
} else if (_level.getEdgeTag(vEdges[i])._infSharp) {
++ vValueSpans[0]._infSharpEdgeCount;
break;
} else if (_level.getEdgeTag(vEdges[i])._semiSharp) {
++ vValueSpans[0]._semiSharpEdgeCount;
}

View File

@ -433,6 +433,7 @@ FVarRefinement::propagateValueTags() {
//
cVert = _refinement.getFirstChildVertexFromVertices();
cVertEnd = cVert + _refinement.getNumChildVerticesFromVertices();
for ( ; cVert < cVertEnd; ++cVert) {
Index pVert = _refinement.getChildVertexParentIndex(cVert);
assert(_refinement.isChildVertexComplete(cVert));
@ -531,16 +532,6 @@ FVarRefinement::reclassifySemisharpValues() {
internal::StackBuffer<Index,16> cVertEdgeBuffer(_childLevel.getMaxValence());
FVarLevel::ValueTag valTagCrease;
valTagCrease.clear();
valTagCrease._mismatch = true;
valTagCrease._crease = true;
FVarLevel::ValueTag valTagSemiSharp;
valTagSemiSharp.clear();
valTagSemiSharp._mismatch = true;
valTagSemiSharp._semiSharp = true;
Index cVert = _refinement.getFirstChildVertexFromVertices();
Index cVertEnd = cVert + _refinement.getNumChildVerticesFromVertices();
@ -567,9 +558,9 @@ FVarRefinement::reclassifySemisharpValues() {
if (!cVertTags._semiSharp && !cVertTags._semiSharpEdges) {
for (int j = 0; j < cValueTags.size(); ++j) {
if (cValueTags[j]._semiSharp) {
FVarLevel::ValueTag cValueTagOld = cValueTags[j];
cValueTags[j] = valTagCrease;
cValueTags[j]._xordinary = cValueTagOld._xordinary;
cValueTags[j]._semiSharp = false;
cValueTags[j]._depSharp = false;
cValueTags[j]._crease = true;
}
}
continue;
@ -612,9 +603,9 @@ FVarRefinement::reclassifySemisharpValues() {
}
}
if (!isStillSemiSharp) {
FVarLevel::ValueTag cValueTagOld = cValueTags[j];
cValueTags[j] = valTagCrease;
cValueTags[j]._xordinary = cValueTagOld._xordinary;
cValueTags[j]._semiSharp = false;
cValueTags[j]._depSharp = false;
cValueTags[j]._crease = true;
}
}
}

View File

@ -554,7 +554,7 @@ bool
Level::doesVertexFVarTopologyMatch(Index vIndex, int fvarChannel) const {
return getFVarLevel(fvarChannel).valueTopologyMatches(
getFVarLevel(fvarChannel).getVertexValue(vIndex));
getFVarLevel(fvarChannel).getVertexValueOffset(vIndex));
}
bool
Level::doesEdgeFVarTopologyMatch(Index eIndex, int fvarChannel) const {

View File

@ -48,6 +48,8 @@
#include "catmark_fvar_bound0.h"
#include "catmark_fvar_bound1.h"
#include "catmark_fvar_bound2.h"
#include "catmark_fvar_bound3.h"
#include "catmark_fvar_project0.h"
#include "catmark_gregory_test0.h"
#include "catmark_gregory_test1.h"
#include "catmark_gregory_test2.h"
@ -78,6 +80,8 @@
#include "catmark_pyramid.h"
#include "catmark_rook.h"
#include "catmark_single_crease.h"
#include "catmark_inf_crease0.h"
#include "catmark_inf_crease1.h"
#include "catmark_smoothtris0.h"
#include "catmark_smoothtris1.h"
#include "catmark_square_hedit0.h"

View File

@ -25,20 +25,15 @@
static const std::string catmark_edgecorner =
"# This file uses centimeters as units for non-parametric coordinates.\n"
"\n"
"v 0.0 -2.0 0.0\n"
"v 2.0 0.0 0.0\n"
"v 0.0 2.0 0.0\n"
"v -2.0 0.0 0.0\n"
"v -1.0 0.0 -1.0\n"
"v 1.0 0.0 -1.0\n"
"v 1.0 0.0 1.0\n"
"v -1.0 0.0 1.0\n"
"vt 0.0 0.0\n"
"vt 1.0 0.0\n"
"vt 1.0 1.0\n"
"vt 0.0 1.0\n"
"vn 0.0 0.0 0.0\n"
"vn 0.0 0.0 0.0\n"
"vn 0.0 0.0 0.0\n"
"vn 0.0 0.0 0.0\n"
"s off\n"
"f 1/1/1 2/2/2 3/3/3 4/4/4\n"
"f 1/1 2/2 3/3 4/4\n"
"t interpolateboundary 1/0/0 1\n"
"\n"
;

View File

@ -25,20 +25,31 @@
static const std::string catmark_edgeonly =
"# This file uses centimeters as units for non-parametric coordinates.\n"
"\n"
"v 0.0 -2.0 0.0\n"
"v 2.0 0.0 0.0\n"
"v 0.0 2.0 0.0\n"
"v -2.0 0.0 0.0\n"
"v -0.5 0 0.1\n"
"v 0.5 0 0.1\n"
"v 0.5 0 1.1\n"
"v -0.5 0 1.1\n"
"v -1.1 0 -1.1\n"
"v -0.1 0 -1.1\n"
"v -0.1 0 -0.1\n"
"v -1.1 0 -0.1\n"
"v 0.1 0 -1.1\n"
"v 1.1 0 -1.1\n"
"v 1.1 0 -0.1\n"
"v 0.1 0 -0.1\n"
"vt 0.0 0.0\n"
"vt 1.0 0.0\n"
"vt 1.0 1.0\n"
"vt 0.0 1.0\n"
"vn 0.0 0.0 0.0\n"
"vn 0.0 0.0 0.0\n"
"vn 0.0 0.0 0.0\n"
"vn 0.0 0.0 0.0\n"
"s off\n"
"f 1/1/1 2/2/2 3/3/3 4/4/4\n"
"f 1/1 2/2 3/3 4/4\n"
"f 5/1 6/2 7/3 8/4\n"
"f 9/1 10/2 11/3 12/4\n"
"t corner 1/1/0 4 10\n"
"t corner 1/1/0 6 10\n"
"t corner 1/1/0 8 10\n"
"t corner 1/1/0 9 10\n"
"t corner 1/1/0 10 10\n"
"t corner 1/1/0 11 10\n"
"t interpolateboundary 1/0/0 2\n"
"\n"
;

View File

@ -0,0 +1,64 @@
//
// Copyright 2016 Dreamworks
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
static const std::string catmark_fvar_bound3 =
"v 0.00 0.00 1.00\n"
"v 1.00 0.00 0.00\n"
"v 0.50 0.87 0.00\n"
"v -0.50 0.87 0.00\n"
"v -1.00 0.00 0.00\n"
"v -0.50 -0.87 0.00\n"
"v 0.50 -0.87 0.00\n"
"v 0.75 0.50 0.00\n"
"v 0.00 1.00 0.00\n"
"v -0.75 0.50 0.00\n"
"v -0.75 -0.50 0.00\n"
"v 0.00 -1.00 0.00\n"
"v 0.75 -0.50 0.00\n"
"vt 0.10 0.05\n"
"vt 0.50 0.15\n"
"vt 0.90 0.05\n"
"vt 0.10 0.25\n"
"vt 0.50 0.35\n"
"vt 0.90 0.25\n"
"vt 0.10 0.35\n"
"vt 0.50 0.45\n"
"vt 0.90 0.35\n"
"vt 0.10 0.55\n"
"vt 0.50 0.65\n"
"vt 0.90 0.55\n"
"vt 0.10 0.65\n"
"vt 0.50 0.75\n"
"vt 0.90 0.65\n"
"vt 0.10 0.85\n"
"vt 0.50 0.95\n"
"vt 0.90 0.85\n"
"f 1/2 2/3 8/6 3/5 \n"
"f 1/2 3/5 9/4 4/1 \n"
"f 1/8 4/9 10/12 5/11\n"
"f 1/8 5/11 11/10 6/7 \n"
"f 1/14 6/15 12/18 7/17\n"
"f 1/14 7/17 13/16 2/13\n"
"t interpolateboundary 1/0/0 1\n"
;

View File

@ -0,0 +1,72 @@
//
// Copyright 2016 Dreamworks
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
static const std::string catmark_fvar_project0 =
"v -4 0.464466 -1.25\n"
"v -2.82149 1.64298 -1.25\n"
"v -4 2.82149 1.25\n"
"v -5.17851 1.64298 -1.25\n"
"v -5.17851 4 1.25\n"
"v -6.35702 2.82149 -1.25\n"
"v -6.35702 5.17851 -1.25\n"
"v -7.53553 4 -1.25\n"
"v -1.64298 2.82149 -1.25\n"
"v -2.82149 4 1.25\n"
"v -4 5.17851 1.25\n"
"v -5.17851 6.35702 -1.25\n"
"v -0.464466 4 -1.25\n"
"v -1.64298 5.17851 -1.25\n"
"v -2.82149 6.35702 -1.25\n"
"v -4 7.53553 -1.25\n"
"vt 0 0\n"
"vt 0.333333 0\n"
"vt 0.333333 0.333333\n"
"vt 0 0.333333\n"
"vt 0.333333 0.666667\n"
"vt 0 0.666667\n"
"vt 0.333333 1\n"
"vt 0 1\n"
"vt 0.666667 0\n"
"vt 0.666667 0.333333\n"
"vt 0.666667 0.666667\n"
"vt 0.666667 1\n"
"vt 1 0\n"
"vt 1 0.333333\n"
"vt 1 0.666667\n"
"vt 1 1\n"
"f 1/1 2/2 3/3 4/4\n"
"f 4/4 3/3 5/5 6/6\n"
"f 6/6 5/5 7/7 8/8\n"
"f 2/2 9/9 10/10 3/3\n"
"f 3/3 10/10 11/11 5/5\n"
"f 5/5 11/11 12/12 7/7\n"
"f 9/9 13/13 14/14 10/10\n"
"f 10/10 14/14 15/15 11/11\n"
"f 11/11 15/15 16/16 12/12\n"
"t interpolateboundary 1/0/0 1\n"
"t crease 2/1/0 2 4 10.0\n"
"t crease 2/1/0 2 9 10.0\n"
"t crease 2/1/0 10 9 10.0\n"
"t crease 2/1/0 10 4 10.0\n"
;

View File

@ -0,0 +1,125 @@
//
// Copyright 2016 Dreamworks
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
static const std::string catmark_inf_crease0 =
"# This file uses centimeters as units for non-parametric coordinates.\n"
"\n"
"v 0.00 0.00 0.00\n"
"v 1.00 0.00 0.00\n"
"v 2.00 0.00 0.00\n"
"v 3.00 0.00 0.00\n"
"v 4.00 0.00 0.00\n"
"v 0.00 1.00 0.00\n"
"v 1.00 1.00 1.25\n"
"v 2.00 1.00 0.00\n"
"v 3.00 1.00 1.25\n"
"v 4.00 1.00 0.00\n"
"v 0.00 2.00 0.00\n"
"v 1.00 2.00 0.00\n"
"v 2.00 2.00 0.00\n"
"v 3.00 2.00 0.00\n"
"v 4.00 2.00 0.00\n"
"v 0.00 3.00 0.00\n"
"v 1.00 3.00 1.25\n"
"v 2.00 3.00 0.00\n"
"v 3.00 3.00 1.25\n"
"v 4.00 3.00 0.00\n"
"v 0.00 4.00 0.00\n"
"v 1.00 4.00 0.00\n"
"v 2.00 4.00 0.00\n"
"v 3.00 4.00 0.00\n"
"v 4.00 4.00 0.00\n"
"\n"
"vt 0.00 0.00\n"
"vt 0.20 0.00\n"
"vt 0.50 0.00\n"
"vt 0.80 0.00\n"
"vt 1.00 0.00\n"
"vt 0.00 0.20\n"
"vt 0.20 0.20\n"
"vt 0.50 0.10\n"
"vt 0.80 0.20\n"
"vt 1.00 0.20\n"
"vt 0.00 0.40\n"
"vt 0.20 0.40\n"
"vt 0.50 0.20\n"
"vt 0.80 0.40\n"
"vt 1.00 0.40\n"
"vt 0.00 0.60\n"
"vt 0.25 0.60\n"
"vt 0.50 0.40\n"
"vt 0.75 0.60\n"
"vt 1.00 0.60\n"
"vt 0.00 0.80\n"
"vt 0.25 0.80\n"
"vt 0.50 0.65\n"
"vt 0.75 0.80\n"
"vt 1.00 0.80\n"
"vt 0.00 1.00\n"
"vt 0.25 1.00\n"
"vt 0.50 1.00\n"
"vt 0.75 1.00\n"
"vt 1.00 1.00\n"
"vt 0.40 0.00\n"
"vt 0.60 0.00\n"
"vt 0.40 0.10\n"
"vt 0.60 0.10\n"
"vt 0.40 0.25\n"
"vt 0.60 0.25\n"
"vt 0.40 1.00\n"
"vt 0.60 1.00\n"
"\n"
"f 1/1 2/2 7/7 6/6\n"
"f 2/2 3/31 8/33 7/7\n"
"f 3/32 4/4 9/9 8/34\n"
"f 4/4 5/5 10/10 9/9\n"
"f 6/6 7/7 12/12 11/11\n"
"f 7/7 8/33 13/35 12/12\n"
"f 8/34 9/9 14/14 13/36\n"
"f 9/9 10/10 15/15 14/14\n"
"f 11/16 12/17 17/22 16/21\n"
"f 12/17 13/18 18/23 17/22\n"
"f 13/18 14/19 19/24 18/23\n"
"f 14/19 15/20 20/25 19/24\n"
"f 16/21 17/22 22/27 21/26\n"
"f 17/22 18/23 23/37 22/27\n"
"f 18/23 19/24 24/29 23/38\n"
"f 19/24 20/25 25/30 24/29\n"
"\n"
"t interpolateboundary 1/0/0 1\n"
"\n"
"t crease 2/1/0 1 6 10.0\n"
"t crease 2/1/0 3 8 10.0\n"
"t crease 2/1/0 5 6 10.0\n"
"t crease 2/1/0 6 11 10.0\n"
"t crease 2/1/0 8 13 10.0\n"
"t crease 2/1/0 11 16 10.0\n"
"t crease 2/1/0 11 16 10.0\n"
"t crease 2/1/0 13 18 10.0\n"
"t crease 2/1/0 15 16 10.0\n"
"t crease 2/1/0 16 17 10.0\n"
"t crease 2/1/0 18 19 10.0\n"
"t crease 2/1/0 16 21 10.0\n"
"\n"
;

View File

@ -0,0 +1,114 @@
//
// Copyright 2016 Dreamworks
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
static const std::string catmark_inf_crease1 =
"# This file uses centimeters as units for non-parametric coordinates.\n"
"\n"
"v -1.10 1.10 0.75\n"
"v -0.10 1.10 0.00\n"
"v -0.60 1.97 0.00\n"
"v -1.60 1.97 0.00\n"
"v -2.10 1.10 0.00\n"
"v -1.60 0.23 0.00\n"
"v -0.60 0.23 0.00\n"
"v -0.35 1.60 0.00\n"
"v -1.10 2.10 0.00\n"
"v -1.85 1.60 0.00\n"
"v -1.85 0.60 0.00\n"
"v -1.10 0.10 0.00\n"
"v -0.35 0.60 0.00\n"
"v 1.10 1.10 0.75\n"
"v 2.10 1.10 0.00\n"
"v 1.60 1.97 0.00\n"
"v 0.60 1.97 0.00\n"
"v 0.10 1.10 0.00\n"
"v 0.60 0.23 0.00\n"
"v 1.60 0.23 0.00\n"
"v 1.85 1.60 0.00\n"
"v 1.10 2.10 0.00\n"
"v 0.35 1.60 0.00\n"
"v 0.35 0.60 0.00\n"
"v 1.10 0.10 0.00\n"
"v 1.85 0.60 0.00\n"
"v -1.10 -1.10 0.75\n"
"v -0.10 -1.10 0.00\n"
"v -0.60 -0.23 0.00\n"
"v -1.60 -0.23 0.00\n"
"v -2.10 -1.10 0.00\n"
"v -1.60 -1.97 0.00\n"
"v -0.60 -1.97 0.00\n"
"v -0.35 -0.60 0.00\n"
"v -1.10 -0.10 0.00\n"
"v -1.85 -0.60 0.00\n"
"v -1.85 -1.60 0.00\n"
"v -1.10 -2.10 0.00\n"
"v -0.35 -1.60 0.00\n"
"v 1.10 -1.10 0.75\n"
"v 2.10 -1.10 0.00\n"
"v 1.60 -0.23 0.00\n"
"v 0.60 -0.23 0.00\n"
"v 0.10 -1.10 0.00\n"
"v 0.60 -1.97 0.00\n"
"v 1.60 -1.97 0.00\n"
"v 1.85 -0.60 0.00\n"
"v 1.10 -0.10 0.00\n"
"v 0.35 -0.60 0.00\n"
"v 0.35 -1.60 0.00\n"
"v 1.10 -2.10 0.00\n"
"v 1.85 -1.60 0.00\n"
"f 1 2 8 3\n"
"f 1 3 9 4\n"
"f 1 4 10 5\n"
"f 1 5 11 6\n"
"f 1 6 12 7\n"
"f 1 7 13 2\n"
"f 14 15 21 16\n"
"f 14 16 22 17\n"
"f 14 17 23 18\n"
"f 14 18 24 19\n"
"f 14 19 25 20\n"
"f 14 20 26 15\n"
"f 27 28 34 29\n"
"f 27 29 35 30\n"
"f 27 30 36 31\n"
"f 27 31 37 32\n"
"f 27 32 38 33\n"
"f 27 33 39 28\n"
"f 40 41 47 42\n"
"f 40 42 48 43\n"
"f 40 43 49 44\n"
"f 40 44 50 45\n"
"f 40 45 51 46\n"
"f 40 46 52 41\n"
"t interpolateboundary 1/0/0 1\n"
"t crease 2/1/0 0 4 10.0\n"
"t crease 2/1/0 13 15 10.0\n"
"t crease 2/1/0 13 19 10.0\n"
"t crease 2/1/0 26 28 10.0\n"
"t crease 2/1/0 26 29 10.0\n"
"t crease 2/1/0 26 31 10.0\n"
"t crease 2/1/0 39 41 10.0\n"
"t crease 2/1/0 39 44 10.0\n"
"\n"
;