Merge branch 'release/v3_1_0'

This commit is contained in:
David G Yu 2016-10-21 16:04:26 -07:00
commit f4b565e168
33 changed files with 427 additions and 133 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

View File

@ -99,7 +99,7 @@
<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="release_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>

View File

@ -23,29 +23,281 @@
Overview of Release 3.1
-----------------------
=======================
.. contents::
:local:
:backlinks: none
----
New Features
------------
Release 3.1
===========
Bicubic Face-Varying Patches
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Face-Varying Patches
********************
The motivation for this feature is to improve drawing and evaluation of face-varying
primvar values for all
`face-varying interpolation options <subdivision_surfaces.html#face-varying-interpolation-rules>`__.
A common use of non-linear face-varying data is to capture a UV projection on
the surface. The following example shows a simple shape with the face-varying
interpolation option assigned to a non-linear choice to achieve the desired
projection (in this case FVAR_LINEAR_NONE):
+----------------------------------------------+----------------------------------------------+
| .. image:: images/fvar_patch_linearall.png | .. image:: images/fvar_patch_linearnone.png |
| :align: center | :align: center |
| :width: 75% | :width: 75% |
| :target: images/fvar_patch_linearall.png | :target: images/fvar_patch_linearnone.png |
| | |
| Linear Face-Varying Patches | Bicubic Face-Varying Patches |
+----------------------------------------------+----------------------------------------------+
The result on the left shows the old linearly interpolated patches, which
ignores any non-linear settings. The result on the right shows the new use of
bicubic face-varying patches to accurately interpolate the desired projection.
Generation of a full face-varying patch representation can be enabled using a new option
in Far::PatchTableFactory::Options. Additionally, topological refinement can be improved
to consider fvar channel topology using a new option in Far::TopologyRefiner::AdaptiveOptions. See the API additions below and their associated Doxygen text
for more details.
Evaluation of patch basis weights for all patch types as been added to the GPU shader
source provided by Osd::GLSLPatchShaderSource, and Osd::HLSLPatchShaderSource.
Use of non-linear face-varying patches increases the storage size of the patch table and may also require additional data access and computation while drawing.
Varying and Face-Varying Evaluation
***********************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2nd Order Derivative Evaluation
*******************************
This feature extends existing evaluation methods to support evaluation of varying and face-varying
primvar data at arbitrary limit surface locations.
+-----------------------------------------+-----------------------------------------+
| .. image:: images/eval_varying.png | .. image:: images/eval_facevarying.png |
| :align: center | :align: center |
| :width: 75% | :width: 75% |
| :target: images/eval_varying.png | :target: images/eval_facevarying.png |
| | |
| Varying Primvar Evaluation | Face-Varying Primvar Evaluation |
+-----------------------------------------+-----------------------------------------+
The image on the left shows evaluation of varying primvar values and the image on the right
shows evaluation of face-varying primvar values.
The EvaluateBasis API of Far::PatchTable has been extended as well as the OSD Evaluator API.
Second Order Derivative Evaluation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This feature extends the Far::LimitStencilTable and Far::PatchTable interfaces to support
evaluation of 2nd order partial derivatives. The generation of derivative values
for Far::LimitStencilTable is controlled by new options that can be specified when creating
the stencil table.
Additionally, the implementation exposes a more accurate method to compute derivatives
for Gregory basis patches. This can be enabled using the CMake configuration and
compile time definition OPENSUBDIV_GREGORY_EVAL_TRUE_DERIVATIVES.
Separate Levels of Feature Isolation
************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The primary motivation for this feature is to reduce the number of patches generated by
adaptive refinement when they can be adequately represented at a lower level. A single
level of isolation must be as high as the greatest semi-sharp feature to properly resolve
the shape of that feature. That high isolation level generates many unnecessary patches
for smooth extra-ordinary vertices.
In the following example, a single semi-sharp vertex is refined to level 5:
+--------------------------------------+--------------------------------------+
| .. image:: images/sec_level_off.png | .. image:: images/sec_level_on.png |
| :align: center | :align: center |
| :width: 75% | :width: 75% |
| :target: images/sec_level_off.png | :target: images/sec_level_on.png |
| | |
| Single Isolation Level 5 | Primary Level 5, Secondary Level 2 |
+--------------------------------------+--------------------------------------+
Single isolation to level 5 on the left results in 312 patches. The right shows the
semi-sharp feature isolated to 5, but with the new "secondary level" set to 2, the
number of patches is reduced to 123.
The second specified level of adaptive refinement is used
to halt isolation for features that typically do not require the specified maximum.
These include interior and boundary extra-ordinary vertices and those infinitely sharp
patches that correspond to boundary extra-ordinary patches.
The secondary level is available as a new option in Far::TopologyRefiner::AdaptiveOptions.
Sharp Patches for Infinitely Sharp Features
*******************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The motivation for sharp patches is to accurately represent the limit surface of
infinitely sharp features, which otherwise can only be approximated by very high levels
of adaptive refinement, resulting in many unnecessary patches.
The true limit surface for regular faces along an infinitely sharp crease is a
regular B-Spline patch -- the same as regular faces along a boundary.
Similarly, the limit surface for faces around an extra-ordinary vertex on an infinitely
sharp crease is the same as that of faces around an extra-ordinary vertex on a boundary.
So these patches are identified and isolated to the same degree -- the regular patches
as soon as possible, and the irregular patches to the depth specified.
Consider the following (regression/shape/catmark_cube_creases2):
+------------------------------------+------------------------------------+------------------------------------+
| .. image:: images/inf_sharp_a.png | .. image:: images/inf_sharp_b.png | .. image:: images/inf_sharp_c.png |
| :align: center | :align: center | :align: center |
| :width: 100% | :width: 100% | :width: 100% |
| :target: images/inf_sharp_a.png | :target: images/inf_sharp_b.png | :target: images/inf_sharp_c.png |
| | | |
| Level 5 without Sharp Patches | Level 5 with Sharp Patches | Level 2 with Sharp Patches |
+------------------------------------+------------------------------------+------------------------------------+
Without use of sharp patches on the left, isolating to level 5 generates 1764 patches and does still
not capture the sharp edges. With sharp patches in the center, isolating to the same degree (level
5) reduces the number of patches to 96 and captures the sharp edges. The sharp features can be
captured at a lower degree with comparable accuracy as illustrated on the right where isolation to
level 2 further reduces the number of patches to 42.
The use of infinitely sharp patches can be enabled both at a high level as an new option to Osd::Mesh,
or more directly when adaptively refining or construction the patch tables in
Far::TopologyRefiner::AdaptiveOptions and Far::PatchTableFactory::Options.
Given the improved accuracy and reduced patches by the use of simple regular patches, we would prefer
that this be the default behavior, but it was made an explicit option in order to avoid disrupting
existing usage. In a future major release this feature will hopefully be the norm.
API Additions
-------------
See associated `Doxygen <doxy_html/index.html>`__ for full details.
Osd::CpuEvaluator, GLComputeEvaluator, etc:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- EvalPatchesVarying()
- EvalPatchesFaceVarying()
Osd::CpuPatchTable, GLPatchTable, etc:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- GetFVarPatchArrayBuffer()
- GetFVarPatchIndexBuffer()
- GetFVarPatchIndexSize()
- GetFVarPatchParamBuffer()
- GetFVarPatchParamSize()
- GetNumFVarChannels()
- GetVaryingPatchArrayBuffer()
- GetVaryingPatchIndexBuffer()
- GetVaryingPatchIndexSize()
Osd::MeshBits:
~~~~~~~~~~~~~~
- member MeshFVarAdaptive
- member MeshUseInfSharpPatch
Osd::PatchParam
~~~~~~~~~~~~~~~
- IsRegular()
- Unnormalize()
- extensions to Set()
Osd::GLSLPatchShaderSource, HLSLPatchShaderSource
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- GetPatchBasisShaderSource()
Far::LimitStencil
~~~~~~~~~~~~~~~~~
- GetDuuWeights()
- GetDuvWeights()
- GetDvvWeights()
- extensions to LimitStencil()
Far::LimitStencilTable
~~~~~~~~~~~~~~~~~~~~~~
- GetDuuWeights()
- GetDuvWeights()
- GetDvvWeights()
- Update2ndDerivs()
- extensions to LimitStencilTable()
Far::LimitStencilTableFactory::Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- member generate1stDerivatives
- member generate1stDerivatives
- extensions to LimitTableStencilFactory::Create()
Far::PatchParam
~~~~~~~~~~~~~~~
- IsRegular()
- Unnormalize()
- extensions to Set()
Far::PatchTable
~~~~~~~~~~~~~~~
- ComputeLocalPointValuesFaceVarying()
- ComputeLocalPointValuesVarying()
- GetFVarPatchDescriptor()
- GetFVarPatchParam()
- GetNumLocalPointsFaceVarying()
- GetNumLocalPointsVarying()
- GetPatchArrayVaryingVertices()
- GetPatchArrayFVarPatchParam()
- GetPatchArrayFVarValues()
- GetPatchFVarPatchParam()
- GetPatchVaryingVertices()
- GetVaryingPatchDescriptor()
- GetVaryingVertices()
- EvaluateBasisFaceVarying()
- EvaluateBasisVarying()
- extensions to EvaluateBasis()
Far::PatchTableFactory::Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- member useInfSharpPatch
- member genenerateFVarLegacyLinearPatches
Far::TopologyLevel
~~~~~~~~~~~~~~~~~~
- DoesEdgeFVarTopologyMatch()
- DoesFaceFVarTopologyMatch()
- DoesVertexFVarTopologyMatch()
- IsEdgeBoundary()
- IsEdgeNonManifold()
- IsVertexBoundary()
- IsVertexNonManifold()
Far::TopologyRefiner::AdaptiveOptions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- member secondaryLevel
- member useInfSharpPatch
- member considerFVarChannels
Other Changes
-------------
Improvements
~~~~~~~~~~~~
- Enabled the use of CMake's folder feature
- Removed the use of iso646 alternative keywords ('and', 'or', 'not', etc.) to improve portability
- Added numerical valued preprocessor directives (OPENSUBDIV_VERSION_MAJOR, etc.) to <opensubdiv/version.h>
- Improved documentation for Far::PatchParam and added Unnormalize() to complement Normalize()
- Added additional topology queries to Far::TopologyLevel
- Updated glFVarViewer and glEvalLimit viewer to make use of bicubic face-varying patches
- Updated glViewer and dxViewer to add a toggle for InfSharpPatch
- Updated dxPtexViewer for improved feature parity with glPtexViewer
- Improved far_regression to exercise shapes independent of Hbr compatibility
- Added support for Appveyor continuous integration testing
- Removed cmake/FindIlmBase
- Removed mayaPolySmooth example
Bug Fixes
~~~~~~~~~
- Fixed Ptex version parsing and compatibility issues
- Fixed compatibility issues with VS2015
- Fixed bug interpolating face-varying data with Bilinear scheme
- Fixed bug with refinement using Chaikin creasing
- Fixed bugs with HUD sliders in the example viewers

