新增基于摄像机网格投影的黑白笔画原型

沿用彩色块的网格与可见性投影,便于评估透视适配的笔画。已通过几何单元测试及 250/500 像素光流探针。
This commit is contained in:
ykcheungab
2026-10-05 21:49:26 +08:00
parent f81418c542
commit 2111a9f32f
4 changed files with 195 additions and 1 deletions
+8 -1
View File
@@ -37,7 +37,7 @@ def _min_seam_distance(point, segments):
def build_patch_geometry(obj, cam, scene, depsgraph, uv_names, nx, ny, edge_sample_grid,
fill_unresolved_leaves=False, seam_segments=None,
seam_search_mm=0.0):
seam_search_mm=0.0, capture_camera_fragments=False):
"""Evaluated loop-triangle fragments for one camera, per UV target.
``fill_unresolved_leaves`` accepts fragments whose visibility could not be resolved at
@@ -72,6 +72,9 @@ def build_patch_geometry(obj, cam, scene, depsgraph, uv_names, nx, ny, edge_samp
origin = camera.matrix_world.translation
forward = camera.matrix_world.to_quaternion() @ Vector((0, 0, -1))
output = {name: {'mesh': [], 'patches': []} for name in uv_names}
if capture_camera_fragments:
for name in uv_names:
output[name]['camera_fragments'] = []
ray_count = 0
# Triangle-level and fragment-level records, shared by every UV target: the
@@ -184,6 +187,10 @@ def build_patch_geometry(obj, cam, scene, depsgraph, uv_names, nx, ny, edge_samp
for name in uv_names:
polygon = [interpolate_uv(p, uvs[name]) for p in fragment]
output[name]['patches'].append((i, j, polygon))
if capture_camera_fragments:
output[name]['camera_fragments'].append(
(i, j, fragment, uvs[name])
)
output['_meta'] = {
'triangle_count': len(mesh.loop_triangles),