|
void | Set (Index faceid, short u, short v, unsigned short depth, bool nonquad, unsigned short boundary, unsigned short transition, bool regular=false) |
| Sets the values of the bit fields. More...
|
|
void | Clear () |
| Resets everything to 0. More...
|
|
Index | GetFaceId () const |
| Returns the faceid. More...
|
|
unsigned short | GetU () const |
| Returns the log2 value of the u parameter at the first corner of the patch. More...
|
|
unsigned short | GetV () const |
| Returns the log2 value of the v parameter at the first corner of the patch. More...
|
|
unsigned short | GetTransition () const |
| Returns the transition edge encoding for the patch. More...
|
|
unsigned short | GetBoundary () const |
| Returns the boundary edge encoding for the patch. More...
|
|
bool | NonQuadRoot () const |
| True if the parent base face is a non-quad. More...
|
|
unsigned short | GetDepth () const |
| Returns the level of subdivision of the patch. More...
|
|
float | GetParamFraction () const |
| Returns the fraction of unit parametric space covered by this face. More...
|
|
template<typename REAL > |
void | Normalize (REAL &u, REAL &v) const |
| A (u,v) pair in the fraction of parametric space covered by this face is mapped into a normalized parametric space. More...
|
|
template<typename REAL > |
void | Unnormalize (REAL &u, REAL &v) const |
| A (u,v) pair in a normalized parametric space is mapped back into the fraction of parametric space covered by this face. More...
|
|
bool | IsTriangleRotated () const |
| Returns if a triangular patch is parametrically rotated 180 degrees. More...
|
|
bool | IsRegular () const |
| Returns whether the patch is regular. More...
|
|
Patch parameterization.
Topological refinement splits coarse mesh faces into refined faces.
This patch parameterzation describes the relationship between one of these refined faces and its corresponding coarse face. It is used both for refined faces that are represented as full limit surface parametric patches as well as for refined faces represented as simple triangles or quads. This parameterization is needed to interpolate primvar data across a refined face.
The U,V and refinement level parameters describe the scale and offset needed to map a location on the patch between levels of refinement. The encoding of these values exploits the quad-tree organization of the faces produced by subdivision. We encode the U,V origin of the patch using two 10-bit integer values and the refinement level as a 4-bit integer. This is sufficient to represent up through 10 levels of refinement.
Special consideration must be given to the refined faces resulting from irregular coarse faces. We adopt a convention similar to Ptex texture mapping and define the parameterization for these faces in terms of the regular faces resulting from the first topological splitting of the irregular coarse face.
When computing the basis functions needed to evaluate the limit surface parametric patch representing a refined face, we also need to know which edges of the patch are interpolated boundaries. These edges are encoded as a boundary bitmask identifying the boundary edges of the patch in sequential order starting from the first vertex of the refined face.
A sparse topological refinement (like feature adaptive refinement) can produce refined faces that are adjacent to faces at the next level of subdivision. We identify these transitional edges with a transition bitmask using the same encoding as the boundary bitmask.
For triangular subdivision schemes we specify the parameterization using a similar method. Alternate triangles at a given level of refinement are parameterized from their opposite corners and encoded as occupying the opposite diagonal of the quad-tree hierarchy. The third barycentric coordinate is dependent on and can be derived from the other two coordinates. This encoding also takes inspiration from the Ptex texture mapping specification.
Bitfield layout :
Field0 | Bits | Content |
faceId | 28 | the faceId of the patch |
transition | 4 | transition edge mask encoding |
Field1 | Bits | Content |
level | 4 | the subdivision level of the patch |
nonquad | 1 | whether patch is refined from a non-quad face |
regular | 1 | whether patch is regular |
unused | 1 | unused |
boundary | 5 | boundary edge mask encoding |
v | 10 | log2 value of u parameter at first patch corner |
u | 10 | log2 value of v parameter at first patch corner |
Note : the bitfield is not expanded in the struct due to differences in how GPU & CPU compilers pack bit-fields and endian-ness.
Quad Patch Parameterization
(0,1) (1,1)
+-------+-------+---------------+
| | | |
| L2 | L2 | |
|0,3 |1,3 | |
+-------+-------+ L1 |
| | | |
| L2 | L2 | |
|0,2 |1,2 |1,1 |
+-------+-------+---------------+
| | |
| | |
| | |
| L1 | L1 |
| | |
| | |
|0,0 |1,0 |
+---------------+---------------+
(0,0) (1,0)
Triangle Patch Parameterization
(0,1) (1,1) (0,1,0)
+-------+-------+---------------+ +
| \ | \ | \ | | \
|L2 \ |L2 \ | \ | | \
|0,3 \ |1,3 \ | \ | | L2 \
+-------+-------+ \ | +-------+
| \ | \ | L1 \ | | \ L2 | \
|L2 \ |L2 \ | \ | | \ | \
|0,2 \ |1,2 \ |1,1 \ | | L2 \ | L2 \
+-------+-------+---------------+ +-------+-------+
| \ | \ | | \ | \
| \ | \ | | \ | \
| \ | \ | | \ L1 | \
| \ | \ | | \ | \
| L1 \ | L1 \ | | L1 \ | L1 \
| \ | \ | | \ | \
|0,0 \ |1,0 \ | | \ | \
+---------------+---------------+ +---------------+---------------+
(0,0) (1,0) (0,0,1) (1,0,0)