diff --git a/Demon_v0.19/art/succubus/meshy_v02/README.md b/Demon_v0.19/art/succubus/meshy_v02/README.md new file mode 100644 index 0000000..b50dc5f --- /dev/null +++ b/Demon_v0.19/art/succubus/meshy_v02/README.md @@ -0,0 +1,36 @@ +# Active Meshy succubus v02 + +Approved painted source: tools/model_sources/meshy_v01/painted_v02/succubus_painted.glb. +Meshy parent generation multi-image-to-3d / 01a18440-82d5-70e3-bd4f-720763eae473; +paint retexture / 01a18454-81f3-762f-b9b7-57b5e54af4a9. No new paid stages for integration. + +Prepared locally with tools/build_meshy_succubus.py (Blender 5.0). Inputs include +existing tools/model_sources/infernal_game.blend and the committed skin ownership mask. +Run Blender with --background --python-exit-code 1 --python tools/build_meshy_succubus.py. +The optimized mesh keeps original face-corner UVs and PBR maps, receives the existing +166-bone rig, Idle/Walk/Whip tracks and the animated whip. Shoes and sculpture contacts +are separated. Exposed arm ownership uses the approved skin mask, rather than proximity +to a wing; arm geometry stays intact. Coincident shoulder seam weights are equalized +and smoothed so the forearm strips and shoulder tears do not reappear on movement. +Build checks finite animated coordinates, normalized weights and edge growth <0.12m. +Measured results are in manifest.json. + +Runtime: succubus_actor.gd uses this GLB for heroine and helpers. meshy_gait.gd extends +the approved grounded gait: smooth 4.8s breathing, relaxed arm/head motion, existing +wing/tail secondary motion; idle fades on walking/striking and freezes on pause. +Foot anchors remain fixed. No lip-sync added. + +QA: --test-gait PASS including idle movement, grounded idle feet and paused idle, +heroine + three helpers, five speeds, turns, strikes, stopping, pause and teleport. +Intro test PASS with the model and idle. Local in-game idle/walk/strike captures inspected. +The final Windows EXE also passes --test-gait without SCRIPT ERROR/ERROR. + +Windows build was made from a snapshot of 49cf962 plus this task's runtime changes, +because equipment/main scripts were concurrently being edited in the working checkout. +Those uncommitted equipment changes were not included or overwritten. Build output: +Demon_v0.19_Windows/Demon.exe (local only). Full rebuild command after the working tree +is ready: tools/build_v19.ps1 with the Godot 4.3 console executable path. + +Generated staging sources, editable checkpoint, frames and logs stay under ignored +Demon_v0.19/captures/meshy-integration. Original high-poly painted Meshy source stays +in tools/model_sources/meshy_v01/painted_v02 for future texture/geometry edits. diff --git a/Demon_v0.19/art/succubus/meshy_v02/manifest.json b/Demon_v0.19/art/succubus/meshy_v02/manifest.json new file mode 100644 index 0000000..f87e96e --- /dev/null +++ b/Demon_v0.19/art/succubus/meshy_v02/manifest.json @@ -0,0 +1,50 @@ +{ + "source_triangles": 1351422, + "game_vertices": 80237, + "game_triangles": 100405, + "bones": 166, + "clips": [ + "Idle", + "Walk", + "Whip" + ], + "max_nearest_source_distance": 0.27485957741737366, + "textures": [ + [ + 8192, + 8192 + ], + [ + 4096, + 4096 + ], + [ + 4096, + 4096 + ], + [ + 4096, + 4096 + ], + [ + 4096, + 4096 + ], + [ + 4096, + 4096 + ] + ], + "source_task": "01a18454-81f3-762f-b9b7-57b5e54af4a9", + "deformation_checks": { + "Idle": { + "max_edge_growth_m": 2.2243854526371454e-07 + }, + "Walk": { + "max_edge_growth_m": 2.385202800929409e-07 + }, + "Whip": { + "max_edge_growth_m": 0.05535165758474635 + } + } +} \ No newline at end of file diff --git a/Demon_v0.19/art/succubus/meshy_v02/succubus_game.glb b/Demon_v0.19/art/succubus/meshy_v02/succubus_game.glb new file mode 100644 index 0000000..5e30573 --- /dev/null +++ b/Demon_v0.19/art/succubus/meshy_v02/succubus_game.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6687f7f6db1521c96519e818246db1df334f41285de9d32d7bd03c6eb945d4cc +size 35996548 diff --git a/Demon_v0.19/art/succubus/meshy_v02/succubus_game.glb.import b/Demon_v0.19/art/succubus/meshy_v02/succubus_game.glb.import new file mode 100644 index 0000000..1cbddee --- /dev/null +++ b/Demon_v0.19/art/succubus/meshy_v02/succubus_game.glb.import @@ -0,0 +1,36 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://b4jx0om4p8tqk" +path="res://.godot/imported/succubus_game.glb-371cf14b682e8237a655f82acd3ceb7b.scn" + +[deps] + +source_file="res://art/succubus/meshy_v02/succubus_game.glb" +dest_files=["res://.godot/imported/succubus_game.glb-371cf14b682e8237a655f82acd3ceb7b.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +_subresources={} +gltf/naming_version=1 +gltf/embedded_image_handling=1 diff --git a/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_0.jpg b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_0.jpg new file mode 100644 index 0000000..bce05dd Binary files /dev/null and b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_0.jpg differ diff --git a/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_0.jpg.import b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_0.jpg.import new file mode 100644 index 0000000..b99fa4b --- /dev/null +++ b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_0.jpg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://lgtbfpkpxokg" +path="res://.godot/imported/succubus_game_Image_0.jpg-cec9ee0b6063a4ed57257d2acf1b244b.ctex" +metadata={ +"vram_texture": false +} +generator_parameters={ +"md5": "3bda756cc39262596720cd6398cdb83c" +} + +[deps] + +source_file="res://art/succubus/meshy_v02/succubus_game_Image_0.jpg" +dest_files=["res://.godot/imported/succubus_game_Image_0.jpg-cec9ee0b6063a4ed57257d2acf1b244b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_1.jpg b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_1.jpg new file mode 100644 index 0000000..913f45f Binary files /dev/null and b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_1.jpg differ diff --git a/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_1.jpg.import b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_1.jpg.import new file mode 100644 index 0000000..ab61b72 --- /dev/null +++ b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_1.jpg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://df5dubp7tpa2d" +path="res://.godot/imported/succubus_game_Image_1.jpg-c8a69432c00266d27fb55ac429807b82.ctex" +metadata={ +"vram_texture": false +} +generator_parameters={ +"md5": "17b15cb310d64a13af5c439cb855c271" +} + +[deps] + +source_file="res://art/succubus/meshy_v02/succubus_game_Image_1.jpg" +dest_files=["res://.godot/imported/succubus_game_Image_1.jpg-c8a69432c00266d27fb55ac429807b82.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_2.jpg b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_2.jpg new file mode 100644 index 0000000..b4c974a Binary files /dev/null and b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_2.jpg differ diff --git a/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_2.jpg.import b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_2.jpg.import new file mode 100644 index 0000000..5bfa743 --- /dev/null +++ b/Demon_v0.19/art/succubus/meshy_v02/succubus_game_Image_2.jpg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d15nujrupbplf" +path="res://.godot/imported/succubus_game_Image_2.jpg-618758e2eaa20e2547d077b691b3c6ef.ctex" +metadata={ +"vram_texture": false +} +generator_parameters={ +"md5": "d569dc1c1ba7ab16f41c0115ff63134e" +} + +[deps] + +source_file="res://art/succubus/meshy_v02/succubus_game_Image_2.jpg" +dest_files=["res://.godot/imported/succubus_game_Image_2.jpg-618758e2eaa20e2547d077b691b3c6ef.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/Demon_v0.19/gait_tests.gd b/Demon_v0.19/gait_tests.gd index 43a498f..aaa9180 100644 --- a/Demon_v0.19/gait_tests.gd +++ b/Demon_v0.19/gait_tests.gd @@ -10,6 +10,18 @@ func run(g): var actors=[g.avatar] for h in g.workshop.helpers:actors.append(h.model) for actor in actors: + actor.reset_gait() + for frame in range(10):actor._process(1.0/60) + var hand_start=actor.gait.point("wrist.L") + var feet_start=[actor.gait.point("foot.L"),actor.gait.point("foot.R")] + var idle_motion=0.0 + for frame in range(240): + actor._process(1.0/60) + idle_motion=maxf(idle_motion,actor.gait.point("wrist.L").distance_to(hand_start)) + check(idle_motion>.004,"idle breathing and relaxed arm motion") + for i in range(2):check(actor.gait.point("foot."+actor.gait.feet[i].side).distance_to(feet_start[i])<.003,"idle feet stay grounded") + var idle_time=actor.gait.idle_time + g.paused=true;actor._process(.05);check(is_equal_approx(actor.gait.idle_time,idle_time),"pause freezes idle animation");g.paused=false for speed in [1.0,2.5,3.3,4.375,5.775]: actor.get_parent().position=Vector3.ZERO;actor.rotation=Vector3.ZERO;actor.striking=false;actor.refresh();actor.animator.advance(0);actor.reset_gait() var max_slide=0.0;var max_error=0.0;var max_lift=0.0;var min_contact=10.0;var planted_frames=0 diff --git a/Demon_v0.19/meshy_gait.gd b/Demon_v0.19/meshy_gait.gd new file mode 100644 index 0000000..a5cdd75 --- /dev/null +++ b/Demon_v0.19/meshy_gait.gd @@ -0,0 +1,20 @@ +extends "res://infernal_gait.gd" +# Grounded idle breathing layered after the approved locomotion. +var idle_time=0.0 +var idle_weight=0.0 + +func update(dt): + super.update(dt) + idle_time+=dt + var target=(1.0-walk_weight) if not actor.striking else 0.0 + idle_weight=move_toward(idle_weight,target,dt*3.0) + var breath=sin(idle_time*TAU/4.8) + var drift=sin(idle_time*TAU/7.2) + rotate_world("spine02",actor.global_basis.x,breath*.010*idle_weight) + rotate_world("spine01",actor.global_basis.z,drift*.006*idle_weight) + rotate_world("head",actor.global_basis.x,-breath*.006*idle_weight) + rotate_world("head",actor.global_basis.y,drift*.012*idle_weight) + for side in ["L","R"]: + var sign_x=1.0 if side=="L" else -1.0 + rotate_world("upperarm01."+side,actor.global_basis.z,-sign_x*(.075+breath*.007)*idle_weight) + rotate_world("lowerarm01."+side,actor.global_basis.x,sin(idle_time*TAU/6.4+sign_x*.4)*.010*idle_weight) diff --git a/Demon_v0.19/succubus_actor.gd b/Demon_v0.19/succubus_actor.gd index 1c86e54..8633176 100644 --- a/Demon_v0.19/succubus_actor.gd +++ b/Demon_v0.19/succubus_actor.gd @@ -5,16 +5,16 @@ var cinematic_idle=false var walking=false var striking=false var clips={} -var gait=preload("res://infernal_gait.gd").new() +var gait=preload("res://meshy_gait.gd").new() var animation_pose: Array[Transform3D]=[] var skeleton: Skeleton3D func _init(review_model: PackedScene=null): name="ApprovedSuccubus" - set_meta("approved_model","infernal_v01") - set_meta("wardrobe_revision","infernal_sculpt_painted_v01") - var model=(review_model if review_model else preload("res://art/succubus/infernal_v01/infernal_game.glb")).instantiate() + set_meta("approved_model","meshy_v02") + set_meta("wardrobe_revision","meshy_reference_painted_v02") + var model=(review_model if review_model else preload("res://art/succubus/meshy_v02/succubus_game.glb")).instantiate() add_child(model) model.scale=Vector3.ONE*1.20 for node in model.find_children("*","AnimationPlayer",true,false): diff --git a/HANDOFF.md b/HANDOFF.md index 8b392ec..89ecd93 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -15,6 +15,11 @@ ## Последние выполненные задачи +- **Актуальная суккуба: Meshy v02 включена в игру и Windows-билд.** + Красная кожа, чёрный комплект/волосы/крылья; исправлены полосы на руках, + добавлен плавный айдл. Подробности — в последнем разделе этого handoff + и `art/succubus/meshy_v02/README.md`. Предыдущая Infernal сохранена. + - **Железная дева Meshy v01 (2026-10-28):** по утверждённому арту создана и включена вместо процедурной модели. `art/equipment/iron_maiden_v01/`: GLB, три PBR-карты 4K, manifest и import sidecars. Высота 3,10 м, 92 228 @@ -330,3 +335,40 @@ Retexture `01a18454-81f3-762f-b9b7-57b5e54af4a9`, родитель — преж GLB структурно проверен: прежние 1 351 422 треугольника, скелета/анимаций нет. В runtime не включён, игровые тесты не повторялись. Подробности и путь Meshy-проекта — в README рядом с моделью; временные ссылки не публикуются. + + +## Meshy: включение в билд, руки и айдл, 2026-10-28 + +По просьбе пользователя покрашенная Meshy-суккуба включена для героини и помощниц: +`art/succubus/meshy_v02/succubus_game.glb`, `succubus_actor.gd`, `meshy_gait.gd`. +Сетка локально уменьшена с 1 351 422 до 100405 треугольников; +сохранены UV/PBR и карта 8K, перенесены 166 костей, Idle/Walk/Whip и плеть. +Новых платных задач Meshy нет. Воспроизводимая подготовка — +`tools/build_meshy_succubus.py`; исходный painted GLB, старый Infernal BLEND +и производная маска кожи сохранены в tools/model_sources. + +Исправлен видимый графический дефект рук: часть предплечья ошибочно получала +веса крыла, а частичная коррекция позы создавала раздвоение. Теперь форма рук +цельная, назначены анатомические веса; совпадающие вершины плечевого шва +получают одинаковые сглаженные веса. Разделены печатные контакты ног/хвоста. +Максимальный рост ребра в пробах удара 0.05535 м, веса нормализованы. +Айдл: дыхание 4,8 с, мягкие движения рук/головы/плеч, крылья и хвост; +плавное затухание при ходьбе и ударе, пауза замораживает, стопы закреплены. + +Проверки: повторный импорт PASS без ошибок; --test-gait PASS (героиня и +три помощницы, пять скоростей, повороты, остановки, удар, пауза, телепорт; +добавлены проверки движения айдла, неподвижных стоп и заморозки времени). +--test-intro PASS, полная запись, 2+2 с, блокировка ввода и возврат камеры. +Просмотрены крупные планы idle/walk/whip в игре после исправлений. +Собран `Demon_v0.19_Windows/Demon.exe`; сам EXE проходит --test-gait, +запущен для пользователя (PID 51680, лог captures/meshy-running.log). + +Важная особенность текущего запуска: во время работы другой чат изменял +main.gd/equipment.gd и добавлял iron_maiden.gd, ссылающийся на ещё не готовый +ресурс. Их незавершённое состояние не перезаписывалось и не коммитилось +вместе с этой задачей. Для проверок/EXE использован изолированный снимок +49cf962 + изменения суккубы/айдла в captures/meshy-integration/build_source. +Первый импорт снимка сообщал о ещё не импортированных шрифтах и старом LOD; +повторный импорт и игровые/EXE-проверки проходят без SCRIPT ERROR/ERROR. +После завершения параллельной работы общий EXE следует пересобрать из checkout. +Билд и технические кадры/логи локальные; исходники и игровой ассет отправляются в Git. diff --git a/tools/build_meshy_succubus.py b/tools/build_meshy_succubus.py new file mode 100644 index 0000000..d50614a --- /dev/null +++ b/tools/build_meshy_succubus.py @@ -0,0 +1,186 @@ +"""Adapt approved Meshy paint to the existing Infernal rig without paid services. +Blender 5.0: --background --python-exit-code 1 --python tools/build_meshy_succubus.py +""" +import bpy,bmesh,json,math +from pathlib import Path +from mathutils import Vector +from mathutils.kdtree import KDTree +import numpy as np +ROOT=Path(__file__).resolve().parent.parent +OUT=ROOT/'Demon_v0.19/art/succubus/meshy_v02';OUT.mkdir(parents=True,exist_ok=True) +QA=ROOT/'Demon_v0.19/captures/meshy-integration';QA.mkdir(parents=True,exist_ok=True) +def log(*v):print('MESHY_GAME',*v,flush=True) +def active(o): + bpy.ops.object.select_all(action='DESELECT');o.select_set(True);bpy.context.view_layer.objects.active=o +bpy.ops.wm.open_mainfile(filepath=str(ROOT/'tools/model_sources/infernal_game.blend')) +scene=bpy.context.scene;source=bpy.data.objects['Infernal_Game_Mesh'];rig=bpy.data.objects['INFERNAL_RIG'] +rig.animation_data.action=None +for tr in rig.animation_data.nla_tracks:tr.mute=True +for bone in rig.pose.bones:bone.matrix_basis.identity() +bpy.context.view_layer.update() +regions=source.data.attributes['SemanticRegion'].data +samples=[v.co.copy() for v in source.data.vertices] +source_weights=[[(source.vertex_groups[g.group].name,g.weight) for g in v.groups if g.weight>1e-6] for v in source.data.vertices] +tree=KDTree(len(samples)) +for i,v in enumerate(samples):tree.insert(v,i) +tree.balance() +parts={} +for role in range(6): + ids=[i for i in range(len(samples)) if regions[i].value==role];kd=KDTree(len(ids)) + for i in ids:kd.insert(samples[i],i) + kd.balance();parts[role]=kd +leg_trees={} +for sign in [-1,1]: + ids=[i for i in range(len(samples)) if regions[i].value==0 and samples[i].x*sign>0 and any(w>.01 and not n.endswith('.R' if sign>0 else '.L') for n,w in source_weights[i])] + kd=KDTree(len(ids)) + for i in ids:kd.insert(samples[i],i) + kd.balance();leg_trees[sign]=kd +bpy.ops.import_scene.gltf(filepath=str(ROOT/'tools/model_sources/meshy_v01/painted_v02/succubus_painted.glb')) +obj=next(o for o in bpy.context.selected_objects if o.type=='MESH');obj.name='Meshy_Succubus_Game' +active(obj);bpy.ops.object.transform_apply(location=True,rotation=True,scale=True) +lo=min(v.co.z for v in obj.data.vertices);hi=max(v.co.z for v in obj.data.vertices);scale=2.050177/(hi-lo) +for v in obj.data.vertices:v.co=Vector((v.co.x*scale,v.co.y*scale,(v.co.z-lo)*scale)) +modifier=obj.modifiers.new('Realtime topology preserving UV','DECIMATE');modifier.ratio=100000/1351422;modifier.use_collapse_triangulate=True +bpy.ops.object.modifier_apply(modifier=modifier.name) +# Remove any fused shoe contact, retaining interpolated UVs on the cut. +bm=bmesh.new();bm.from_mesh(obj.data) +faces=[f for f in bm.faces if all(v.co.z<.98 for v in f.verts)] +geom=set(faces) +for f in faces:geom.update(f.verts);geom.update(f.edges) +result=bmesh.ops.bisect_plane(bm,geom=list(geom),plane_co=(0,0,0),plane_no=(1,0,0),dist=1e-7) +cut=[e for e in result['geom_cut'] if isinstance(e,bmesh.types.BMEdge)] +if cut:bmesh.ops.split_edges(bm,edges=cut) +for sign in [-1,1]: + boundary=[e for e in bm.edges if e.is_boundary and all(abs(v.co.x)<1e-6 and v.co.z<.98 for v in e.verts) and e.link_faces and e.link_faces[0].calc_center_median().x*sign>0] + if boundary:bmesh.ops.holes_fill(bm,edges=boundary,sides=0) +bmesh.ops.triangulate(bm,faces=list(bm.faces));bm.to_mesh(obj.data);bm.free();obj.data.update() +# Establish surface ownership before posing, so wings cannot receive hand weights. +roles=[];distances=[] +# Classify exposed arm surfaces using the approved red skin texture, including +# the rear of the forearm; spatial nearest-source alone confuses these with wings. +mask_data=np.load(ROOT/'tools/model_sources/meshy_v01/painted_v02/skin_mask.npz') +image=mask_data['skin'];uv=obj.data.uv_layers.active.data +skin=np.zeros(len(obj.data.vertices),dtype=bool) +for loop in obj.data.loops: + u,v=uv[loop.index].uv + if image[int((1-v)%1*(image.shape[0]-1)),int(u%1*(image.shape[1]-1))]:skin[loop.vertex_index]=True +arm_ids=[] +for v in obj.data.vertices: + x,y,z=v.co;minimum=float(np.interp(z,[.75,1.0,1.25,1.42,1.58],[.25,.21,.18,.15,.14])) + if skin[v.index] and .72minimum and y<.13:arm_ids.append(v.index) +arm_tree=KDTree(len(arm_ids)) +for i in arm_ids:arm_tree.insert(obj.data.vertices[i].co,i) +arm_tree.balance() +for v in obj.data.vertices: + p=v.co;_,index,d=tree.find(p);role=regions[index].value + _,_,arm_distance=arm_tree.find(p) + if arm_distance<.018:role=4 if p.x>0 else 5 + elif role in [4,5]:role=0 if abs(p.x)<.20 else (1 if p.x>0 else 2) + roles.append(role);distances.append(d) +log('red arm seeds',len(arm_ids),'arm surface vertices',sum(r in [4,5] for r in roles)) +# Duplicate vertices per surface owner while copying every face-corner UV. +old=obj.data;vertices=[];faces=[];mapping={};new_roles=[];uvs=[] +for face in old.polygons: + labels=[roles[i] for i in face.vertices];role=max(set(labels),key=labels.count);indices=[] + for index in face.vertices: + key=(role,index) + if key not in mapping: + mapping[key]=len(vertices);vertices.append(tuple(old.vertices[index].co));new_roles.append(role) + indices.append(mapping[key]) + faces.append(indices) + if old.uv_layers.active:uvs.extend([tuple(old.uv_layers.active.data[i].uv) for i in face.loop_indices]) +mesh=bpy.data.meshes.new('Meshy separated anatomical surfaces');mesh.from_pydata(vertices,[],faces);mesh.update() +for material in old.materials:mesh.materials.append(material) +if uvs: + uv=mesh.uv_layers.new(name='UVMap') + for entry,value in zip(uv.data,uvs):entry.uv=value +obj.data=mesh;roles=new_roles +for bone in rig.data.bones:obj.vertex_groups.new(name=bone.name) +for face in mesh.polygons:assert len({roles[i] for i in face.vertices})==1 +for v,role in zip(obj.data.vertices,roles): + p=v.co.copy();x,y,z=p;sign=1 if x>0 else -1 + if abs(x)<.00001 and z<.95: + face_x=sum(f.center.x for f in obj.data.polygons if v.index in f.vertices) + sign=1 if face_x>=0 else -1 + x=sign*.0003;p.x=x;v.co=p + if role in [4,5] and z<1.54: + old_x=float(np.interp(z,[.81,.93,1.09,1.25,1.42,1.54],[.275,.257,.228,.194,.170,.153])) + new_x=float(np.interp(z,[.81,.95,1.10,1.25,1.42,1.54],[.38,.355,.31,.265,.205,.16])) + p.x-=sign*(new_x-old_x) # Query only: never move a subset of the visible arm. + if role in [4,5]: + side='L' if role==4 else 'R' + wrist=float(np.clip((1.02-z)/.08,0,1));upper=float(np.clip((z-1.21)/.12,0,1));shoulder=float(np.clip((z-1.47)/.09,0,1)) + weights={'wrist.'+side:wrist,'lowerarm01.'+side:(1-wrist)*(1-upper),'upperarm01.'+side:upper*(1-shoulder),'spine02':upper*shoulder} + total=sum(weights.values());weights={n:w/total for n,w in weights.items() if w>1e-6} + elif role==0 and z<.18: + weights={'foot.L' if sign>0 else 'foot.R':1.0} + else: + weights={} + kd=leg_trees[sign] if role==0 and z<.95 else parts[role] + for _,index,distance in kd.find_n(p,8): + factor=1/max(.002,distance)**2 + for name,w in source_weights[index]: + if role==0 and z<.95 and name.endswith('.R' if sign>0 else '.L'):continue + weights[name]=weights.get(name,0)+w*factor + pairs=sorted(weights.items(),key=lambda kv:-kv[1])[:4];total=sum(w for _,w in pairs);weights={n:w/total for n,w in pairs} + assert weights and all(math.isfinite(w) for w in weights.values()),(v.index,tuple(p),role) + for n,w in weights.items():obj.vertex_groups[n].add([v.index],w,'REPLACE') +# Keep coincident shoulder seam vertices on the same continuous skin field. +names=[g.name for g in obj.vertex_groups];name_to_index={n:i for i,n in enumerate(names)} +weights_array=np.zeros((len(obj.data.vertices),len(names)),dtype=np.float32) +coords=np.array([tuple(v.co) for v in obj.data.vertices]);shoulder=(np.abs(coords[:,0])>.105)&(np.abs(coords[:,0])<.34)&(coords[:,2]>1.34)&(coords[:,2]<1.65)&(coords[:,1]<.13)&np.isin(np.array(roles),[0,4,5]) +seams={} +for v in obj.data.vertices: + for g in v.groups:weights_array[v.index,g.group]=g.weight + if shoulder[v.index] and roles[v.index] in [0,4,5]:seams.setdefault(tuple(np.round(v.co,5)),[]).append(v.index) +edges=np.array([tuple(e.vertices) for e in obj.data.edges],dtype=np.int32) +mask=shoulder[edges[:,0]]&shoulder[edges[:,1]]&np.isin(np.array(roles)[edges[:,0]],[0,4,5])&np.isin(np.array(roles)[edges[:,1]],[0,4,5]);smooth=edges[mask] +first=np.concatenate((smooth[:,0],smooth[:,1]));second=np.concatenate((smooth[:,1],smooth[:,0]));counts=np.maximum(np.bincount(first,minlength=len(coords)),1) +for iteration in range(10): + average=np.zeros_like(weights_array) + for column in range(len(names)):average[:,column]=np.bincount(first,weights=weights_array[second,column],minlength=len(coords))/counts + weights_array[shoulder]=weights_array[shoulder]*.4+average[shoulder]*.6 + for indices in seams.values(): + if len(indices)>1:weights_array[indices]=weights_array[indices].mean(axis=0) +for v in obj.data.vertices: + if not shoulder[v.index]:continue + w=weights_array[v.index];indices=np.argsort(w)[-4:];total=float(w[indices].sum()) + if total<1e-8:continue + for g in list(v.groups):obj.vertex_groups[g.group].remove([v.index]) + for i in indices: + if w[i]/total>1e-6:obj.vertex_groups[int(i)].add([v.index],float(w[i])/total,'REPLACE') +for f in obj.data.polygons:f.use_smooth=True +modifier=obj.modifiers.new('Approved animation skeleton','ARMATURE');modifier.object=rig;obj.parent=rig +# UV and all PBR textures from Meshy remain attached to the optimized surface. +obj.data.update();bpy.context.view_layer.update() +report={'source_triangles':1351422,'game_vertices':len(obj.data.vertices),'game_triangles':sum(len(f.vertices)-2 for f in obj.data.polygons),'bones':len(rig.data.bones),'clips':[t.name for t in rig.animation_data.nla_tracks],'max_nearest_source_distance':max(distances),'textures':[list(i.size) for i in bpy.data.images if i.size[0]>0 and i.users>0],'source_task':'01a18454-81f3-762f-b9b7-57b5e54af4a9'} +for v in obj.data.vertices:assert abs(sum(g.weight for g in v.groups)-1)<1e-4 +edges=np.array([tuple(e.vertices) for e in obj.data.edges],dtype=np.int32) +base=np.array([tuple(v.co) for v in obj.data.vertices]);rest_lengths=np.linalg.norm(base[edges[:,0]]-base[edges[:,1]],axis=1) +checks={} +for track in rig.animation_data.nla_tracks: + track.mute=False;values=[] + for frame in range(1,int(track.strips[0].frame_end)+1,8): + scene.frame_set(frame);bpy.context.view_layer.update();evaluated=obj.evaluated_get(bpy.context.evaluated_depsgraph_get());mesh=evaluated.to_mesh();coords=np.array([tuple(v.co) for v in mesh.vertices]);evaluated.to_mesh_clear() + assert np.isfinite(coords).all() + growth=np.linalg.norm(coords[edges[:,0]]-coords[edges[:,1]],axis=1)-rest_lengths + values.append(float(np.max(growth))) + if values[-1]>.12: + ix=int(np.argmax(growth));log('EDGE',track.name,frame,values[-1],[list(base[j]) for j in edges[ix]],[roles[j] for j in edges[ix]]) + checks[track.name]={'max_edge_growth_m':max(values)};track.mute=True +report['deformation_checks']=checks +assert all(c['max_edge_growth_m']<.12 for c in checks.values()),checks +log(json.dumps(report)) +for o in list(scene.objects): + if o not in [obj,rig] and o.name!='Infernal animated whip':bpy.data.objects.remove(o,do_unlink=True) +for tr in rig.animation_data.nla_tracks:tr.mute=False +rig.animation_data.action=None;scene.frame_set(1) +for bone in rig.pose.bones:bone.matrix_basis.identity() +active(obj);rig.select_set(True) +whip=bpy.data.objects.get('Infernal animated whip') +if whip:whip.select_set(True) +bpy.ops.export_scene.gltf(filepath=str(OUT/'succubus_game.glb'),export_format='GLB',use_selection=True,export_animations=True,export_animation_mode='NLA_TRACKS',export_nla_strips=True,export_force_sampling=True,export_frame_range=False,export_skins=True,export_materials='EXPORT',export_yup=True) +(OUT/'manifest.json').write_text(json.dumps(report,indent=2),encoding='utf-8') +bpy.context.preferences.filepaths.save_version=0 +bpy.ops.wm.save_as_mainfile(filepath=str(QA/'meshy_game.blend')) +log('EXPORT READY',OUT/'succubus_game.glb') diff --git a/tools/capture_meshy_succubus.gd b/tools/capture_meshy_succubus.gd new file mode 100644 index 0000000..b4c2866 --- /dev/null +++ b/tools/capture_meshy_succubus.gd @@ -0,0 +1,35 @@ +extends SceneTree +# Manual visual regression capture against the active game scene. +func _initialize(): + call_deferred("run") + +func run(): + AudioServer.set_bus_mute(0,true) + var g=load("res://main.tscn").instantiate() + root.add_child(g) + await process_frame + g.test_mode=true;g.capture_mode=true;g.start_game();g.set_process(false) + g.avatar.set_process(false);g.hud.hide() + g.player.position=Vector3(-1,0,-1) + for imp in g.life.imps:imp.root.hide();g.avatar.rotation=Vector3.ZERO;g.avatar.reset_gait() + var folder=ProjectSettings.globalize_path("res://captures/meshy-review") + DirAccess.make_dir_recursive_absolute(folder) + for i in range(3): + for frame in range(30):g.avatar._process(1.0/24) + await snap(g,folder+"/idle-%d.png"%i) + for i in range(3): + for frame in range(8): + g.player.position+=Vector3.BACK*2.5/24;g.avatar._process(1.0/24) + await snap(g,folder+"/walk-%d.png"%i) + g.avatar.strike(.7) + for i in range(3): + for frame in range(5):g.avatar._process(1.0/24) + await snap(g,folder+"/whip-%d.png"%i) + print("MESHY REVIEW CAPTURE COMPLETE") + quit() + +func snap(g,path): + var target=g.player.position+Vector3(0,1.35,0) + g.camera.size=3.4;g.camera.position=target+Vector3(.15,.15,2.8);g.camera.look_at(target) + await RenderingServer.frame_post_draw + assert(g.get_viewport().get_texture().get_image().save_png(path)==OK) diff --git a/tools/model_sources/meshy_v01/painted_v02/README.md b/tools/model_sources/meshy_v01/painted_v02/README.md index 77b4555..387ffde 100644 --- a/tools/model_sources/meshy_v01/painted_v02/README.md +++ b/tools/model_sources/meshy_v01/painted_v02/README.md @@ -15,3 +15,5 @@ - Raw task responses/signed asset URLs remain outside Git. SHA256 model: `c870597ddd835e4026365b501c887d54687707f439e4eaa8a9c72093ebbda263` + +Skin ownership input for game rig transfer: skin_mask.npz. Derived from the embedded base-color image resized to 1024 square: R>65, R>1.5G, R>1.3B (sRGB bytes). Contains the boolean skin mask and source GLB SHA256; no geometry or texture modification. diff --git a/tools/model_sources/meshy_v01/painted_v02/skin_mask.npz b/tools/model_sources/meshy_v01/painted_v02/skin_mask.npz new file mode 100644 index 0000000..b752333 Binary files /dev/null and b/tools/model_sources/meshy_v01/painted_v02/skin_mask.npz differ