Skip to main content
skill CX Codex

source-part-segmentation — Claude Code skill: part masks from source

Splits overlapping parts of a source image into named masks before any contour-to-mesh work starts.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add RobLe3/cc-blender-skill --skill source-part-segmentation -a claude-code
Open on GitHub

What source-part-segmentation does

The skill sits one step ahead of contour-to-mesh, for mascots, logos and templates whose designed parts touch or overlap. It picks the cleanest modality first — alpha, edge, dark-line, bright-on-dark, color-band or an atlas region — then extracts contours and hierarchy to find candidate objects, holes, nested details and strokes.

When components touch, marker watershed on the distance transform runs first. If that over- or under-splits, seeded segmentation takes over: you describe named parts as bbox, polygon or seed_point with an optional HSV tolerance, and scripts/seeded_part_masks.py turns the manifest into deterministic named masks plus a part inventory. Every mask gets a class — structural, decorative, face_feature, aura_context or validation_only — and structural ones go to contour-to-mesh, feature masks to landmark-fit-repair, atlas regions to atlas-uv-fitting.

Before the first Blender call the skill tells you to read ../text-to-blender/references/mcp-backends.md and to keep the chosen backend for the whole task. Worth checking that your Blender MCP backend is already wired up, otherwise the segmentation step ends as a folder of masks. Symmetry is deliberately ignored: repeated parts are not inferred, only what the source actually shows gets segmented.

What it helps with

  • split touching mascot parts into separate masks
  • isolate structural parts from a texture atlas
  • flag ambiguous overlaps instead of merging them
  • get a part inventory with an expected count before meshing
  • keep wireframe strokes apart from filled regions

Example prompts for the agent

  • Segment this logo into structural parts and save one mask per part
  • The components touch — run watershed first, then fall back to seeds from the manifest
  • Build a part inventory from the atlas and mark the ambiguous overlaps

How to install source-part-segmentation

1Skills CLI (Vercel)

npx skills add RobLe3/cc-blender-skill --skill source-part-segmentation -a claude-code

2Manually: put the files in place

~/.claude/skills/source-part-segmentation/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/source-part-segmentation/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about source-part-segmentation

How do I install source-part-segmentation in Claude?

Run npx skills add RobLe3/cc-blender-skill --skill source-part-segmentation -a claude-code. The skill lands at ~/.claude/skills/source-part-segmentation/SKILL.md.

What does source-part-segmentation do?

It segments overlapping and touching parts of a source image into named masks and classifies each one by role. Structural masks feed contour-to-mesh, feature masks go to landmark-fit-repair, atlas regions to atlas-uv-fitting.

What does the skill need to run?

Before the first Blender call it asks you to read ../text-to-blender/references/mcp-backends.md and to keep the selected backend for the whole task. Its allowed tools are Read, Bash, Glob and Grep.

Source text

SKILL.md · MIT
---
name: source-part-segmentation
description: Segment overlapping visual parts from source images, wireframes, texture atlases, and decals before mesh reconstruction. Use when a mascot/logo/template contains touching or overlapping components and exact structural part masks are needed before contour-to-mesh, UV fitting, or landmark repair.
allowed-tools: Read Bash Glob Grep
---


## MCP backend

Use when: Overlapping part extraction, component masks, marker/watershed segmentation, contour hierarchy analysis, atlas part isolation, manual seed fallback for source-locked Blender reconstruction.

Before the first Blender call, read [../text-to-blender/references/mcp-backends.md](../text-to-blender/references/mcp-backends.md). Prefer official MCP for shared capabilities; preserve the selected backend for the whole task. Tool names in recipes are client/legacy examples: map them through that reference and its agent-host guide.
# Source Part Segmentation

Use this before `contour-to-mesh` when a source image contains overlapping or touching designed parts.
The output is not “nice masks”; it is a **source-of-truth part inventory** that downstream geometry must obey.

## Inputs