View File

@ -34,64 +34,37 @@
Release 3.1.0
=============
Release 3.1.0 is a significant release with several new features, important bug fixes, and general code and configuration improvements.
Release 3.1.0 is a significant release with several new features, bug fixes, and general
code and configuration improvements. For more information on the following, please see
`Release 3.1 <release_31.html>`__
**New Features**
- Bicubic Face-varying Patches
- Face-varying channel data that has a linear interpolation other than FVAR_LINEAR_ALL can now produce bicubic patches
- Adaptive refinement of face-varying data can be improved by considering face-varying topology during refinement
- Client shader code can obtain patch basis weights needed for evaluation by calling methods provided as source by Osd
- Varying and FaceVarying Evaluation
- Extended Far::PatchTable and the Osd Evaluator API to allow evaluation of varying and face-varying primvar data at arbitrary limit surface locations
- 2nd Order Derivative Evaluation
- Clients can now evaluate 2nd order derivatives using Far and Osd API
- Bicubic Face-Varying Patches
- Varying and Face-Varying Evaluation
- Second Order Derivative Evaluation
- Separate Levels of Feature Isolation
- Extended feature adaptive refinement with a second, shallower level of refinement at which to represent features not needing greater isolation
- Sharp Patches for Infinitely Sharp Features
- Infinitely sharp features can now be refined to infinitely sharp patches, both reducing the number of patches required and improving their accuracy
**Changes**
- Added numerical valued preprocessor directives (OPENSUBDIV_VERSION_MAJOR, etc.) to <opensubdiv/version.h>
- Updated glFVarViewer and glEvalLimit viewer to make use of bicubic face-varying patches
- Updated glViewer and dxViewer to add a toggle for InfSharpPatch
- Improved documentation for Far::PatchParam and added Unnormalize() to complement Normalize()
- Improved far_regression
- Enabled the use of CMake's folder feature
- Removed the use of iso646 alternative keywords ('and', 'or', 'not', etc.) to improve portability
- Removed mayaPolySmooth example
- Removed cmake/FindIlmBase
- Added numerical valued preprocessor directives (OPENSUBDIV_VERSION_MAJOR, etc.) to <opensubdiv/version.h>
- Improved documentation for Far::PatchParam and added Unnormalize() to complement Normalize()
- Added additional topology queries to Far::TopologyLevel
- Updated glFVarViewer and glEvalLimit viewer to make use of bicubic face-varying patches
- Updated glViewer and dxViewer to add a toggle for InfSharpPatch
- Updated dxPtexViewer for improved feature parity with glPtexViewer
- Improved far_regression to exercise shapes independent of Hbr compatibility
- Added support for Appveyor continuous integration testing
- Removed cmake/FindIlmBase
- Removed mayaPolySmooth example
**Bug Fixes**
- Improved Ptex and DX compatibility
- Fixed some subtle bugs with Chaikin refinement
- Fixed Ptex version parsing and compatibility issues
- 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
- Fixed bug interpolating face-varying data with Bilinear scheme
- Fixed bug with refinement using Chaikin creasing
- Fixed bugs with HUD sliders in the example viewers
Release 3.0.5
=============
@ -183,7 +156,7 @@ Release 3.0.0
Release 3.0.0 is a major release with many significant improvements and
changes. For more information on the following, please see
`Introduction to 3.0 <intro_30.html>`__
`Release 3.0 <release_30.html>`__
**New Features**
- Faster subdivision using less memory

