Skip to content

Handle polygon fields in mesh subset operations#1068

Open
cdtwigg wants to merge 3 commits intomainfrom
export-D94579400
Open

Handle polygon fields in mesh subset operations#1068
cdtwigg wants to merge 3 commits intomainfrom
export-D94579400

Conversation

@cdtwigg
Copy link
Contributor

@cdtwigg cdtwigg commented Feb 27, 2026

Summary:
reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Differential Revision: D94579400

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 27, 2026
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Feb 27, 2026

@cdtwigg has exported this pull request. If you are a Meta employee, you can view the originating Diff in D94579400.

meta-codesync bot pushed a commit that referenced this pull request Mar 3, 2026
Summary:

reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Reviewed By: fbogo

Differential Revision: D94579400
@meta-codesync meta-codesync bot force-pushed the export-D94579400 branch from e941b92 to 46bdae0 Compare March 3, 2026 23:43
meta-codesync bot pushed a commit that referenced this pull request Mar 3, 2026
Summary:

reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Reviewed By: fbogo

Differential Revision: D94579400
@meta-codesync meta-codesync bot force-pushed the export-D94579400 branch from 46bdae0 to 4787a76 Compare March 3, 2026 23:43
cdtwigg added a commit that referenced this pull request Mar 3, 2026
Summary:
Pull Request resolved: #1068

reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Reviewed By: fbogo

Differential Revision: D94579400
@cdtwigg cdtwigg force-pushed the export-D94579400 branch from 4787a76 to 872384c Compare March 3, 2026 23:46
meta-codesync bot pushed a commit that referenced this pull request Mar 3, 2026
Summary:

reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Reviewed By: fbogo

Differential Revision: D94579400
@meta-codesync meta-codesync bot force-pushed the export-D94579400 branch from 872384c to 58d1584 Compare March 3, 2026 23:54
meta-codesync bot pushed a commit that referenced this pull request Mar 4, 2026
Summary:

reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Reviewed By: fbogo

Differential Revision: D94579400
@meta-codesync meta-codesync bot force-pushed the export-D94579400 branch from 58d1584 to 9de545e Compare March 4, 2026 06:11
cdtwigg added a commit that referenced this pull request Mar 4, 2026
Summary:
Pull Request resolved: #1068

reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Reviewed By: fbogo

Differential Revision: D94579400
@cdtwigg cdtwigg force-pushed the export-D94579400 branch from 9de545e to aadce7a Compare March 4, 2026 19:41
cdtwigg added a commit that referenced this pull request Mar 4, 2026
Summary:
Pull Request resolved: #1068

reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Reviewed By: fbogo

Differential Revision: D94579400
@cdtwigg cdtwigg force-pushed the export-D94579400 branch from aadce7a to ffc1f2a Compare March 4, 2026 20:02
cdtwigg added 3 commits March 4, 2026 14:17
Summary:

MeshT currently only stores triangle faces (std::vector<Eigen::Vector3i> faces).
Characters can have arbitrary polygon topology (quads, n-gons) which is lost
during FBX loading when polygons are fan-triangulated. This adds a redundant
polygon representation alongside the existing triangle faces so that polygon
topology can be preserved. The existing faces field stays unchanged and all
downstream code continues to work.

Three new fields are added to MeshT:
- polyFaces: packed polygon vertex indices (all polygons concatenated)
- polyFaceSizes: number of vertices per polygon face
- polyTexcoordFaces: packed polygon texcoord indices (shares polyFaceSizes)

Also updates cast()/reset(), adds tests, updates compareMeshes(), adds Python
bindings with validation, and regenerates .pyi stubs.

Reviewed By: nickyhe-gemini

Differential Revision: D94577296
Summary:

Wire up the polyFaces, polyFaceSizes, and polyTexcoordFaces fields added
in the previous diff so they are populated during FBX load and written
during FBX save.

Load: copy raw polygon topology from PolygonData into the new mesh fields
alongside the existing triangulation.

Save: when polygon data is available, write actual polygons (quads, n-gons)
instead of only triangles; fall back to triangulated faces otherwise.

Reviewed By: nickyhe-gemini

Differential Revision: D94577295
Summary:

reduceMeshInternal (used by reduceMeshByFaces, reduceMeshByVertices, and
reduceMeshComponents) didn't handle the polyFaces/polyFaceSizes/polyTexcoordFaces
fields. After a mesh subset operation, the polygon data would be stale.

Add remapPolyFaces helper to filter and remap polygon data during mesh reduction,
using the same active-vertex logic as triangulated faces. Also add verticesToPolys,
polysToVertices conversion functions and reduceMeshByPolys for selecting mesh
subsets by polygon.

Reviewed By: fbogo

Differential Revision: D94579400
@meta-codesync meta-codesync bot force-pushed the export-D94579400 branch from ffc1f2a to fbbb3cc Compare March 4, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant