mcpField
T
texture-driven-mesh-fitting

texture-driven-mesh-fitting

github.com/roble3Creative & media128782 installsUpdated 2w ago
Repository

About texture-driven-mesh-fitting

texture-driven-mesh-fitting is a skill for fitting a mesh to the source contour when a correctly mapped texture still has the wrong silhouette. It prioritizes geometry deformation and UV preservation before look development.

Key features

  1. 01Extract source and mesh contours
  2. 02Match contours by landmarks or arc length
  3. 03Deform boundary and interior vertices
  4. 04Preserve UV mapping to atlas regions
  5. 05Validate fit with overlays and tolerance checks

Use cases

  1. 01Fixing a mesh silhouette beneath a mapped texture
  2. 02Fitting part geometry to a source mask
  3. 03Checking atlas bleed in a front-view render

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/roble3/cc-blender-skill --skill texture-driven-mesh-fitting

After installing, type/texture-driven-mesh-fittingin Claude Code to confirm it loaded.

Bundled filesscripts/contour_correspondence_report.py

Details

From the project README

Texture-Driven Mesh Fitting

This skill fixes the common failure: a texture is mapped correctly, but the mesh silhouette underneath is wrong. The mesh adapts to the source contour; the texture is not stretched to hide a wrong mesh.

Preconditions

  • Structural parts are segmented (source-part-segmentation).
  • Each part has a contour/mask and, if textured, an atlas region (atlas-uv-fitting).
  • The object is source-locked in front X/Z before depth is added.
  • Canonical view policy is resolved (multiview-constraint-solver) if views conflict.

Workflow

  1. Extract source contour from the texture/wireframe region.
  2. Extract current mesh boundary in the same projected coordinate space.
  3. Build ordered contour correspondence by arc length, named landmarks, or seam/control points.
  4. Move boundary vertices to source contour positions.
  5. Move interior vertices by smooth interpolation, piecewise-affine warp, or thin-plate-spline style deformation.
  6. Preserve UV parameterization by remapping boundary-fitted local coordinates into the atlas rectangle.
  7. Re-render overlay; do not proceed to look-dev until texture-region silhouette passes.

Acceptance gates

  • Per-part source/product bbox center and size within tolerance.
  • Boundary maximum sample error below tolerance after normalization.
  • Texture atlas region does not visibly bleed outside the fitted mesh in front view.
  • Named landmarks (leaf_tip, base_left, base_right, face_corner, etc.) pass landmark-fit-repair.

Hard rules

  • If a texture crop has a different silhouette than the mesh, reshape the mesh first.
  • Do not use global UV stretching to hide geometry mismatch.
  • Boundary fitting must happen before side-depth/crown deformation.
  • Do not tune material/light to compensate for geometry/UV misfit.

Scripts

  • scripts/contour_correspondence_report.py reports bbox, centroid, and sampled contour deltas between a source mask and a render/object mask.

Sources distilled

  • Piecewise-affine/landmark warping gives a practical mesh deformation model.
  • Thin-plate-spline style deformation is appropriate for smooth mascot/logo surfaces when landmarks are sparse.
  • Blender mesh vertices/UV layers can be edited directly; BMesh is useful for cleanup after deformation.

Comments

Markdown supported