Several of the methods in osd/patchBasisCommon.h were
never intended as public API, and several have been
deprecated in favor of the newer OsdEvaluatePatchBasis()
and OsdEvaluatePatchBasisNormalized() methods. These
obsolete methods have now all be marked as deprecated.
Also, fixed a minor spelling typo in glslPatchBasisCommon.glsl
Updated the Gregory patch tessellation shaders to account for
transition edges.
Changed the implementation of OsdGetTessParameterizationTriangle()
to take the input parametric location as a 3-component value. This
allows the edge parameterization to be more numerically robust and
consistent.
Also, corrected some minor discrepancies between the various
tessellation shader configurations.
- changed Far::PatchDescriptor size for GREGORY_TRIANGLE to 18
- modified Far::LoopPatchBuilder to construct full quartic Gregory patch
- fixed Far::LoopPatchBuilder bug related to face points near boundaries
- updated Far patch basis evaluation for Gregory and Bezier triangles
- updated Osd patch basis evaluation to match Far
- updated Osd GLSL patch size for Gregory triangle to 18
- modified Osd GLSL Gregory triangle eval and tess settings for quartic
- updated sizes for the Box-spline triangle shader to generate 15 points
- updated conversion of Box-spline from hybrid Bezier to fully quartic
- added resolution of degenerate normal to Bezier triangle evaluation
- updated hybrid Gregory triangle conversion to quartic Bezier
- updated adaptive tessellation of Bezier triangle for quartic boundaries
- Added GLSL patch shaders for BoxSplineTriangle and GregoryTriangle
patches. These both convert to a hybrid Bezier patch for drawing
similar to the basis conversion done for quad patches.
- Added evaluation of hybrid Bezier triangle patches and
GregoryTriangle patches to the common shader source.
- Added OsdGetPatchIsTriangleRotated() to detect rotated triangles.
- Added OsdInterpolatePatchCoordTriangle() for eval of triangle patches.
- Added boundary point extrapolation for BoxSplineTriangle patches.
- Fixed boundary point extrapolation for unisolated BSpline patches.
- Added tess factor and tess evaluation location computation for
triangle patches.
- Limit surface edge mid points for both quad and triangle patches
are now computed directly.
Moved shader code used for evaluation of legacy gregory patches
to a separate source file along with macros which implement
simple linear face-varying interpolation.
These should not be used for new development, but are provided
for backward compatibility.
- modified Gregory patch shader to use existing Bezier patch evaluation
- rewrote Bezier patch evaluation to use intermediate bilinear points
- added detection and resolution of degenerate normal
- eval normal partials no longer uses Weingarten eqns (requires N != 0)
- updated normal partials to use differentiation/projection
This change make the bspline patch tess control/hull shader revert to
control vertex mirroring for boundary edges when the patch sharpness is
zero. This change helps improve some shader codegen optimization and
L1 cache behavior on (at least) Kepler GPUs with recent drivers.
Re-organized the single-crease patch code path in the tessellation
control/hull shaders to improve performance in the case where no patches
have non-zero crease sharpnesses.
Changed a couple of local 4x4 matrices to global uniforms to
work around a performance problem on recent GL drivers.
There are two local 4x4 float matrices with constant initializers
in the function OsdComputePerPatchVertexBSpline(...). Changing
these from local variables to global initialized uniforms improves
performance dramatically on recent NVIDIA drivers (e.g. 361.48 windows).
There is no such difference with Direct3D, but this change updates
the shader code for both implementations for consistency.
For now, the common patch shader code supports fractional spacing
modes only when screen-space tessellation is also enabled.
It's possible to relax this restriction, but that requires changing
the client shader interface.
This change includes support for both fractional_even_spacing
and fractional_odd_spacing.
The implementation follows the existing pattern of re-parameterizing
the tessellation domain only along transition boundary edges. This
allows for crack-free tessellation, but it might be better to
consistently re-parameterize all of the outer edges of all patches,
which also would be required for numerically watertight tessellation.
This is implemented in a way that requires no changes to the client
shader API. It should be more efficient to move some computations to
the control/hull shaders and reduce divergence in the execution of
eval/domain shaders.
This change restores the use of 4-bits in Far::PatchParam to
encode the refinement level of a patch. This restores one bit
that was stolen to allow for more general encoding of boundary
edge and transition edge masks. In order to accommodate all
of the bits that are required, the transition edge mask bits
are now stored along with the faceId bits.
Also, accessors are now exposed directly as members of Far::PatchParam
and the internal bitfield class is no longer directly exposed.
Unified transition patch drawing affects the calculation of
tessellation level metrics. Because a single edge of a shader
patch might be split into two halfs along a transition edge,
the effective maximum number of spans along any adaptive edge
is limited to half of the device maximum.
Besides we've not been computing accurate derivatives on gregory patch,
there was a separate bug in shaders which gives completely bogus dUdV on
corner vertices. This change fixes that significant artifact, however,
is still approximating derivatives by ignoring rational components.
- add HLSL equivalents of the previous GLSL change
- rename OsdGetSingleCreaseSegmentParameter to
OsdGetPatchSingleCreaseSegmentParameter.
- add shadingMode UI for dxViewer similar to glViewer
use boundaryMask to identify the crease edge from 4 edges.
with this change, single-crease patch no longer needs to be rotated on
its population.
In shader, experimentally use same infinite sharp matrix for both
boundary and single-crease patch.
This change refactors the GLSL and HLSL patch shader code so that
most of the work is implemented within a library of common functions
and the remaining shader snippets just manage plumbing.
There is more to do here:
- varying and face-varying data can be managed entirely by the client
- similarly, displacement can be implemented in client code
- there's still quite a bit of residual boiler-plate code needed
in each shader stage that we should be able to wrap up in a more
convenient form.
Cleaned up the Legacy Gregory shader source by accessing buffer
data through helper functions.
Switched to performing tessellation in untransformed (object) space.
Each patch has a corresponding patchParam. This is a set of three values
specifying additional information about the patch:
faceId -- topological face identifier (e.g. Ptex FaceId)
bitfield -- refinement-level, non-quad, boundary, transition, uv-offset
sharpness -- crease sharpness for a single-crease patch
These are stored in OsdPatchParamBuffer indexed by the value returned
from OsdGetPatchIndex() which is a function of the current PrimitiveID
along with an optional client provided offset.
Accessors are provided to extract values from a patchParam. These are
all named OsdGetPatch*().
While drawing patches, the patchParam is condensed into a patchCoord which
has four values (u, v, faceLevel, faceId). These patchCoords are treated
as int values during per-prim processing but are converted to float values
during per-vertex processing where the values are interpolated.
Also, cleaned up more of the shader namespace by giving an Osd prefix
to public functions, and consolidated boundary and transition handling
code into the PatchCommon shader files. The functions determining
tessellation levels are now all named OsdGetTessLevel*().
computes edge lengths using limit surface points. Made this
the default screen-space metric so that we avoid cracks when
using Gregory Basis or Regular B-spline end caps.
The alternative method which computes edge lengths using the
distance between B-spline control points is still available.
Added a diagram and comments to explain how the control
points and limit points are organized.
PatchTablesFactory fills 20 indices topology into patchtable, and use it for eval and draw.
note: currently screen-space adaptive tessellation of gregory basis patches is
broken and cracks appear around them.
Catmull-Clark Subdivision Surfaces", Niessner et al, Eurographics 2012.
This change includes;
-topology identification for single-crease patch during adaptive refinement.
-patch array population (similar to boundary)
-sharpness buffer generation
-glsl shader
Eval stuffs will be coming.
All kernels take offset/length/stride to apply subdivision partially in each vertex elements.
Also the offset can be used for client-based VBO aggregation, without modifying index buffers.
This is useful for topology sharing, in conjunction with glDrawElementsBaseVertex etc.
However, gregory patch shader fetches vertex buffer via texture buffer, which index should also
be offsetted too. Although gl_BaseVertexARB extension should be able to do that job, it's a
relatively new extension. So we use OsdBaseVertex() call to mitigate the compatibility
issue as clients can provide it in their way at least for the time being.
Important notice: all client shader code must have following functions and compose them to osd intrinsic shaders (vertex/tessEval/tessControl)
mat4 OsdModelViewMatrix()
mat4 OsdProjectionMatrix()
mat4 OsdModelViewProjectionMatrix()
float OsdTessLevel()
int OsdGreogryQuadOffsetBase()
int OsdPrimitiveIdBase()
We probably should write a utility class for basic binding of them, to make client code simpler.
New text:
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.