contour-to-mesh
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContour to Mesh
轮廓转网格
Use this when a reference silhouette is the contract. The mesh starts as a filled 2D contour in front-view X/Z, then gets shallow Y depth/crown after validation.
当参考轮廓为硬性要求时使用此方法。网格最初是正视图X/Z平面内的填充2D轮廓,在验证后再添加浅Y轴深度/凸起。
Workflow
工作流程
- Extract or select a clean contour/mask for one structural part.
- Generate a triangulated mesh recipe with .
scripts/mask_to_mesh_recipe.py - Run the generated Blender Python to create a named mesh.
GEO_* - Assign front-projected UVs immediately.
- Add depth only as a modifier or vertex displacement that preserves X/Z boundary positions.
- Validate the front render against the source mask.
- 提取或选择单个结构部件的清晰轮廓/遮罩。
- 使用生成三角化网格生成脚本。
scripts/mask_to_mesh_recipe.py - 运行生成的Blender Python脚本,创建命名为的网格。
GEO_* - 立即分配正投影UV。
- 仅通过修改器或顶点位移添加深度,且需保留X/Z边界位置。
- 将正面渲染结果与源遮罩进行验证。
Hard rules
硬性规则
- Do not use radial duplication unless the manifest says the source is symmetric.
- Do not use a generic ellipse if a contour exists.
- Boundary vertices must keep source X/Z coordinates.
- Depth deformation may move Y and inner vertices, but must not alter front silhouette.
- One structural source part should become one named structural mesh.
- 除非明确说明源文件对称,否则不要使用径向复制。
- 若存在轮廓,请勿使用通用椭圆。
- 边界顶点必须保留源文件的X/Z坐标。
- 深度变形可移动Y轴和内部顶点,但不得改变正面轮廓。
- 单个结构源部件应对应一个命名的结构网格。
Blender pattern
Blender规范
Generated mesh coordinates should map image to Blender and image to Blender with vertical flip. Use only for thickness/depth.
xXyZY生成的网格坐标应将图像映射到Blender轴,图像映射到Blender轴并进行垂直翻转。仅使用轴表示厚度/深度。
xXyZYFront-plane rotation rule
正平面旋转规则
In this Blender coordinate convention, the front camera looks along the Y axis and the reference silhouette lives in the X/Z plane. Therefore 2D rotations inside the front view are rotations around the Y axis, not around Z. Use for 2D component orientation in the front projection. Z rotation spins objects into/out of screen-space incorrectly for X/Z-plane meshes.
rotation_euler = (0, angle, 0)在此Blender坐标约定中,正面相机沿Y轴方向拍摄,参考轮廓位于X/Z平面内。因此,正视图内的2D旋转是绕Y轴的旋转,而非绕Z轴。在正投影中调整2D组件方向时,使用。绕Z轴旋转会导致X/Z平面内的网格错误地旋入/旋出屏幕空间。
rotation_euler = (0, angle, 0)Sources distilled
核心技术来源
- Blender Mesh API: create meshes from vertices/faces using .
from_pydata - Blender BMesh: use for cleanup, triangulation, normals, smoothing.
- OpenCV contours: detect and simplify boundaries.
- Delaunay triangulation: useful for filled interior meshes when filtered by mask containment.
- Blender Mesh API:使用从顶点/面创建网格。
from_pydata - Blender BMesh:用于清理、三角化、法线处理和平滑操作。
- OpenCV contours:检测并简化边界。
- Delaunay triangulation:在通过遮罩范围过滤时,适用于填充内部网格。
Part-inventory handoff
部件清单交接
When masks come from , preserve the names in Blender:
, , and UV layer names. Mesh generation must record:
source-part-segmentationpart_inventory.jsonGEO_<part_name>MAT_<part_name>- source image size;
- source mask path;
- contour boundary point count;
- boundary landmark points (tip, base-left, base-right, centroid/extrema) when detectable;
- atlas UV rectangle or projection mode.
For exact mascot/logo work, generate boundary vertices from the contour and add interior vertices only for surface support.
The boundary is a contract: bevels, solidify, subdivision, shrinkwrap, or sculpt passes must not move front-view X/Z boundary vertices unless a new source mask is produced.
当遮罩来自时,需在Blender中保留中的名称:、以及UV层名称。网格生成必须记录:
source-part-segmentationpart_inventory.jsonGEO_<part_name>MAT_<part_name>- 源图像尺寸;
- 源遮罩路径;
- 轮廓边界点数量;
- 可检测到的边界特征点(尖端、左基部、右基部、质心/极值点);
- 图集UV矩形或投影模式。
对于精确的吉祥物/标志制作,从轮廓生成边界顶点,仅添加内部顶点以支撑曲面。
边界是硬性要求:除非生成新的源遮罩,否则倒角、实体化、细分、包裹或雕刻操作不得移动正视图X/Z边界顶点。
Hole and stroke policy
孔洞与描边规则
- Filled structural masks become meshes.
- Wireframe strokes guide boundaries/landmarks; they are not structural meshes unless the manifest classifies them as decorative linework.
- Holes/negative regions should be kept as separate cut masks when they affect silhouette; otherwise implement them as decals/material masks.
- 填充的结构遮罩将转为网格。
- 线框描边用于引导边界/特征点;除非明确将其归类为装饰性线条,否则它们不属于结构网格。
- 若孔洞/负区域影响轮廓,应将其保留为单独的切割遮罩;否则将其实现为贴花/材质遮罩。
Source-locked front-skin fallback
源锁定正面蒙皮 fallback
When a design sheet is painterly/stylized and separate orthographic views are not CAD-consistent, use a front-skin pass before sculptural interpretation:
- choose the canonical front/master source;
- extract the visible subject mask as a filled contour;
- create a shallow 2.5D mesh whose X/Z boundary is that contour;
- assign full-image front-projected UVs so the rendered front matches the source pixels;
- add depth only along Y and behind the front surface;
- optionally add separate relief/backing parts for side plausibility, but keep the front skin as the visual acceptance gate.
This is a generic fallback for logos/mascots where a faithful front read is more important than speculative volume. Mark it as , not as a fully solved turntable model.
front_locked_visual_skin当设计图为手绘/风格化且不同正交视图不符合CAD一致性时,在进行雕刻诠释前使用正面蒙皮流程:
- 选择标准正面/主源文件;
- 提取可见主体遮罩作为填充轮廓;
- 创建一个浅2.5D网格,其X/Z边界为该轮廓;
- 分配全图像正投影UV,使正面渲染结果与源像素匹配;
- 仅沿Y轴并在正面曲面后方添加深度;
- 可选择性添加单独的浮雕/背衬部件以保证侧面合理性,但需将正面蒙皮作为视觉验收标准。
这是标志/吉祥物制作的通用 fallback 方案,此时忠实还原正面视觉效果比推测体积更重要。将其标记为,而非完全可旋转的模型。
front_locked_visual_skinScript
脚本
- extracts a largest/canonical foreground component and emits a mask + contour mesh recipe using full-image front-projected UV coordinates.
scripts/source_locked_skin_recipe.py
- 提取最大/标准前景组件,并使用全图像正投影UV坐标生成遮罩+轮廓网格生成脚本。
scripts/source_locked_skin_recipe.py