Access to source points associated with irregular patches in a Catmull-Clark subdivided mesh

33 views
Skip to first unread message

Pieter Barendrecht

unread,
Sep 20, 2023, 10:08:39 AM9/20/23
to OpenSubdiv Forum
Hi all,

Given an irregular patch (associated with an interior quad containing a single EV) in a Catmull-Clark subdivided mesh, I'm looking for a way to access the 15 source points associated with it. For a visual explanation, see the points P0*, P1, ..., P15 (without P5) as indicated in https://github.com/PixarAnimationStudios/OpenSubdiv/blob/release/opensubdiv/far/catmarkPatchBuilder.cpp#L1596 (see also https://github.com/PixarAnimationStudios/OpenSubdiv/blob/release/opensubdiv/far/patchBuilder.cpp#L1407).

Normally, these source points (and possibly others) are used to compute the derived points that define a Gregory patch (8 unique per patch + 12 shared among Gregory patches), a bicubic B-spline patch (7 unique per patch) or a bilinear patch (4 shared among bilinear patches) which is used to locally approximate the Catmull-Clark limit surface.

Now, these derived points are computed by invoking ComputeLocalPointValues(...) on an instance of PatchTable. Next, looping over the patches in the relevant PatchArray, the indices of these derived points can be obtained through GetPatchVertices(...). Looking at the documentation of PatchTable (see https://graphics.pixar.com/opensubdiv/docs/doxy_html/a00993.html), I don't see a direct way to request the indices of the source points instead, though perhaps something can be done using GetLocalPointStencilTable(...)?

Best,
Pieter


David G Yu

unread,
Sep 20, 2023, 12:42:08 PM9/20/23
to OpenSubdiv Forum
Hi,

The recommended and also most straightforward way to obtain that information is to use the OpenSubdiv::Bfr API.

Depending on what you are trying to achieve you may be able to avoid dealing with patch tables entirely and just use Bfr, but even if you need to continue to use patch tables for some other reason you can still use Bfr to efficiently inspect the subdivision surface for any given base face of your mesh topology.

Thanks!
-David



Pieter Barendrecht

unread,
Sep 25, 2023, 9:31:31 AM9/25/23
to David G Yu, OpenSubdiv Forum
Hi David,

Thanks for your reply!

Using Bfr::RefinerSurfaceFactory I can now loop over the faces (and corresponding patches) of the original mesh. However, how do I give Bfr::RefinerSurfaceFactory access to the adaptively subdivided mesh? I'm using a setup similar to the Far Tutorial 1.1, i.e. using a Far::TopologyDescriptor and a Far::TopologyRefiner (though using RefineAdaptive(...) rather than RefineUniform(...)). Using GetLevel(...) on the Far::TopologyRefiner, I can get access to the relevant Far::TopologyLevel, but I don't see how to feed that to Bfr::RefinerSurfaceFactory.

Best,
Pieter


--
You received this message because you are subscribed to the Google Groups "OpenSubdiv Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opensubdiv+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opensubdiv/f1740b9d-88e8-4c06-ae5c-ce630b25d75en%40googlegroups.com.

Barry F

unread,
Oct 6, 2023, 7:19:39 PM10/6/23
to OpenSubdiv Forum
If you want to inspect intermediate levels of refinement or other details about individual patches, then the Bfr interface is not a good choice for your task. Bfr does not apply adaptive refinement the same way as Far and there is nothing in a Bfr::Surface that can be inspected to provide information about intermediate levels. So you are better off working with the PatchTable and the TopologyRefiner as originally posed.

It appears the recommendation of Bfr above assumed that the "source points" you are referring to are the original control points of the mesh. But on rereading your request, it sounds like you want the source points for individual patches of the PatchTable at the same level of refinement.

The set of source points (a subset of the refined points) that contribute to the control points of a patch are not stored explicitly in the PatchTable, so there is no way to retrieve it directly.

You are correct in that you can determine the set of source points by inspecting the local point StencilTable. For each control point of a patch, its entry in the local point StencilTable identifies the source points from which it was derived. So you can gather the entire set of source points for the patch by inspecting stencils for all control points of the patch. But that will include the P5 neighborhood (from the diagram you cite) and you will not get any ordering information from the stencils.

There are other possibilities, but they are far more convoluted, so I am reluctant to suggest them at this point.
Reply all
Reply to author
Forward
0 new messages