View File

@ -822,7 +822,7 @@ display() {
glBindVertexArray(g_vao);
OpenSubdiv::Far::PatchDescriptor fvarDesc =
g_mesh->GetFarPatchTable()->GetFVarChannelPatchDescriptor(0);
g_mesh->GetFarPatchTable()->GetFVarPatchDescriptor(0);
OpenSubdiv::Osd::PatchArrayVector const & patches =
g_mesh->GetPatchTable()->GetPatchArrays();

View File

@ -177,18 +177,19 @@ interpolateFaceVarying(vec2 uv, int fvarOffset)
float wP[16], wDs[16], wDt[16], wDss[16], wDst[16], wDtt[16];
int patchCVs = 16;
int patchStride = patchCVs;
int boundaryMask = (int(texelFetch(OsdFVarParamBuffer, patchIndex).y) >> 8) & 0xf;
ivec3 fvarPatchParam = texelFetch(OsdFVarParamBuffer, patchIndex).xyz;
int boundaryMask = OsdGetPatchBoundaryMask(fvarPatchParam);
OsdGetBSplinePatchWeights(uv.s, uv.t, 1.0f, boundaryMask, wP, wDs, wDt, wDss, wDst, wDtt);
#elif defined(SHADING_FACEVARYING_SMOOTH_GREGORY_BASIS)
float wP[20], wDs[20], wDt[20], wDss[20], wDst[20], wDtt[20];
int patchCVs = 20;
int patchStride = patchCVs;
bool isRegular = ((int(texelFetch(OsdFVarParamBuffer, patchIndex).y) >> 5) & 0x1) != 0;
if (isRegular) {
ivec3 fvarPatchParam = texelFetch(OsdFVarParamBuffer, patchIndex).xyz;
if (OsdGetPatchIsRegular(fvarPatchParam)) {
float wP16[16], wDs16[16], wDt16[16], wDss16[16], wDst16[16], wDtt16[16];
patchCVs = 16;
int boundaryMask = (int(texelFetch(OsdFVarParamBuffer, patchIndex).y) >> 8) & 0xf;
int boundaryMask = OsdGetPatchBoundaryMask(fvarPatchParam);
OsdGetBSplinePatchWeights(uv.s, uv.t, 1.0f, boundaryMask, wP16, wDs16, wDt16, wDss16, wDst16, wDtt16);
for (int i=0; i<patchCVs; ++i) {
wP[i] = wP16[i];

View File

@ -115,7 +115,9 @@ public:
ss << "#define OSD_ENABLE_PATCH_CULL\n";
ss << "#define GEOMETRY_OUT_LINE\n";
ss << "#define OSD_PATCH_ENABLE_SINGLE_CREASE\n";
if (desc.IsAdaptive() && type == Far::PatchDescriptor::REGULAR) {
ss << "#define OSD_PATCH_ENABLE_SINGLE_CREASE\n";
}
// include osd PatchCommon
ss << Osd::GLSLPatchShaderSource::GetCommonShaderSource();

View File

@ -138,12 +138,18 @@ void main()
layout(triangle_strip, max_vertices = EDGE_VERTS) out;
in block {
OutputVertex v;
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
vec2 vSegments;
#endif
OSD_USER_VARYING_DECLARE
} inpt[EDGE_VERTS];
out block {
OutputVertex v;
noperspective out vec4 edgeDistance;
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
vec2 vSegments;
#endif
OSD_USER_VARYING_DECLARE
} outpt;
@ -157,6 +163,10 @@ void emit(int index, vec3 normal)
outpt.v.normal = normal;
#endif
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
outpt.vSegments = inpt[index].vSegments;
#endif
outpt.color = inpt[index].color;
gl_Position = ProjectionMatrix * inpt[index].v.position;
@ -187,6 +197,7 @@ void emit(int index, vec3 normal, vec4 edgeVerts[EDGE_VERTS])
edgeDistance(edgeVerts[index], edgeVerts[1], edgeVerts[2]);
#ifdef PRIM_TRI
outpt.edgeDistance[2] =
outpt.edgeDistance[3] =
edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[0]);
#endif
#ifdef PRIM_QUAD
@ -272,6 +283,9 @@ void main()
in block {
OutputVertex v;
noperspective in vec4 edgeDistance;
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
vec2 vSegments;
#endif
OSD_USER_VARYING_DECLARE
} inpt;
@ -346,8 +360,7 @@ getAdaptivePatchColor(ivec3 patchParam)
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
// check this after boundary/corner since single crease patch also has edgeCount.
float sharpness = OsdGetPatchSharpness(patchParam);
if (sharpness > 0) {
if (inpt.vSegments.y > 0) {
patchType = 1;
}
#elif defined OSD_PATCH_GREGORY

View File

@ -227,7 +227,7 @@ private:
}
unsigned int unpack(unsigned int value, int width, int offset) const {
return (unsigned short)((value >> offset) & ((1<<width)-1));
return (unsigned int)((value >> offset) & ((1<<width)-1));
}
};

View File

@ -484,7 +484,7 @@ PatchTable::GetFVarChannelLinearInterpolation(int channel) const {
return c.interpolation;
}
PatchDescriptor
PatchTable::GetFVarChannelPatchDescriptor(int channel) const {
PatchTable::GetFVarPatchDescriptor(int channel) const {
FVarPatchChannel const & c = getFVarPatchChannel(channel);
return c.desc;
}
@ -615,7 +615,7 @@ PatchTable::EvaluateBasisFaceVarying(
PatchParam param = getPatchFVarPatchParam(handle.patchIndex, channel);
PatchDescriptor::Type patchType = param.IsRegular()
? PatchDescriptor::REGULAR
: GetFVarChannelPatchDescriptor(channel).GetType();
: GetFVarPatchDescriptor(channel).GetType();
if (patchType == PatchDescriptor::REGULAR) {
internal::GetBSplineWeights(param, s, t, wP, wDs, wDt, wDss, wDst, wDtt);

View File

@ -162,8 +162,8 @@ public:
/// \brief Updates local point vertex values.
///
/// @param src Buffer with primvar data for the coarse vertex values
/// and refined vertex values
/// @param src Buffer with primvar data for the base and refined
/// vertex values
///
/// @param dst Destination buffer for the computed local point
/// vertex values
@ -182,8 +182,8 @@ public:
/// \brief Updates local point varying values.
///
/// @param src Buffer with primvar data for the coarse varying values
/// and refined varying values
/// @param src Buffer with primvar data for the base and refined
/// varying values
///
/// @param dst Destination buffer for the computed local point
/// varying values
@ -202,8 +202,8 @@ public:
/// \brief Updates local point face-varying values.
///
/// @param src Buffer with primvar data for the coarse face-varying
/// values and refined face-varying values
/// @param src Buffer with primvar data for the base and refined
/// face-varying values
///
/// @param dst Destination buffer for the computed local point
/// face-varying values
@ -298,11 +298,8 @@ public:
/// \brief Returns the number of face-varying channels
int GetNumFVarChannels() const;
/// \brief Deprecated Returns the interpolation mode for \p channel
Sdc::Options::FVarLinearInterpolation GetFVarChannelLinearInterpolation(int channel = 0) const;
/// \brief Returns the patch descriptor for \p channel
PatchDescriptor GetFVarChannelPatchDescriptor(int channel = 0) const;
PatchDescriptor GetFVarPatchDescriptor(int channel = 0) const;
/// \brief Returns the value indices for a given patch in \p channel
ConstIndexArray GetPatchFVarValues(PatchHandle const & handle, int channel = 0) const;
@ -327,6 +324,9 @@ public:
/// \brief Returns an array of face-varying patch param for \p channel
ConstPatchParamArray GetFVarPatchParams(int channel = 0) const;
/// \brief Deprecated @see PatchTable#GetFVarPatchDescriptor
Sdc::Options::FVarLinearInterpolation GetFVarChannelLinearInterpolation(int channel = 0) const;
//@}
@ -369,84 +369,84 @@ public:
///
/// \brief Evaluate basis functions for position and derivatives at a
/// given (s,t) parametric location of a patch.
/// given (u,v) parametric location of a patch.
///
/// @param handle A patch handle indentifying the sub-patch containing the
/// (s,t) location
/// (u,v) location
///
/// @param s Patch coordinate (in coarse face normalized space)
/// @param u Patch coordinate (in base face normalized space)
///
/// @param t Patch coordinate (in coarse face normalized space)
/// @param v Patch coordinate (in base face normalized space)
///
/// @param wP Weights (evaluated basis functions) for the position
///
/// @param wDs Weights (evaluated basis functions) for derivative wrt s
/// @param wDu Weights (evaluated basis functions) for derivative wrt u
///
/// @param wDt Weights (evaluated basis functions) for derivative wrt t
/// @param wDv Weights (evaluated basis functions) for derivative wrt v
///
/// @param wDss Weights (evaluated basis functions) for derivative wrt ss
/// @param wDuu Weights (evaluated basis functions) for 2nd derivative wrt u
///
/// @param wDst Weights (evaluated basis functions) for derivative wrt st
/// @param wDuv Weights (evaluated basis functions) for 2nd derivative wrt u and v
///
/// @param wDtt Weights (evaluated basis functions) for derivative wrt tt
/// @param wDvv Weights (evaluated basis functions) for 2nd derivative wrt v
///
void EvaluateBasis(PatchHandle const & handle, float s, float t,
float wP[], float wDs[] = 0, float wDt[] = 0,
float wDss[] = 0, float wDst[] = 0, float wDtt[] = 0) const;
void EvaluateBasis(PatchHandle const & handle, float u, float v,
float wP[], float wDu[] = 0, float wDv[] = 0,
float wDuu[] = 0, float wDuv[] = 0, float wDvv[] = 0) const;
/// \brief Evaluate basis functions for a varying value and
/// derivatives at a given (s,t) parametric location of a patch.
/// derivatives at a given (u,v) parametric location of a patch.
///
/// @param handle A patch handle indentifying the sub-patch containing the
/// (s,t) location
/// (u,v) location
///
/// @param s Patch coordinate (in coarse face normalized space)
/// @param u Patch coordinate (in base face normalized space)
///
/// @param t Patch coordinate (in coarse face normalized space)
/// @param v Patch coordinate (in base face normalized space)
///
/// @param wP Weights (evaluated basis functions) for the position
///
/// @param wDs Weights (evaluated basis functions) for derivative wrt s
/// @param wDu Weights (evaluated basis functions) for derivative wrt u
///
/// @param wDt Weights (evaluated basis functions) for derivative wrt t
/// @param wDv Weights (evaluated basis functions) for derivative wrt v
///
/// @param wDss Weights (evaluated basis functions) for derivative wrt ss
/// @param wDuu Weights (evaluated basis functions) for 2nd derivative wrt u
///
/// @param wDst Weights (evaluated basis functions) for derivative wrt st
/// @param wDuv Weights (evaluated basis functions) for 2nd derivative wrt u and v
///
/// @param wDtt Weights (evaluated basis functions) for derivative wrt tt
/// @param wDvv Weights (evaluated basis functions) for 2nd derivative wrt v
///
void EvaluateBasisVarying(PatchHandle const & handle, float s, float t,
float wP[], float wDs[] = 0, float wDt[] = 0,
float wDss[] = 0, float wDst[] = 0, float wDtt[] = 0) const;
void EvaluateBasisVarying(PatchHandle const & handle, float u, float v,
float wP[], float wDu[] = 0, float wDv[] = 0,
float wDuu[] = 0, float wDuv[] = 0, float wDvv[] = 0) const;
/// \brief Evaluate basis functions for a face-varying value and
/// derivatives at a given (s,t) parametric location of a patch.
/// derivatives at a given (u,v) parametric location of a patch.
///
/// @param handle A patch handle indentifying the sub-patch containing the
/// (s,t) location
/// (u,v) location
///
/// @param s Patch coordinate (in coarse face normalized space)
/// @param u Patch coordinate (in base face normalized space)
///
/// @param t Patch coordinate (in coarse face normalized space)
/// @param v Patch coordinate (in base face normalized space)
///
/// @param wP Weights (evaluated basis functions) for the position
///
/// @param wDs Weights (evaluated basis functions) for derivative wrt s
/// @param wDu Weights (evaluated basis functions) for derivative wrt u
///
/// @param wDt Weights (evaluated basis functions) for derivative wrt t
/// @param wDv Weights (evaluated basis functions) for derivative wrt v
///
/// @param wDss Weights (evaluated basis functions) for derivative wrt ss
/// @param wDuu Weights (evaluated basis functions) for 2nd derivative wrt u
///
/// @param wDst Weights (evaluated basis functions) for derivative wrt st
/// @param wDuv Weights (evaluated basis functions) for 2nd derivative wrt u and v
///
/// @param wDtt Weights (evaluated basis functions) for derivative wrt tt
/// @param wDvv Weights (evaluated basis functions) for 2nd derivative wrt v
///
/// @param channel face-varying channel
///
void EvaluateBasisFaceVarying(PatchHandle const & handle, float s, float t,
float wP[], float wDs[] = 0, float wDt[] = 0,
float wDss[] = 0, float wDst[] = 0, float wDtt[] = 0,
void EvaluateBasisFaceVarying(PatchHandle const & handle, float u, float v,
float wP[], float wDu[] = 0, float wDv[] = 0,
float wDuu[] = 0, float wDuv[] = 0, float wDvv[] = 0,
int channel = 0) const;
//@}

View File

@ -1272,7 +1272,7 @@ PatchTableFactory::populateAdaptivePatches(
for (int fvc=0; fvc<(int)context.fvarChannelIndices.size(); ++fvc) {
PatchDescriptor desc = table->GetFVarChannelPatchDescriptor(fvc);
PatchDescriptor desc = table->GetFVarPatchDescriptor(fvc);
Index pidx = table->getPatchIndex(arrayIndex, 0);
int ofs = pidx * desc.GetNumControlVertices();
@ -1461,7 +1461,7 @@ PatchTableFactory::populateAdaptivePatches(
BuilderContext::PatchTuple fvarPatch(patch);
PatchDescriptor desc = table->GetFVarChannelPatchDescriptor(fvc);
PatchDescriptor desc = table->GetFVarPatchDescriptor(fvc);
PatchParam fvarPatchParam = patchParam;

View File

@ -38,6 +38,8 @@ namespace Far {
class PtexIndices;
class TopologyRefiner;
/// \brief Factory for constructing a PatchTable from a TopologyRefiner
///
class PatchTableFactory {
public:

View File

@ -423,7 +423,7 @@ public:
/// @param end Index of last value to update
///
template <class T>
void Update2ndPartials(T const *controlValues, T *uuderivs, T *uvderivs, T *vvderivs,
void Update2ndDerivs(T const *controlValues, T *uuderivs, T *uvderivs, T *vvderivs,
int start=-1, int end=-1) const {
update(controlValues, uuderivs, _duuWeights, start, end);

View File

@ -38,10 +38,13 @@ namespace OPENSUBDIV_VERSION {
namespace Far {
///
/// \brief Descriptor for raw topology data, provided as a convenience with
/// a corresponding Factory. It should be functionally complete and simple
/// to use, but for more demanding situations, writing a custom Factory is
/// likely warranted.
/// \brief A simple reference to raw topology data for use with TopologyRefinerFactory
///
/// TopologyDescriptor is a simple struct containing references to raw topology data used
/// to construct a TopologyRefiner. It is not a requirement but a convenience for use
/// with TopologyRefinerFactory when mesh topology is not available in an existing mesh
/// data structure. It should be functionally complete and simple to use, but for more
/// demanding situations, writing a custom Factory is usually warranted.
///
struct TopologyDescriptor {

View File

@ -38,8 +38,10 @@ namespace OPENSUBDIV_VERSION {
namespace Far {
///
/// \brief TopologyLevel is an interface for accessing data in a specific level of a refined
/// topology hierarchy. Instances of TopologyLevel are created and owned by a TopologyRefiner,
/// \brief An interface for accessing data in a specific level of a refined topology hierarchy.
///
/// TopologyLevel provides an interface to data in a specific level of a topology hierarchy.
/// Instances of TopologyLevel are created and owned by a TopologyRefiner,
/// which will return const-references to them. Such references are only valid during the
/// lifetime of TopologyRefiner that created and returned them, and only for a given refinement,
/// i.e. if the TopologyRefiner is re-refined, any references to TopoologyLevels are invalidated.

View File

@ -63,7 +63,7 @@ public:
/// \brief Returns the subdivision options
Sdc::Options GetSchemeOptions() const { return _subdivOptions; }
/// \brief Returns true if uniform subdivision has been applied
/// \brief Returns true if uniform refinement has been applied
bool IsUniform() const { return _isUniform; }
/// \brief Returns the number of refinement levels
@ -75,7 +75,7 @@ public:
/// \brief Returns the maximum vertex valence in all levels
int GetMaxValence() const { return _maxValence; }
/// \ brief Returns true if faces have been tagged as holes
/// \brief Returns true if faces have been tagged as holes
bool HasHoles() const { return _hasHoles; }
/// \brief Returns the total number of vertices in all levels
@ -102,6 +102,18 @@ public:
//
/// \brief Uniform refinement options
///
/// Options for uniform refinement, including the number of levels, vertex
/// ordering and generation of topology information.
///
/// Note the impact of the option to generate fullTopologyInLastLevel. Given
/// subsequent levels of uniform refinement typically reguire 4x the data
/// of the previous level, only the minimum amount of data is generated in the
/// last level by default, i.e. a vertex and face-vertex list. If requiring
/// topology traversal of the last level, e.g. inspecting edges or incident
/// faces of vertices, the option to generate full topology in the last
/// level should be enabled.
///
struct UniformOptions {
UniformOptions(int level) :
@ -119,6 +131,12 @@ public:
/// \brief Refine the topology uniformly
///
/// This method applies uniform refinement to the level specified in the
/// given UniformOptions.
///
/// Note the impact of the UniformOption to generate fullTopologyInLastLevel
/// and be sure it is assigned to satisfy the needs of the resulting refinement.
///
/// @param options Options controlling uniform refinement
///
void RefineUniform(UniformOptions options);
@ -164,7 +182,7 @@ public:
/// \brief Returns the options specified on refinement
AdaptiveOptions GetAdaptiveOptions() const { return _adaptiveOptions; }
/// \brief Unrefine the topology (keep control cage)
/// \brief Unrefine the topology, keeping only the base level.
void Unrefine();
@ -175,7 +193,7 @@ public:
/// \brief Returns the number of face-varying channels in the tables
int GetNumFVarChannels() const;
/// \brief Returns the face-varying interpolation rule-set for a given channel
/// \brief Returns the face-varying interpolation rule set for a given channel
Sdc::Options::FVarLinearInterpolation GetFVarLinearInterpolation(int channel = 0) const;
/// \brief Returns the total number of face-varying values in all levels

View File

@ -79,6 +79,9 @@ public:
/// Returns the CL memory of the varying control vertices
cl_mem GetVaryingPatchIndexBuffer() const { return _varyingIndexBuffer; }
/// Returns the number of face-varying channel buffers
int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
/// Returns the CL memory of the array of Osd::PatchArray buffer
cl_mem GetFVarPatchArrayBuffer(int fvarChannel = 0) const { return _fvarPatchArrays[fvarChannel]; }

View File

@ -57,7 +57,7 @@ CpuPatchTable::CpuPatchTable(const Far::PatchTable *farPatchTable) {
for (int fvc=0; fvc<farPatchTable->GetNumFVarChannels(); ++fvc) {
_fvarPatchArrays[fvc].reserve(nPatchArrays);
_fvarIndexBuffers[fvc].reserve(
numPatches*farPatchTable->GetFVarChannelPatchDescriptor(fvc).GetNumControlVertices());
numPatches*farPatchTable->GetFVarPatchDescriptor(fvc).GetNumControlVertices());
_fvarParamBuffers[fvc].reserve(numPatches);
}
_patchParamBuffer.reserve(numPatches);
@ -86,7 +86,7 @@ CpuPatchTable::CpuPatchTable(const Far::PatchTable *farPatchTable) {
// face-varying
for (int fvc=0; fvc<farPatchTable->GetNumFVarChannels(); ++fvc) {
PatchArray fvarPatchArray(
farPatchTable->GetFVarChannelPatchDescriptor(fvc), numPatches, 0, 0);
farPatchTable->GetFVarPatchDescriptor(fvc), numPatches, 0, 0);
_fvarPatchArrays[fvc].push_back(fvarPatchArray);
Far::ConstIndexArray

View File

@ -74,6 +74,9 @@ public:
return _varyingIndexBuffer;
}
/// Returns the number of face-varying channels buffers
int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
/// Returns the cuda memory of the array of Osd::PatchArray buffer
void *GetFVarPatchArrayBuffer(int fvarChannel) const {
return _fvarPatchArrays[fvarChannel];

View File

@ -51,6 +51,7 @@ public:
static GLPatchTable *Create(Far::PatchTable const *farPatchTable,
void *deviceContext = NULL);
/// Returns the patch arrays for vertex index buffer data
PatchArrayVector const &GetPatchArrays() const {
return _patchArrays;
}
@ -75,6 +76,7 @@ public:
return _patchParamTexture;
}
/// Returns the patch arrays for varying index buffer data
PatchArrayVector const &GetVaryingPatchArrays() const {
return _varyingPatchArrays;
}
@ -89,20 +91,30 @@ public:
return _varyingIndexTexture;
}
/// Returns the number of face-varying channel buffers
int GetNumFVarChannels() const { return (int)_fvarPatchArrays.size(); }
/// Returns the patch arrays for face-varying index buffer data
PatchArrayVector const &GetFVarPatchArrays(int fvarChannel = 0) const {
return _fvarPatchArrays[fvarChannel];
}
/// Returns the GL texture buffer containing the face-varying control vertices
/// Returns the GL index buffer containing face-varying control vertices
GLuint GetFVarPatchIndexBuffer(int fvarChannel = 0) const {
return _fvarIndexBuffers[fvarChannel];
}
/// Returns the GL texture buffer containing face-varying control vertices
GLuint GetFVarPatchIndexTextureBuffer(int fvarChannel = 0) const {
return _fvarIndexTextures[fvarChannel];
}
/// Returns the GL index buffer containing face-varying patch params
GLuint GetFVarPatchParamBuffer(int fvarChannel = 0) const {
return _fvarParamBuffers[fvarChannel];
}
/// Returns the GL texture buffer containing face-varying patch params
GLuint GetFVarPatchParamTextureBuffer(int fvarChannel = 0) const {
return _fvarParamTextures[fvarChannel];
}

View File

@ -187,6 +187,11 @@ ivec2 OsdGetPatchFaceUV(ivec3 patchParam)
return ivec2(u,v);
}
bool OsdGetPatchIsRegular(ivec3 patchParam)
{
return ((patchParam.y >> 5) & 0x1) != 0;
}
float OsdGetPatchSharpness(ivec3 patchParam)
{
return intBitsToFloat(patchParam.z);

View File

@ -162,6 +162,11 @@ int2 OsdGetPatchFaceUV(int3 patchParam)
return int2(u,v);
}
bool OsdGetPatchIsRegular(int3 patchParam)
{
return ((patchParam.y >> 5) & 0x1) != 0;
}
float OsdGetPatchSharpness(int3 patchParam)
{
return asfloat(patchParam.z);

View File

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