diff --git a/Demon_v0.19/catwalk.gd b/Demon_v0.19/catwalk.gd index 5a491d3..ede7756 100644 --- a/Demon_v0.19/catwalk.gd +++ b/Demon_v0.19/catwalk.gd @@ -16,6 +16,10 @@ var initialized=false var moving=false var stride=1.55 var last_direction=Vector3.ZERO +var stride_min=1.25 +var stride_max=1.65 +var track_width=.065 +var swing_height=.15 func setup(owner_actor): actor=owner_actor;skeleton=actor.find_children("*","Skeleton3D",true,false)[0] @@ -67,7 +71,7 @@ func landing(f,progress,travel_direction): # Narrow catwalk track, with enough clearance for the boots to pass each other. var side=1.0 if f.side=="L" else -1.0 var destination=actor.global_position+travel_direction*((1.0-progress)*stride+stride*.25) - destination+=actor.global_basis.x.normalized()*side*.065*scale_y + destination+=actor.global_basis.x.normalized()*side*track_width*scale_y destination.y=ground_height(f) return destination @@ -81,7 +85,7 @@ func update(dt): var was_moving=moving;moving=distance>.00015 and dt>0 var scale_y=actor.global_basis.get_scale().y # Longer steps at higher upgrade speeds; phase still follows the actual distance. - stride=lerpf(1.25,1.65,clampf((last_speed/scale_y-1.3)/2.0,0,1))*scale_y + stride=lerpf(stride_min,stride_max,clampf((last_speed/scale_y-1.3)/2.0,0,1))*scale_y walk_weight=move_toward(walk_weight,1.0 if moving else 0.0,dt*7) if moving: distance_walked+=distance;phase=fposmod(phase+distance/stride,1.0) @@ -103,7 +107,7 @@ func update(dt): var u=clampf((p-f.start_phase)/maxf(.01,1.0-f.start_phase),0,1) var ease=u*u*(3-2*u) f.target=f.start.lerp(f.landing,ease) - f.target.y=ground_height(f)+sin(u*PI)*.15*scale_y + f.target.y=ground_height(f)+sin(u*PI)*swing_height*scale_y else: if not f.grounded: f.anchor=f.landing;f.anchor.y=ground_height(f);f.yaw=actor.global_rotation.y;f.grounded=true @@ -146,7 +150,10 @@ func update(dt): skeleton.set_bone_pose_position(bones["root"],skeleton.to_local(root_position));skeleton.force_update_all_bone_transforms() for f in feet: leg(f,f.target) - var yaw=f.yaw if f.grounded else actor.global_rotation.y - var foot_rotation=Quaternion(Vector3.UP,yaw)*f.rotation - if not f.grounded:foot_rotation=Quaternion(actor.global_basis.x.normalized(),sin(maxf(0,f.last_phase-.5)*TAU)*-.12)*foot_rotation - set_rotation("foot."+f.side,foot_rotation) + set_rotation("foot."+f.side,foot_orientation(f,dt)) + +func foot_orientation(f,_dt): + var yaw=f.yaw if f.grounded else actor.global_rotation.y + var orientation=Quaternion(Vector3.UP,yaw)*f.rotation + if not f.grounded:orientation=Quaternion(actor.global_basis.x.normalized(),sin(maxf(0,f.last_phase-.5)*TAU)*-.12)*orientation + return orientation diff --git a/Demon_v0.19/reviews/heels_v01/README.md b/Demon_v0.19/reviews/heels_v01/README.md new file mode 100644 index 0000000..b941e9b --- /dev/null +++ b/Demon_v0.19/reviews/heels_v01/README.md @@ -0,0 +1,42 @@ +# Предварительный комплект суккубы — на согласование + +Этот первый образец сохранён для истории. После его подготовки пользователь +дал новый основной референс с трёх сторон: чёрный комплект, высокий хвост волос +и низкие коричневые крылья. Красный комплект не был утверждён. + +Статус: образец для выбора, в основной игре пока остаётся `succubus_v02.glb` +и прежняя походка. Новые модели, движения и параметры включены только в этой +отдельной сцене. Общая модель используется героиней и помощницами после согласования. + +- Чёрные ботфорты: острый носок, широкий высокий каблук со скошенными гранями, + отдельная изогнутая подошва с просветом под сводом. Обувь жёстко привязана + к стопе, исключён изгиб вместе с костями пальцев. +- Суставы стоп подняты на 8 см в координатах модели, обновлены inverse bind + matrices и трансляции в исходных клипах. Сустав соответствует поднятой пятке, + а не старой босой стопе. Ходьба использует более короткий шаг, отдельные + дорожки ног и ограничение поворота опорной стопы до 22° относительно таза. +- Красный кожаный корсет: фигурный верх/низ, воротник с кольцами спереди и + пряжками сзади, ремни, пояс, задняя шнуровка, небольшие наплечники-крылья. + Края материалов разрезаны по треугольникам, вместо назначения целых граней. +- Большие крылья: изогнутые рёбра, провисающая бордовая перепонка, гладкие + нормали. Привязаны к имеющимся независимым `Wing.L/R`. При ходьбе вторичное + покачивание около 2,3° с задержкой; при остановке оно затухает. + +GIF: `walking.gif` — ходьба, поворот и остановка; `boots.gif` — обувь сбоку; +`outfit.gif` — обзор спереди и сзади. Это рендер настоящей 3D-модели в Godot. + +Воспроизведение из корня репозитория (Python с NumPy, Godot 4.3): + +```powershell +python tools/preview_succubus_heels.py +godot --headless --editor --path Demon_v0.19 --import +godot --path Demon_v0.19 --script res://reviews/heels_v01/review_tests.gd +godot --path Demon_v0.19 res://reviews/heels_v01/review.tscn +python tools/encode_succubus_review.py --ffmpeg PATH_TO_FFMPEG +``` + +Проверены размеры героини/помощницы, четыре скорости, 30/60 fps, поворот на 90°, +остановка, контакт с полом, достижимость IK и ограничение разворота стопы. +Регрессия основной походки: героиня и три помощницы, пять скоростей, повороты, +остановки, плеть, пауза и телепорт. Все проверки проходят. При импорте остаётся +предупреждение о вырожденной нормали при генерации LOD у исходной геометрии. diff --git a/Demon_v0.19/reviews/heels_v01/boots.gif b/Demon_v0.19/reviews/heels_v01/boots.gif new file mode 100644 index 0000000..8f300cd Binary files /dev/null and b/Demon_v0.19/reviews/heels_v01/boots.gif differ diff --git a/Demon_v0.19/reviews/heels_v01/outfit.gif b/Demon_v0.19/reviews/heels_v01/outfit.gif new file mode 100644 index 0000000..31e57bb Binary files /dev/null and b/Demon_v0.19/reviews/heels_v01/outfit.gif differ diff --git a/Demon_v0.19/reviews/heels_v01/review.gd b/Demon_v0.19/reviews/heels_v01/review.gd new file mode 100644 index 0000000..0e3d540 --- /dev/null +++ b/Demon_v0.19/reviews/heels_v01/review.gd @@ -0,0 +1,80 @@ +extends Node3D +var paused=false +var actors=[] +var camera: Camera3D +var folder="res://captures/heels-v01" +var max_yaw=0.0 +var max_error=0.0 +var headers=[] + +func _ready():call_deferred("run") +func block(at,size,color): + var node=MeshInstance3D.new();add_child(node);node.position=at + node.mesh=BoxMesh.new();node.mesh.size=size + var mat=StandardMaterial3D.new();mat.albedo_color=color;mat.roughness=.75;node.material_override=mat + return node +func lighting(): + var world=WorldEnvironment.new();add_child(world);world.environment=Environment.new() + world.environment.background_mode=Environment.BG_COLOR;world.environment.background_color=Color("282d34") + world.environment.ambient_light_source=Environment.AMBIENT_SOURCE_COLOR;world.environment.ambient_light_color=Color("b6c6d7");world.environment.ambient_light_energy=.65 + world.environment.tonemap_mode=Environment.TONE_MAPPER_FILMIC + for at in [Vector3(-4,6,5),Vector3(5,4,-3)]: + var light=OmniLight3D.new();add_child(light);light.position=at;light.light_energy=4;light.omni_range=24;light.shadow_enabled=true + block(Vector3(0,-.08,12),Vector3(80,.15,80),Color("41464d")) + camera=Camera3D.new();add_child(camera);camera.projection=Camera3D.PROJECTION_ORTHOGONAL;camera.current=true + var layer=CanvasLayer.new();add_child(layer) + for i in range(2): + var label=Label.new();layer.add_child(label);label.text="СЕЙЧАС" if i==0 else "КАБЛУКИ · ОБРАЗЕЦ" + label.position=Vector2(260+i*770,32);label.add_theme_font_size_override("font_size",28) + headers.append(label) + +func create_actors(): + for i in range(2): + var carrier=Node3D.new();add_child(carrier);carrier.position=Vector3(-1.1+i*2.2,0,0) + var actor=preload("res://succubus_actor.gd").new(preload("res://reviews/heels_v01/succubus_heels.glb") if i==1 else null) + carrier.add_child(actor);actor.rotation=Vector3.ZERO + if i==1:actor.gait=preload("res://reviews/heels_v01/review_gait.gd").new() + actor.configure(self);actor.set_process(false);actors.append(actor) + +func advance(dt,direction,speed): + for actor in actors: + actor.get_parent().position+=direction*speed*dt + if direction.length_squared()>.1:actor.rotation.y=lerp_angle(actor.rotation.y,atan2(direction.x,direction.z),minf(1,dt*10)) + actor._process(dt) + for f in actors[1].gait.feet: + max_yaw=maxf(max_yaw,absf(wrapf(f.yaw-actors[1].global_rotation.y,-PI,PI))) + max_error=maxf(max_error,actors[1].gait.point("foot."+f.side).distance_to(f.target)) + +func reset(): + for i in range(actors.size()): + var actor=actors[i];actor.restore_animation_pose();actor.get_parent().position=Vector3(-1.1+i*2.2,0,0);actor.rotation=Vector3.ZERO;actor.reset_gait() + +func shot(name,close=false): + var focus=actors[1].get_parent().position+Vector3(0,.57 if close else 1.28,0) + camera.size=1.65 if close else 3.15;camera.position=focus+(Vector3(5,.7,2.1) if close else Vector3(2.2,1.0,7));camera.look_at(focus) + await RenderingServer.frame_post_draw + var error=get_viewport().get_texture().get_image().save_png(folder+"/"+name+".png") + assert(error==OK) + +func run(): + DirAccess.make_dir_recursive_absolute(folder+"/full");DirAccess.make_dir_recursive_absolute(folder+"/feet");DirAccess.make_dir_recursive_absolute(folder+"/outfit") + lighting();create_actors();await get_tree().process_frame + actors[0].get_parent().hide();headers[0].hide();headers[1].position=Vector2(320,32);headers[1].text="ОБРАЗЕЦ · КРАСНЫЙ КОРСЕТ / ЧЁРНЫЕ БОТФОРТЫ" + for frame in range(72): + var direction=Vector3.BACK if frame<48 else Vector3(0.7,0,.7).normalized() + advance(1.0/24,direction,2.5 if frame<60 else 0) + await shot("full/%03d"%frame) + reset() + actors[0].get_parent().hide();headers[0].hide();headers[1].position=Vector2(500,32);headers[1].text="КАБЛУКИ · КРУПНЫЙ ПЛАН" + for frame in range(48): + advance(1.0/24,Vector3.BACK,2.5) + await shot("feet/%03d"%frame,true) + reset();headers[1].position=Vector2(410,32);headers[1].text="КОРСЕТ И КРЫЛЬЯ · ВИД СПЕРЕДИ И СЗАДИ" + for frame in range(96): + advance(1.0/24,Vector3.ZERO,0) + var focus=actors[1].get_parent().position+Vector3(0,1.52,0);var angle=TAU*frame/96 + camera.size=1.95;camera.position=focus+Vector3(sin(angle)*5,.45,cos(angle)*5);camera.look_at(focus) + await RenderingServer.frame_post_draw + get_viewport().get_texture().get_image().save_png(folder+"/outfit/%03d.png"%frame) + print("HEELS REVIEW METRICS ",JSON.stringify({"max_heading_twist_degrees":rad_to_deg(max_yaw),"max_ankle_target_error":max_error,"production_model_unchanged":true})) + get_tree().quit() diff --git a/Demon_v0.19/reviews/heels_v01/review.tscn b/Demon_v0.19/reviews/heels_v01/review.tscn new file mode 100644 index 0000000..04cd663 --- /dev/null +++ b/Demon_v0.19/reviews/heels_v01/review.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3] + +[ext_resource type="Script" path="res://reviews/heels_v01/review.gd" id="1"] + +[node name="HeelsApprovalStudio" type="Node3D"] +script = ExtResource("1") diff --git a/Demon_v0.19/reviews/heels_v01/review_gait.gd b/Demon_v0.19/reviews/heels_v01/review_gait.gd new file mode 100644 index 0000000..c5c7157 --- /dev/null +++ b/Demon_v0.19/reviews/heels_v01/review_gait.gd @@ -0,0 +1,29 @@ +extends "res://catwalk.gd" +# Approval-only settings: the default heroine and helpers still use catwalk.gd. +func _init(): + stride_min=.95;stride_max=1.28;track_width=.09;swing_height=.11 + +func ground_height(f):return super.ground_height(f)-.016*actor.global_basis.get_scale().y + +func update(dt): + super.update(dt) + # Secondary motion follows the travelled step cycle with a small phase delay. + # Both wing roots remain attached to the upper back; no active flight flaps. + for side in ["L","R"]: + var sign_x=1 if side=="L" else -1 + rotate_world("Wing."+side,actor.global_basis.y,sign_x*sin(phase*TAU-.7)*.035*walk_weight) + rotate_world("Wing."+side,actor.global_basis.z,sign_x*sin(phase*TAU*2-.5)*.022*walk_weight) + +func foot_orientation(f,dt): + var body_yaw=actor.global_rotation.y + # The planted shoe may pivot, but the ankle must never remain twisted behind + # a turning shin. Keep its heading within an anatomical range of the pelvis. + var difference=wrapf(f.yaw-body_yaw,-PI,PI) + if absf(difference)>deg_to_rad(22):f.yaw=body_yaw+clampf(difference,-deg_to_rad(22),deg_to_rad(22)) + var yaw=f.yaw if f.grounded else lerp_angle(f.yaw,body_yaw,minf(1,dt*18)) + if not f.grounded:f.yaw=yaw + var orientation=Quaternion(Vector3.UP,yaw)*f.rotation + # A high heel has a rigid arch. Lift the whole shoe with the leg rather than + # sharply flexing its toe or rolling it onto the outer edge during swing. + var roll=sin(clampf((f.last_phase-.5)*2,0,1)*PI)*-.045 if not f.grounded else 0.0 + return Quaternion(actor.global_basis.x.normalized(),roll)*orientation diff --git a/Demon_v0.19/reviews/heels_v01/review_tests.gd b/Demon_v0.19/reviews/heels_v01/review_tests.gd new file mode 100644 index 0000000..2227c59 --- /dev/null +++ b/Demon_v0.19/reviews/heels_v01/review_tests.gd @@ -0,0 +1,33 @@ +extends SceneTree +var failures=[] +func _initialize():call_deferred("run") +func check(ok,label): + if not ok and not label in failures:failures.append(label);push_error("HEEL REVIEW QA: "+label) +func run(): + var max_error=0.0;var max_twist=0.0;var max_wing=0.0 + for scale_y in [1.0,.82]: + var carrier=Node3D.new();root.add_child(carrier) + var actor=preload("res://succubus_actor.gd").new(preload("res://reviews/heels_v01/succubus_heels.glb"));carrier.add_child(actor);actor.scale=Vector3.ONE*scale_y;actor.rotation=Vector3.ZERO + actor.gait=preload("res://reviews/heels_v01/review_gait.gd").new();actor.configure(self);actor.set_process(false) + for speed in [1.0,2.5,3.3,5.775]: + for fps in [30,60]: + actor.restore_animation_pose();carrier.position=Vector3.ZERO;actor.rotation=Vector3.ZERO;actor.reset_gait() + for frame in range(fps*3): + var direction=Vector3.BACK if frame=actor.gait.ground_height(f)-.003,"ankles above floor") + var wi=actor.skeleton.find_bone("Wing.L");var wing=actor.skeleton.get_bone_pose_rotation(wi) + max_wing=maxf(max_wing,wing.angle_to(actor.animation_pose[wi].basis.get_rotation_quaternion())) + for frame in range(fps):actor._process(1.0/fps) + for f in actor.gait.feet:check(f.grounded,"stopping settles both shoes") + check(actor.gait.track_width>.065,"separate paths keep wide heels apart") + carrier.queue_free();await process_frame + check(max_error<.005,"IK reaches both shoes at both scales and four speeds") + check(max_twist<=deg_to_rad(22.01),"ankle heading never twists more than 22 degrees") + check(max_wing>.01 and max_wing<.10,"wings sway gently instead of active flapping") + print("HEEL REVIEW METRICS ",JSON.stringify({"max_ik_error":max_error,"max_heading_twist_degrees":rad_to_deg(max_twist),"max_wing_pose_angle":max_wing,"failures":failures})) + if failures.is_empty():print("ALL HEEL REVIEW TESTS PASSED: heroine/helper scales, four speeds, two frame rates, right-angle turns, stop, reach and ankle heading") + quit(0 if failures.is_empty() else 1) diff --git a/Demon_v0.19/reviews/heels_v01/succubus_heels.glb b/Demon_v0.19/reviews/heels_v01/succubus_heels.glb new file mode 100644 index 0000000..b11fa00 --- /dev/null +++ b/Demon_v0.19/reviews/heels_v01/succubus_heels.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94b7d635e3ebf83b401330db88653fe1f43fa55eaf9fc10d965e101de1749057 +size 97440636 diff --git a/Demon_v0.19/reviews/heels_v01/succubus_heels.glb.import b/Demon_v0.19/reviews/heels_v01/succubus_heels.glb.import new file mode 100644 index 0000000..62c5dbb --- /dev/null +++ b/Demon_v0.19/reviews/heels_v01/succubus_heels.glb.import @@ -0,0 +1,36 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://b40ohu0qjf1kh" +path="res://.godot/imported/succubus_heels.glb-400939aa4ad09f07f701f179acd4c508.scn" + +[deps] + +source_file="res://reviews/heels_v01/succubus_heels.glb" +dest_files=["res://.godot/imported/succubus_heels.glb-400939aa4ad09f07f701f179acd4c508.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/reviews/heels_v01/succubus_heels_skin_basecolor.png b/Demon_v0.19/reviews/heels_v01/succubus_heels_skin_basecolor.png new file mode 100644 index 0000000..db909fb Binary files /dev/null and b/Demon_v0.19/reviews/heels_v01/succubus_heels_skin_basecolor.png differ diff --git a/Demon_v0.19/reviews/heels_v01/succubus_heels_skin_basecolor.png.import b/Demon_v0.19/reviews/heels_v01/succubus_heels_skin_basecolor.png.import new file mode 100644 index 0000000..95a6fe8 --- /dev/null +++ b/Demon_v0.19/reviews/heels_v01/succubus_heels_skin_basecolor.png.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dwi03n3bee5by" +path="res://.godot/imported/succubus_heels_skin_basecolor.png-7e90812c18107351d58bd3920434c30d.ctex" +metadata={ +"vram_texture": false +} +generator_parameters={ +"md5": "6c375995b2643c42ccbe28db0302aae3" +} + +[deps] + +source_file="res://reviews/heels_v01/succubus_heels_skin_basecolor.png" +dest_files=["res://.godot/imported/succubus_heels_skin_basecolor.png-7e90812c18107351d58bd3920434c30d.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/reviews/heels_v01/walking.gif b/Demon_v0.19/reviews/heels_v01/walking.gif new file mode 100644 index 0000000..96fd197 Binary files /dev/null and b/Demon_v0.19/reviews/heels_v01/walking.gif differ diff --git a/Demon_v0.19/succubus_actor.gd b/Demon_v0.19/succubus_actor.gd index 1435fb8..ccd1335 100644 --- a/Demon_v0.19/succubus_actor.gd +++ b/Demon_v0.19/succubus_actor.gd @@ -9,11 +9,11 @@ var animation_pose: Array[Transform3D]=[] var skeleton: Skeleton3D -func _init(): +func _init(review_model: PackedScene=null): name="ApprovedSuccubus" set_meta("approved_model","succubus_v01") set_meta("wardrobe_revision","corset_thigh_boots_v02") - var model=preload("res://art/succubus/succubus_v02.glb").instantiate() + var model=(review_model if review_model else preload("res://art/succubus/succubus_v02.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 a008112..3e350f5 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -15,6 +15,41 @@ ## Последние выполненные задачи +- Новый актуальный ориентир пользователя после красного комплекта: три вида + суккубы (спереди, сзади и сбоку), чёрное бикини и броня/ботфорты на каблуках, + длинный высокий чёрный хвост волос, длинные рога, низкие коричневые крылья + с кожистой неровной перепонкой и тонкий шипастый хвост. Запрошены максимальная + точность, реализм и качество текстур. У пользователя нет исходного 3D-файла + и ссылки на автора; это реконструкция по изображениям, точное совпадение + исходной сетки и текстур не подтверждено. Этот референс заменяет красный + комплект ниже. Исправление стоп и слабое покачивание крыльев сохраняются. + +- Подготовлен **образец на согласование**, ещё не включённый в игровую сцену: + `Demon_v0.19/reviews/heels_v01`. Пользователь запросил каблуки и исправление + стоп при ходьбе, затем уточнил чёрные остроносые ботфорты на широком каблуке, + красный кожаный корсет с воротником/кольцами, ремнями, задней шнуровкой, + наплечниками-крыльями и большие крылья с лёгким покачиванием при ходьбе. + `walking.gif`, `boots.gif`, `outfit.gif` показывают настоящий 3D-образец. + Ожидается согласование внешнего вида и движения перед подключением героине + и помощницам. Исходный `art/succubus/succubus_v02.glb` не менялся. +- В образце стопы перепривязаны: сустав поднят на 8 см в координатах модели, + исправлены inverse bind matrices и трансляции клипов; подошва жёсткая, + отдельно от каблука, не деформируется пальцами. Предварительная походка: + короче шаг, больше зазор между обувью, разворот опорной стопы ограничен 22°. + Крылья на существующих `Wing.L/R` покачиваются примерно на 2,3° с фазовой + задержкой и затухают при остановке. Сам образец воспроизводится скриптами + `tools/preview_succubus_heels.py`, `succubus_review_outfit.py`, + `review_mesh_cut.py`, `encode_succubus_review.py`. +- Проверки образца `reviews/heels_v01/review_tests.gd`: PASS, размеры героини + и помощницы, 4 скорости, 30/60 fps, поворот 90°, остановка, IK, высота стоп, + ограничение разворота и малая амплитуда крыльев. Максимальная ошибка IK + менее 0,000005 м. `--test-gait`: PASS для прежней основной походки, героини + и трёх помощниц на пяти скоростях, с поворотами, паузой, плетью и телепортом. + Общий `catwalk.gd` получил настраиваемые параметры и метод ориентации стопы + с прежними значениями по умолчанию; `succubus_actor.gd` — необязательную + подстановку PackedScene для отдельной review-сцены. Обычная игра использует + прежние настройки. Остаётся старое предупреждение LOD о вырожденной нормали. + - Туман после последних уточнений опущен ниже колен, ближе к полу: `knee_fog.gdshader`, `density=.38675` (ещё -30% от `.5525`), `surface_height=.45` м вместо `.78`. Объём по высоте уменьшен до `.9` м. diff --git a/tools/encode_succubus_review.py b/tools/encode_succubus_review.py new file mode 100644 index 0000000..d659b15 --- /dev/null +++ b/tools/encode_succubus_review.py @@ -0,0 +1,17 @@ +"""Encode the exact frame ranges; ignore older surplus capture frames.""" +from pathlib import Path +import argparse +import subprocess + +parser=argparse.ArgumentParser() +parser.add_argument('--ffmpeg',required=True) +args=parser.parse_args() +root=Path(__file__).resolve().parent.parent +project=root/'Demon_v0.19' +out=project/'reviews/heels_v01' +for sequence,count,name in [('full',72,'walking'),('feet',48,'boots'),('outfit',96,'outfit')]: + subprocess.run([args.ffmpeg,'-hide_banner','-loglevel','error','-y','-framerate','24', + '-i',str(project/'captures/heels-v01'/sequence/'%03d.png'), + '-filter_complex','[0:v]scale=1120:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=192[p];[b][p]paletteuse=dither=sierra2_4a', + '-frames:v',str(count),'-loop','0',str(out/(name+'.gif'))],check=True) + print(name,count,'frames',flush=True) diff --git a/tools/preview_succubus_heels.py b/tools/preview_succubus_heels.py new file mode 100644 index 0000000..eeb64e7 --- /dev/null +++ b/tools/preview_succubus_heels.py @@ -0,0 +1,188 @@ +"""Build an approval-only shoe revision; keep the production GLB unchanged.""" +from pathlib import Path +import copy +import json +import struct +import numpy as np + +root = Path(__file__).resolve().parent.parent +source = root / 'Demon_v0.19/art/succubus/succubus_v02.glb' +target = root / 'Demon_v0.19/reviews/heels_v01/succubus_heels.glb' +raw = source.read_bytes() +length = struct.unpack_from('.25 + faces=faces[~old_wing[faces].any(axis=1)] + if p['material'] in [0,4,10]: + center=v[faces].mean(axis=1);x=center[:,0] + cup_top=1.313-.060*np.exp(-(x/.037)**2)+.018*np.exp(-((np.abs(x)-.105)/.055)**2) + trim=(center[:,1]>cup_top)&(center[:,1]<1.385)&(center[:,2]>.07)&(np.abs(x)<.225) + faces=faces[~trim] + if p['material']==3: + arm_ids=[k for k,node in enumerate(joints) if 'arm' in doc['nodes'][node].get('name','')] + arm=(np.isin(j,arm_ids)*w).sum(axis=1)>.30 + faces=faces[~arm[faces].any(axis=1)] + faces=faces[v[faces].mean(axis=1)[:,1]>1.045] + if p['material'] in [4,10]: + center=v[faces].mean(axis=1) + faces=faces[~((center[:,1]>.12)&(center[:,1]<.74)&(np.abs(center[:,0])<.30))] + if not len(faces):continue + p['indices']=accessor(faces.reshape(-1,1),'SCALAR',5125) + if p['material'] in [0,1,10,16,17]: + mask=(v[:,1]<.17)&(v[:,2]>.09)&(np.abs(v[:,0])<.3) + t=np.clip((v[mask,2]-.09)/.15,0,1) + center=np.sign(v[mask,0])*.1745 + v[mask,0]=center+(v[mask,0]-center)*(1-.78*t*t) + v[mask,2]+=.046*t*t + foot=(v[:,1]<.145)&(np.abs(v[:,0])<.3) + bottom=np.interp(v[foot,2],[-.06,-.025,.025,.080,.135,.190,.230,.285],[.105,.107,.091,.050,.013,.008,.010,.015]) + v[foot,1]=np.maximum(v[foot,1],bottom+.015) + attr['POSITION']=accessor(v,'VEC3') + faces=read(p['indices']).reshape(-1,3).astype(np.int64) + normal=np.zeros_like(v);cross=np.cross(v[faces[:,1]]-v[faces[:,0]],v[faces[:,2]]-v[faces[:,0]]) + for k in range(3):np.add.at(normal,faces[:,k],cross) + normal/=np.maximum(np.linalg.norm(normal,axis=1,keepdims=True),1e-12) + attr['NORMAL']=accessor(normal,'VEC3');attr.pop('TANGENT',None) + for i in np.flatnonzero((v[:,1]<.14)&(np.abs(v[:,0])<.30)): + side='L' if v[i,0]>0 else 'R'; foot=foot_ids[side] + # Shoes must not flex with the toes: a stiletto and sole are one rigid piece. + if v[i,1]<.105 or p['material'] in [0,10]: + j[i]=[foot,0,0,0]; w[i]=[1,0,0,0] + attr['JOINTS_0']=accessor(j,'VEC4',5123);attr['WEIGHTS_0']=accessor(w,'VEC4') + primitives.append(p) + +def mesh(vertices, faces, foot, material,smooth=False): + vertices=np.asarray(vertices,dtype='1e-10] + # Flat faces preserve crisp bevels on leather panels, soles and heels. + pos=vertices[faces].reshape(-1,3);normal=np.cross(vertices[faces[:,1]]-vertices[faces[:,0]],vertices[faces[:,2]]-vertices[faces[:,0]]) + normal/=np.maximum(np.linalg.norm(normal,axis=1,keepdims=True),1e-12) + normals=np.repeat(normal,3,axis=0) + if smooth: + averaged=np.zeros_like(vertices) + for k in range(3):np.add.at(averaged,faces[:,k],normal) + averaged/=np.maximum(np.linalg.norm(averaged,axis=1,keepdims=True),1e-12) + normals=averaged[faces].reshape(-1,3) + attr={'POSITION':accessor(pos,'VEC3'),'NORMAL':accessor(normals,'VEC3'), + 'JOINTS_0':accessor(np.tile([foot,0,0,0],(len(pos),1)),'VEC4',5123), + 'WEIGHTS_0':accessor(np.tile([1,0,0,0],(len(pos),1)),'VEC4')} + primitives.append({'attributes':attr,'material':material,'indices':accessor(np.arange(len(pos)).reshape(-1,1),'SCALAR',5125)}) + +for side,sign in [('L',1),('R',-1)]: + x=sign*.1745;foot=foot_ids[side] + vertices=[];faces=[];rings=[(.006,.026,.031,-.040),(.018,.025,.030,-.039),(.078,.028,.032,-.030),(.112,.031,.034,-.024)] + outline=[(-.72,-1),(.72,-1),(1,-.72),(1,.72),(.72,1),(-.72,1),(-1,.72),(-1,-.72)] + for y,rx,rz,z in rings: + for dx,dz in outline:vertices.append([x+dx*rx,y,z+dz*rz]) + for ring in range(3): + for n in range(8): + a=ring*8+n;b=ring*8+(n+1)%8;c=b+8;d=a+8;faces.extend([[a,c,b],[a,d,c]]) + for n in range(1,7):faces.extend([[0,n,n+1],[24,24+n+1,24+n]]) + mesh(vertices,faces,foot,17) + # Closed sculpted outsole: raised heel seat, concave arch, low forefoot. + sections=[(-.060,.021,.105),(-.025,.040,.107),(.025,.042,.091),(.080,.038,.050),(.135,.043,.013),(.190,.033,.008),(.250,.015,.010),(.285,.002,.015)] + vertices=[];faces=[] + for z,width,y in sections: + vertices.extend([[x-width,y,z],[x+width,y,z],[x+width,y+.013,z],[x-width,y+.013,z]]) + for n in range(len(sections)-1): + for edge in range(4): + a=n*4+edge;b=n*4+(edge+1)%4;c=b+4;d=a+4;faces.extend([[a,b,c],[a,c,d]]) + faces.extend([[0,2,1],[0,3,2]]);a=(len(sections)-1)*4;faces.extend([[a,a+1,a+2],[a,a+2,a+3]]) + mesh(vertices,faces,foot,sole_material) + +from succubus_review_outfit import augment +augment(doc,read,mesh,primitives,accessor) +primitives=[p for p in primitives if doc['accessors'][p['indices']]['count']>0 and doc['accessors'][p['attributes']['POSITION']]['count']>0] +doc['meshes'][1]['primitives']=primitives +doc['meshes'][1]['name']='Approval only - red bat corset, black block heel boots and curved wings' +# Remove superseded buffer data, so the approval model remains portable. +used=set() +for m in doc['meshes']: + for p in m['primitives']: + used.update(p['attributes'].values()) + if 'indices' in p:used.add(p['indices']) + for morph in p.get('targets',[]):used.update(morph.values()) +for skin in doc['skins']: + if 'inverseBindMatrices' in skin:used.add(skin['inverseBindMatrices']) +for animation in doc.get('animations',[]): + for sampler in animation['samplers']:used.update([sampler['input'],sampler['output']]) +mapping={old:new for new,old in enumerate(sorted(used))} +doc['accessors']=[doc['accessors'][old] for old in sorted(used)] +for m in doc['meshes']: + for p in m['primitives']: + p['attributes']={key:mapping[value] for key,value in p['attributes'].items()} + if 'indices' in p:p['indices']=mapping[p['indices']] + p['targets']=[{key:mapping[value] for key,value in morph.items()} for morph in p.get('targets',[])] if 'targets' in p else [] +for skin in doc['skins']: + if 'inverseBindMatrices' in skin:skin['inverseBindMatrices']=mapping[skin['inverseBindMatrices']] +for animation in doc.get('animations',[]): + for sampler in animation['samplers']: + sampler['input']=mapping[sampler['input']];sampler['output']=mapping[sampler['output']] +used_views={a['bufferView'] for a in doc['accessors']} +used_views.update(i['bufferView'] for i in doc.get('images',[]) if 'bufferView' in i) +view_map={old:new for new,old in enumerate(sorted(used_views))};new_blob=bytearray();views=[] +for old in sorted(used_views): + view=copy.deepcopy(doc['bufferViews'][old]);start=view.get('byteOffset',0) + new_blob.extend(b'\0'*((-len(new_blob))%4));view['byteOffset']=len(new_blob) + new_blob.extend(blob[start:start+view['byteLength']]);views.append(view) +for a in doc['accessors']:a['bufferView']=view_map[a['bufferView']] +for image in doc.get('images',[]): + if 'bufferView' in image:image['bufferView']=view_map[image['bufferView']] +doc['bufferViews']=views;blob=new_blob +doc['buffers'][0]['byteLength']=len(blob) +data=json.dumps(doc,separators=(',',':')).encode();data+=b' '*((-len(data))%4);blob.extend(b'\0'*((-len(blob))%4)) +target.parent.mkdir(parents=True,exist_ok=True) +target.write_bytes(struct.pack('=0:result.append(a) + if (va>=0)!=(vb>=0):result.append(a+(b-a)*(va/(va-vb))) + return result + for sign,material in [(1,positive_material),(-1,negative_material)]: + if material is None:continue + rows={key:[] for key in arrays} + for face in faces[selected]: + values=np.array([signed_distance(p) for p in arrays['POSITION'][face]]) + poly=clip(list(np.eye(3)),values,sign) + for i in range(1,len(poly)-1): + for bary in [poly[0],poly[i],poly[i+1]]: + for key,array in arrays.items(): + if key in ['JOINTS_0','WEIGHTS_0']:continue + value=bary@array[face] + if key=='NORMAL':value/=max(np.linalg.norm(value),1e-12) + rows[key].append(value) + weights={} + for corner in range(3): + for joint,weight in zip(arrays['JOINTS_0'][face[corner]],arrays['WEIGHTS_0'][face[corner]]): + weights[int(joint)]=weights.get(int(joint),0)+float(weight)*bary[corner] + pairs=sorted(weights.items(),key=lambda x:-x[1])[:4];pairs+=[(0,0)]*(4-len(pairs));total=max(sum(w for _,w in pairs),1e-12) + rows['JOINTS_0'].append([j for j,_ in pairs]);rows['WEIGHTS_0'].append([w/total for _,w in pairs]) + if not rows['POSITION']:continue + attrs={} + for key,values in rows.items(): + original=doc['accessors'][primitive['attributes'][key]] + attrs[key]=accessor(values,original['type'],original['componentType']) + output.append({'attributes':attrs,'material':material,'indices':accessor(np.arange(len(rows['POSITION'])).reshape(-1,1),'SCALAR',5125)}) + primitive['indices']=accessor(faces[~selected].reshape(-1,1),'SCALAR',5125) + return output diff --git a/tools/succubus_review_outfit.py b/tools/succubus_review_outfit.py new file mode 100644 index 0000000..fea10ec --- /dev/null +++ b/tools/succubus_review_outfit.py @@ -0,0 +1,133 @@ +"""Reference-based red leather outfit and bat wings for the approval model.""" +import numpy as np +from review_mesh_cut import split_material + +def augment(doc, read, mesh, primitives,accessor): + joints=doc['skins'][0]['joints'] + def bone(name):return joints.index(next(i for i,n in enumerate(doc['nodes']) if n.get('name')==name)) + def material(name,color,metal=0,rough=.4): + i=len(doc['materials']);doc['materials'].append({'name':name,'doubleSided':True,'pbrMetallicRoughness':{'baseColorFactor':[*color,1],'metallicFactor':metal,'roughnessFactor':rough}});return i + red=material('Crimson fitted leather',[.32,.009,.018],.06,.32) + seam=material('Red leather stitched piping',[.12,.004,.009],0,.47) + silver=material('Antique silver buckles and eyelets',[.46,.48,.50],.9,.25) + membrane=material('Rose burgundy bat membrane',[.29,.045,.065],0,.58) + spar=material('Dark living wing spars',[.045,.009,.016],0,.44) + doc['materials'][3]['pbrMetallicRoughness'].update(baseColorFactor=[.28,.008,.017,1],roughnessFactor=.34) + body=read(next(p for p in primitives if p['material']==1)['attributes']['POSITION']) + for p in list(primitives): + if p['material'] in [16,17]: + positions=read(p['attributes']['POSITION']);faces=read(p['indices']).reshape(-1,3).astype(np.int64);center=positions[faces].mean(axis=1) + edge=(center[:,1]>.67)&(center[:,1]<.78)&(np.abs(positions[faces][:,:,0]).max(axis=1)<.30) + if edge.any():primitives.extend(split_material(p,edge,lambda point:.72-point[1],17,16,doc,read,accessor)) + if p['material']==3: + positions=read(p['attributes']['POSITION']);faces=read(p['indices']).reshape(-1,3).astype(np.int64);center=positions[faces].mean(axis=1) + front=(center[:,2]>.07)&(center[:,1]>1.23)&(np.abs(center[:,0])<.225) + def cup(point): + x,y,z=point;top=1.313-.060*np.exp(-(x/.037)**2)+.018*np.exp(-((abs(x)-.105)/.055)**2) + return top-y + primitives.extend(split_material(p,front,cup,3,None,doc,read,accessor)) + continue + if p['material'] not in [1,16]:continue + positions=read(p['attributes']['POSITION']);faces=read(p['indices']).reshape(-1,3).astype(np.int64);center=positions[faces].mean(axis=1) + region=(center[:,1]>.78)&(center[:,1]<1.04)&(np.abs(positions[faces][:,:,0]).max(axis=1)<.24) + primitives.extend(split_material(p,region,lambda point:point[1]-.82-.8125*abs(point[0]),red,16,doc,read,accessor)) + def surface(x,y,front=True): + distance=(body[:,0]-x)**2+(body[:,1]-y)**2 + near=body[np.argpartition(distance,20)[:20]] + z=near[:,2].max()+.012 if front else near[:,2].min()-.012 + return np.array([x,y,z]) + def tube(points,radius,mat,bn,radii=None): + points=np.array(points);v=[];f=[] + for i,p in enumerate(points): + tangent=points[min(i+1,len(points)-1)]-points[max(0,i-1)];tangent/=max(np.linalg.norm(tangent),1e-8) + axis=np.array([0.,0.,1.]) if abs(tangent[2])<.9 else np.array([0.,1.,0.]) + u=np.cross(tangent,axis);u/=max(np.linalg.norm(u),1e-8);w=np.cross(tangent,u) + r=radius*(radii[i] if radii is not None else 1) + for j in range(8):v.append(p+r*(u*np.cos(j*np.pi/4)+w*np.sin(j*np.pi/4))) + for i in range(len(points)-1): + for j in range(8): + a=i*8+j;b=i*8+(j+1)%8;f.extend([[a,b,b+8],[a,b+8,a+8]]) + mesh(v,f,bn,mat,True) + def ring(at,rx,ry,wire,mat,bn): + at=np.array(at);tube([at+np.array([rx*np.cos(a),ry*np.sin(a),0]) for a in np.linspace(0,2*np.pi,33)],wire,mat,bn) + def strap(points,width,mat,bn): + points=np.array(points);v=[];f=[] + for i,p in enumerate(points): + tangent=points[min(i+1,len(points)-1)]-points[max(0,i-1)] + normal=np.cross(tangent,[0,0,1]);normal/=max(np.linalg.norm(normal),1e-8) + v.extend([p-normal*width/2,p+normal*width/2]) + for i in range(len(points)-1):a=i*2;f.extend([[a,a+1,a+3],[a,a+3,a+2]]) + mesh(v,f,bn,mat) + def band(y,rx,rz,z,height,mat,bn,x=0): + v=[];f=[] + for a in np.linspace(0,2*np.pi,65): + v.extend([[x+rx*np.cos(a),y-height/2,z+rz*np.sin(a)],[x+rx*np.cos(a),y+height/2,z+rz*np.sin(a)]]) + for i in range(64):a=i*2;f.extend([[a,a+1,a+3],[a,a+3,a+2]]) + mesh(v,f,bn,mat) + def buckle(at,width,height,bn): + at=np.array(at);outline=[[-width/2,-height/2,0],[width/2,-height/2,0],[width/2,height/2,0],[-width/2,height/2,0],[-width/2,-height/2,0]] + tube([at+v for v in np.array(outline)],.0025,silver,bn) + tube([at+[-width/2,0,0],at+[width*.12,0,.002]],.0017,silver,bn) + def rivet(p,bn):ring(p,.0025,.0025,.0018,silver,bn) + + neck=bone('neck02');chest=bone('spine02');waist=bone('spine04') + band(1.468,.067,.065,.025,.092,red,neck) + for y,r in [(1.49,.012),(1.455,.018),(1.415,.016)]:ring([0,y,.095],r,r,.0024,silver,neck) + for y in [1.495,1.468,1.441]:buckle([0,y,-.044],.025,.018,neck) + band(1.045,.145,.100,.052,.028,red,waist);buckle([0,1.045,.160],.042,.030,waist) + for sign in [-1,1]: + for front in [True,False]: + path=[surface(sign*x,y,front) for x,y in [(.045,1.425),(.090,1.385),(.145,1.335),(.185,1.285)]] + strap(path,.021,red,chest) + for p in path[1:]:rivet(p+np.array([0,0,.001 if front else -.001]),chest) + for x in [.055,.105]: + tube([surface(sign*x,y) for y in np.linspace(.98,1.29,20)],.0016,seam,chest) + # Four fan panels create the small leather bat-wing shoulder silhouette. + bn=bone('clavicle.L' if sign>0 else 'clavicle.R') + center=np.array([sign*.265,1.365,.045]) + edge=np.array([[.20,1.405,.025],[.455,1.475,.01],[.390,1.385,.035],[.46,1.305,.025],[.355,1.305,.04],[.365,1.225,.015],[.215,1.29,.03]]) + edge[:,0]*=sign + mesh([center,*edge],[[0,i+1,(i+1)%len(edge)+1] for i in range(len(edge))],bn,red) + tube([*edge,edge[0]],.0022,seam,bn) + for j in [1,3,5]:tube([center,center*.45+edge[j]*.55+np.array([0,0,.009]),edge[j]],.0033,seam,bn,[1,.9,.15]) + rivet(center+np.array([0,0,.009]),bn) + thigh=bone('upperleg01.L' if sign>0 else 'upperleg01.R') + if sign==1: + for front in [True,False]: + tube([surface(x,.82+.8125*abs(x),front) for x in np.linspace(-.155,.155,45)],.0024,seam,waist) + for y in [.782,.815]:band(y,.082,.078,.045,.018,red,thigh,sign*.135) + for front in [True,False]: + path=[surface(sign*x,y,front) for x,y in [(.13,.955),(.15,.905),(.16,.85),(.16,.812)]] + strap(path,.016,red,thigh);buckle(path[-2],.023,.025,thigh) + # Visible crossed rear lacing, separate metal eyelets and loose tied ends. + for y in np.linspace(.97,1.29,12): + for sign in [-1,1]: + p=surface(sign*.022,y,False);ring(p,.0037,.0037,.0012,silver,chest) + tube([surface(-.022,y,False),surface(.022,y+.014,False)],.0014,red,chest) + tube([surface(.022,y,False),surface(-.022,y+.014,False)],.0014,red,chest) + knot=surface(0,1.04,False) + for sign in [-1,1]: + tube([knot,knot+[sign*.035,-.018,-.01],knot+[sign*.022,-.038,-.015],knot],.0018,red,chest) + tube([knot,knot+[sign*.009,-.08,-.02],knot+[sign*.02,-.12,-.012]],.0016,red,chest) + + # New curved bat wings are weighted to the existing independent wing bones. + for side,sign in [('L',1),('R',-1)]: + bn=bone('Wing.'+side) + root=np.array([sign*.12,1.39,-.09]);knuckle=np.array([sign*.36,1.97,-.15]) + tips=np.array([[.73,2.015,-.18],[1.06,1.775,-.20],[.98,1.19,-.18],[.69,.80,-.15],[.35,.88,-.11]]) + tips[:,0]*=sign;edge=[root,*tips,root+[0,-.20,-.02]] + tube([root,root*.45+knuckle*.55+np.array([sign*.035,.08,0]),knuckle,knuckle+[sign*.025,.12,.01],knuckle+[sign*.005,.16,.02]],.017,spar,bn,[1.2,1,.7,.4,.02]) + for tip in tips: + tube([knuckle,knuckle*.55+tip*.45+np.array([0,.035,-.025]),tip],.010,spar,bn,[1,.7,.035]) + for a,b in zip(edge[:-1],edge[1:]): + v=[];f=[];n=16 + for row in range(n+1): + u=row/n + for col in range(n+1): + t=col/n;boundary=a*(1-t)+b*t+(knuckle-(a+b)/2)*(.30*np.sin(np.pi*t)) + p=knuckle*(1-u)+boundary*u;p[2]-=.045*np.sin(np.pi*u)*np.sin(np.pi*t);v.append(p) + for row in range(n): + for col in range(n): + k=row*(n+1)+col;f.extend([[k,k+1,k+n+2],[k,k+n+2,k+n+1]]) + mesh(v,f,bn,membrane,True) + tube([a*(1-t)+b*t+(knuckle-(a+b)/2)*(.30*np.sin(np.pi*t)) for t in np.linspace(0,1,25)],.003,spar,bn)