- source image, wireframe, decal, or texture atlas;
- optional manual seed manifest with named parts, polygons, seed points, rough rectangles, or HSV/color ranges;
- source manifest with structural/decorative/context classification and expected part count.

## Workflow

1. Choose the cleanest modality: alpha, edge, dark-line, bright-on-dark, color-band, or atlas region.
2. Extract contours and hierarchy to identify candidate objects, holes, nested details, and strokes.
3. If components touch, run distance-transform marker watershed first.
4. If watershed over/under-splits, switch to **seeded segmentation**:
   - create named part seeds (`bbox`, `polygon`, or `seed_point` + optional flood/HSV tolerance);
   - save one mask per named structural part;
   - mark ambiguous overlaps explicitly instead of merging them.
5. Classify masks as `structural`, `decorative`, `face_feature`, `aura_context`, or `validation_only`.
6. Pass structural masks to `contour-to-mesh`; pass feature masks/landmarks to `landmark-fit-repair`; pass atlas regions to `atlas-uv-fitting`.

## Hard rules

- Do not infer repeated parts from symmetry; segment what the source shows.
- Do not merge overlapping components if the manifest expects separate structural meshes.
- Do not proceed to final modeling when part count differs between source images; write a conflict report or canonical policy.
- If automatic segmentation is ambiguous, write an ambiguity report and require or create manual seed rectangles/points.
- Keep stroke/line masks separate from filled-part masks; wireframe strokes are guides unless explicitly used as the contour boundary.

## Seed manifest schema

```json
{
  "schema": "source_part_seed_manifest.v1",
  "image": "path/to/source.png",
  "parts": [
    {"name":"leaf_top", "class":"structural", "bbox":[x,y,w,h], "mode":"non_background"},
    {"name":"face_shell", "class":"structural", "polygon":[[x,y],[x,y],...], "mode":"polygon"}
  ]
}
```

Allowed `mode` values: `polygon`, `bbox`, `non_background`, `dark_lines`, `bright_on_dark`, `hsv_range`.

## Scripts

- `scripts/segment_source_parts.py` produces component masks and a JSON report from an image, with optional watershed.
- `scripts/seeded_part_masks.py` converts a named seed manifest into deterministic named masks and a part inventory.

## Sources distilled

- OpenCV contours/hierarchy/moments are the base measurement layer.
- OpenCV distance transform + marker watershed is the first automated split method for touching components.
- Active contour refinement can improve a rough mask boundary after segmentation.

© RobLe3 · MIT · RobLe3/cc-blender-skill

Similar skills

Everything for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set28

atlas-uv-fitting Detects texture atlas regions and fits each model part to its own UV rectangle in Blender. Helpful for fixing stretched textures and preparing clean GLB exports. CX Codex +1 744installs fit-repair-optimizer Converts Blender multiview validation failures into a structured repair queue against source templates. It coordinates geometry, UV, and lighting fixes. CX Codex +1 735installs closed-surface-uv-coverage Audit Blender models to ensure rear caps and sidewalls have true UV coverage instead of floating overlays. Ideal for turntable QA on 3D assets. CX Codex +1 728installs multiview-constraint-solver Checks whether front, side, back and top orthographic references can fit one rigid Blender model, then picks a canonical source policy before you rebuild. CX Codex +1 737installs texture-driven-mesh-fitting Reshapes 3D mesh boundaries to match texture-atlas or decal silhouettes 1:1 in Blender before material passes. Essential when models do not match their source art. CX Codex +1 718installs landmark-fit-repair Compares a Blender model against a template at named points — leaf tips, shell corners, eyes, smile, aura radius — and turns the drift into recipe edits. CX Codex +1 735installs texture-state-animation Plans and checks texture-state transitions in Blender so you avoid whole-image crossfades, popping and morphs that drift out of register. CX Codex +1 719installs orbital-hud-motion A skill that teaches an AI agent to build circular HUD and aura animations around a Blender subject from a reference, not from guesswork. CX Codex +1 714installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor