diff --git a/assets/vehicles/bastion/bastion.glb b/assets/vehicles/bastion/bastion.glb new file mode 100644 index 0000000..aada0cf Binary files /dev/null and b/assets/vehicles/bastion/bastion.glb differ diff --git a/assets/vehicles/bastion/manifest.json b/assets/vehicles/bastion/manifest.json new file mode 100644 index 0000000..43f8d8a --- /dev/null +++ b/assets/vehicles/bastion/manifest.json @@ -0,0 +1,151 @@ +{ + "schema": "rtd.vehicle.manifest.v1", + "id": "bastion", + "name": "Bastion", + "class": "Heavy Siege Quadruped", + "plane": "Dorsal", + "gridWidth": 6, + "gridHeight": 6, + "mask": [ + false, + false, + true, + true, + false, + false, + false, + true, + true, + true, + true, + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false + ], + "hardpoints": [ + { + "id": "hp.armor.prow", + "kind": "armor", + "x": 2, + "y": 0, + "w": 2, + "h": 1, + "modelNodeId": "hp.armor.prow" + }, + { + "id": "hp.weapon.turret_pd", + "kind": "weapon", + "x": 1, + "y": 1, + "w": 1, + "h": 1, + "modelNodeId": "hp.weapon.turret_pd" + }, + { + "id": "hp.weapon.turret_main", + "kind": "weapon", + "x": 2, + "y": 1, + "w": 2, + "h": 2, + "modelNodeId": "hp.weapon.turret_main" + }, + { + "id": "hp.weapon.flank_l", + "kind": "weapon", + "x": 0, + "y": 2, + "w": 1, + "h": 2, + "modelNodeId": "hp.weapon.flank_l" + }, + { + "id": "hp.weapon.flank_r", + "kind": "weapon", + "x": 5, + "y": 2, + "w": 1, + "h": 2, + "modelNodeId": "hp.weapon.flank_r" + }, + { + "id": "hp.engine.core", + "kind": "engine", + "x": 2, + "y": 3, + "w": 2, + "h": 2, + "modelNodeId": "hp.engine.core" + }, + { + "id": "hp.radiator.rear_l", + "kind": "radiator", + "x": 1, + "y": 4, + "w": 1, + "h": 2, + "modelNodeId": "hp.radiator.rear_l" + }, + { + "id": "hp.radiator.rear_r", + "kind": "radiator", + "x": 4, + "y": 4, + "w": 1, + "h": 2, + "modelNodeId": "hp.radiator.rear_r" + } + ], + "joints": [ + { + "id": "joint.turret_yaw", + "axis": [ + 0.0, + 1.0, + 0.0 + ], + "min": -180.0, + "max": 180.0 + } + ], + "bounds": { + "min": [ + -6.6043, + 0.0, + -8.043 + ], + "max": [ + 6.6094, + 9.625, + 6.7519 + ], + "size": [ + 13.2137, + 9.625, + 14.7949 + ] + }, + "triCount": 36656 +} diff --git a/assets/vehicles/kestrel/kestrel.glb b/assets/vehicles/kestrel/kestrel.glb new file mode 100644 index 0000000..7fa9af3 Binary files /dev/null and b/assets/vehicles/kestrel/kestrel.glb differ diff --git a/assets/vehicles/kestrel/manifest.json b/assets/vehicles/kestrel/manifest.json new file mode 100644 index 0000000..a8307bd --- /dev/null +++ b/assets/vehicles/kestrel/manifest.json @@ -0,0 +1,133 @@ +{ + "schema": "rtd.vehicle.manifest.v1", + "id": "kestrel", + "name": "Kestrel", + "class": "Light Scout Biped", + "plane": "Coronal", + "gridWidth": 5, + "gridHeight": 5, + "mask": [ + false, + false, + true, + false, + false, + false, + true, + true, + true, + false, + false, + true, + true, + true, + true, + false, + true, + true, + true, + true, + false, + true, + false, + true, + false + ], + "hardpoints": [ + { + "id": "hp.weapon.dorsal", + "kind": "weapon", + "x": 2, + "y": 0, + "w": 1, + "h": 1, + "modelNodeId": "hp.weapon.dorsal" + }, + { + "id": "hp.armor.chest", + "kind": "armor", + "x": 2, + "y": 1, + "w": 1, + "h": 1, + "modelNodeId": "hp.armor.chest" + }, + { + "id": "hp.radiator.back", + "kind": "radiator", + "x": 1, + "y": 2, + "w": 1, + "h": 1, + "modelNodeId": "hp.radiator.back" + }, + { + "id": "hp.engine.core", + "kind": "engine", + "x": 2, + "y": 2, + "w": 1, + "h": 2, + "modelNodeId": "hp.engine.core" + }, + { + "id": "hp.weapon.arm_r", + "kind": "weapon", + "x": 4, + "y": 2, + "w": 1, + "h": 2, + "modelNodeId": "hp.weapon.arm_r" + } + ], + "joints": [ + { + "id": "joint.torso_yaw", + "axis": [ + 0.0, + 1.0, + 0.0 + ], + "min": -90.0, + "max": 90.0 + }, + { + "id": "joint.arm_l_pitch", + "axis": [ + 1.0, + 0.0, + 0.0 + ], + "min": -45.0, + "max": 60.0 + }, + { + "id": "joint.arm_r_pitch", + "axis": [ + 1.0, + 0.0, + 0.0 + ], + "min": -45.0, + "max": 60.0 + } + ], + "bounds": { + "min": [ + -2.6628, + 0.0, + -2.0753 + ], + "max": [ + 2.6048, + 9.7815, + 2.378 + ], + "size": [ + 5.2676, + 9.7815, + 4.4533 + ] + }, + "triCount": 37558 +} diff --git a/assets/vehicles/spectre/manifest.json b/assets/vehicles/spectre/manifest.json new file mode 100644 index 0000000..f7640e7 --- /dev/null +++ b/assets/vehicles/spectre/manifest.json @@ -0,0 +1,156 @@ +{ + "schema": "rtd.vehicle.manifest.v1", + "id": "spectre", + "name": "Spectre", + "class": "Medium Recon/Skirmisher Biped", + "plane": "Coronal", + "gridWidth": 5, + "gridHeight": 6, + "mask": [ + false, + true, + false, + false, + false, + false, + true, + true, + true, + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + false, + true, + false, + true, + false, + false, + true, + false, + true, + false + ], + "hardpoints": [ + { + "id": "hp.weapon.shoulder_l", + "kind": "weapon", + "x": 1, + "y": 0, + "w": 1, + "h": 1, + "modelNodeId": "hp.weapon.shoulder_l" + }, + { + "id": "hp.armor.torso", + "kind": "armor", + "x": 2, + "y": 1, + "w": 1, + "h": 1, + "modelNodeId": "hp.armor.torso" + }, + { + "id": "hp.weapon.arm_l", + "kind": "weapon", + "x": 0, + "y": 2, + "w": 1, + "h": 2, + "modelNodeId": "hp.weapon.arm_l" + }, + { + "id": "hp.radiator.back_l", + "kind": "radiator", + "x": 1, + "y": 2, + "w": 1, + "h": 1, + "modelNodeId": "hp.radiator.back_l" + }, + { + "id": "hp.engine.core", + "kind": "engine", + "x": 2, + "y": 2, + "w": 1, + "h": 2, + "modelNodeId": "hp.engine.core" + }, + { + "id": "hp.radiator.back_r", + "kind": "radiator", + "x": 3, + "y": 2, + "w": 1, + "h": 1, + "modelNodeId": "hp.radiator.back_r" + }, + { + "id": "hp.weapon.arm_r", + "kind": "weapon", + "x": 4, + "y": 2, + "w": 1, + "h": 2, + "modelNodeId": "hp.weapon.arm_r" + } + ], + "joints": [ + { + "id": "joint.torso_yaw", + "axis": [ + 0.0, + 1.0, + 0.0 + ], + "min": -90.0, + "max": 90.0 + }, + { + "id": "joint.arm_l_pitch", + "axis": [ + 1.0, + 0.0, + 0.0 + ], + "min": -45.0, + "max": 60.0 + }, + { + "id": "joint.arm_r_pitch", + "axis": [ + 1.0, + 0.0, + 0.0 + ], + "min": -45.0, + "max": 60.0 + } + ], + "bounds": { + "min": [ + -3.4467, + -0.0, + -2.442 + ], + "max": [ + 3.8332, + 8.9891, + 3.6426 + ], + "size": [ + 7.2799, + 8.9891, + 6.0846 + ] + }, + "triCount": 39288 +} diff --git a/assets/vehicles/spectre/spectre.glb b/assets/vehicles/spectre/spectre.glb new file mode 100644 index 0000000..b95b839 Binary files /dev/null and b/assets/vehicles/spectre/spectre.glb differ diff --git a/tools/vehicles/previews/bastion_preview.png b/tools/vehicles/previews/bastion_preview.png new file mode 100644 index 0000000..96022c9 Binary files /dev/null and b/tools/vehicles/previews/bastion_preview.png differ diff --git a/tools/vehicles/previews/kestrel_preview.png b/tools/vehicles/previews/kestrel_preview.png new file mode 100644 index 0000000..3b88f01 Binary files /dev/null and b/tools/vehicles/previews/kestrel_preview.png differ diff --git a/tools/vehicles/previews/spectre_preview.png b/tools/vehicles/previews/spectre_preview.png new file mode 100644 index 0000000..dc1eb12 Binary files /dev/null and b/tools/vehicles/previews/spectre_preview.png differ diff --git a/tools/vehicles/retrofit_mechs.py b/tools/vehicles/retrofit_mechs.py index 4b0a971..aac0d35 100644 --- a/tools/vehicles/retrofit_mechs.py +++ b/tools/vehicles/retrofit_mechs.py @@ -67,6 +67,7 @@ class MechRetrofitSpec: drop_collections: tuple[str, ...] = () strip_prefixes: tuple[str, ...] = () strip_vertex_groups: tuple[str, ...] = () + strip_islands: tuple[tuple[str, str, float], ...] = () armature_name: str | None = None hardpoints: tuple[HardpointMount, ...] = () joints: tuple[JointTagSpec, ...] = () @@ -214,6 +215,112 @@ SPECS: dict[str, MechRetrofitSpec] = { JointTagSpec("joint.tail_elev", "Tail.Elev", None, (1.0, 0.0, 0.0), -40.0, 30.0), ), ), + "bastion": MechRetrofitSpec( + mech_id="bastion", + name="Bastion", + vehicle_class="Heavy Siege Quadruped", + plane="Dorsal", + grid_width=6, + grid_height=6, + mask=( + "..##..", + ".####.", + "######", + "######", + ".####.", + ".#..#.", + ), + blend_path=Path(r"F:\aeth-wt\fable-bastion-2\out\bastion\bastion.blend"), + model_json_path=None, + target_mech_tris=32000, + strip_prefixes=("Rig", "Cam", "Sun", "Back", "Bounce", "Ground", "Horizon", "Aim.Gun", "Gun.", "Magazine.", "Interceptor."), + hardpoints=( + HardpointMount("hp.armor.prow", "armor", 2, 0, 2, 1, "Trunk", None, (0.0, 5.16, 6.50), (0.0, 0.29, 0.96), (1.35, 0.42, 0.12)), + HardpointMount("hp.weapon.turret_pd", "weapon", 1, 1, 1, 1, "Aim.Turret", None, (0.0, -1.80, 9.11), (0.0, 0.0, 1.0), (0.68, 0.68, 0.12)), + HardpointMount("hp.weapon.turret_main", "weapon", 2, 1, 2, 2, "Aim.Turret", None, (0.0, 0.45, 9.07), (0.0, 0.03, 1.0), (1.30, 1.30, 0.16)), + HardpointMount("hp.weapon.flank_l", "weapon", 0, 2, 1, 2, "Trunk", None, (-3.70, -0.22, 6.18), (-1.0, 0.0, 0.0), (0.85, 0.85, 0.14)), + HardpointMount("hp.weapon.flank_r", "weapon", 5, 2, 1, 2, "Trunk", None, (3.70, -0.22, 6.18), (1.0, 0.0, 0.0), (0.85, 0.85, 0.14)), + HardpointMount("hp.engine.core", "engine", 2, 3, 2, 2, "Trunk", None, (0.0, -5.70, 7.34), (0.0, 0.0, 1.0), (1.50, 1.35, 0.16)), + HardpointMount("hp.radiator.rear_l", "radiator", 1, 4, 1, 2, "Trunk", None, (-2.55, -5.75, 7.38), (0.0, 0.0, 1.0), (0.98, 1.38, 0.14)), + HardpointMount("hp.radiator.rear_r", "radiator", 4, 4, 1, 2, "Trunk", None, (2.55, -5.75, 7.38), (0.0, 0.0, 1.0), (0.98, 1.38, 0.14)), + ), + joints=( + JointTagSpec("joint.turret_yaw", "Aim.Turret", None, (0.0, 1.0, 0.0), -180.0, 180.0), + ), + ), + "spectre": MechRetrofitSpec( + mech_id="spectre", + name="Spectre", + vehicle_class="Medium Recon/Skirmisher Biped", + plane="Coronal", + grid_width=5, + grid_height=6, + mask=( + ".#...", + ".###.", + "#####", + "#####", + ".#.#.", + ".#.#.", + ), + blend_path=Path(r"F:\aeth-wt\fable-spectre-3\out\spectre\spectre.blend"), + model_json_path=None, + target_mech_tris=27000, + strip_prefixes=("Rig", "Cam", "Sun", "Back", "Bounce", "Ground", "Horizon", "Rack.", "RackTail.", "GunL.lamp", "GunR.lamp", "GunR.glass"), + strip_islands=( + ("GunL.gunmetal", "max_y>", 2.0), + ("GunR.gunmetal", "max_y>", 3.15), + ("GunR.khaki", "max_y>", 3.15), + ), + hardpoints=( + HardpointMount("hp.weapon.shoulder_l", "weapon", 1, 0, 1, 1, "Waist", None, (-2.22, 0.15, 7.48), (-0.17, 0.23, 0.96), (0.78, 0.78, 0.13)), + HardpointMount("hp.armor.torso", "armor", 2, 1, 1, 1, "Waist", None, (0.0, 3.10, 5.68), (0.0, 0.11, -0.99), (0.74, 0.28, 0.10)), + HardpointMount("hp.weapon.arm_l", "weapon", 0, 2, 1, 2, "ShoulderL", None, (-2.81, 1.75, 5.15), (-1.0, 0.0, 0.0), (0.52, 0.52, 0.11)), + HardpointMount("hp.radiator.back_l", "radiator", 1, 2, 1, 1, "Waist", None, (-2.20, -0.79, 7.00), (0.0, -1.0, 0.0), (0.76, 0.96, 0.12)), + HardpointMount("hp.engine.core", "engine", 2, 2, 1, 2, "Waist", None, (0.0, -2.30, 7.00), (0.0, -1.0, 0.0), (0.86, 1.18, 0.14)), + HardpointMount("hp.radiator.back_r", "radiator", 3, 2, 1, 1, "Waist", None, (2.20, -0.79, 7.00), (0.0, -1.0, 0.0), (0.76, 0.96, 0.12)), + HardpointMount("hp.weapon.arm_r", "weapon", 4, 2, 1, 2, "ShoulderR", None, (2.66, 1.75, 5.05), (1.0, 0.0, 0.0), (0.52, 0.52, 0.11)), + ), + joints=( + JointTagSpec("joint.torso_yaw", "Waist", None, (0.0, 1.0, 0.0), -90.0, 90.0), + JointTagSpec("joint.arm_l_pitch", "ShoulderL", None, (1.0, 0.0, 0.0), -45.0, 60.0), + JointTagSpec("joint.arm_r_pitch", "ShoulderR", None, (1.0, 0.0, 0.0), -45.0, 60.0), + ), + ), + "kestrel": MechRetrofitSpec( + mech_id="kestrel", + name="Kestrel", + vehicle_class="Light Scout Biped", + plane="Coronal", + grid_width=5, + grid_height=5, + mask=( + "..#..", + ".###.", + ".####", + ".####", + ".#.#.", + ), + blend_path=Path(r"F:\aeth-wt\fable-kestrel-2\out\kestrel\kestrel.blend"), + model_json_path=None, + target_mech_tris=27000, + strip_prefixes=("Rig", "Cam", "Sun", "Back", "Bounce", "Ground", "Horizon", "WeaponArm.accent_yellow"), + strip_islands=( + ("WeaponArm.gunmetal", "max_y>", 2.30), + ), + hardpoints=( + HardpointMount("hp.weapon.dorsal", "weapon", 2, 0, 1, 1, "Torso.pose", None, (0.0, 0.23, 9.25), (0.0, 0.38, 0.92), (0.56, 0.56, 0.11)), + HardpointMount("hp.armor.chest", "armor", 2, 1, 1, 1, "Torso.pose", None, (0.0, 2.28, 6.87), (0.0, 0.88, -0.47), (0.72, 0.32, 0.10)), + HardpointMount("hp.radiator.back", "radiator", 1, 2, 1, 1, "Torso.pose", None, (-1.02, -1.86, 8.35), (0.0, -0.97, 0.26), (0.58, 0.78, 0.11)), + HardpointMount("hp.engine.core", "engine", 2, 2, 1, 2, "Torso.pose", None, (0.0, -1.72, 8.20), (0.0, -0.93, 0.36), (0.76, 1.02, 0.13)), + HardpointMount("hp.weapon.arm_r", "weapon", 4, 2, 1, 2, "ArmR", None, (2.29, 1.15, 5.95), (1.0, 0.0, 0.0), (0.46, 0.46, 0.10)), + ), + joints=( + JointTagSpec("joint.torso_yaw", "Torso.pose", None, (0.0, 1.0, 0.0), -90.0, 90.0), + JointTagSpec("joint.arm_l_pitch", "ArmL", None, (1.0, 0.0, 0.0), -45.0, 60.0), + JointTagSpec("joint.arm_r_pitch", "ArmR", None, (1.0, 0.0, 0.0), -45.0, 60.0), + ), + ), } @@ -251,7 +358,8 @@ def _strip_scene_objects(spec: MechRetrofitSpec) -> list[str]: stripped.append(obj_name) bpy.data.objects.remove(obj, do_unlink=True) continue - if obj.hide_viewport or obj.hide_render or obj.display_type in ("WIRE", "BOUNDS"): + is_skeleton_pivot = obj.get("kit_part") in ("bone", "trunk") + if not is_skeleton_pivot and (obj.hide_viewport or obj.hide_render or obj.display_type in ("WIRE", "BOUNDS")): stripped.append(obj_name) bpy.data.objects.remove(obj, do_unlink=True) continue @@ -296,6 +404,92 @@ def _strip_vertex_groups_from_mesh(obj: bpy.types.Object, vg_names: tuple[str, . return removed_verts +def _strip_mesh_islands(strip_islands: tuple[tuple[str, str, float], ...]) -> dict[str, int]: + """Remove disconnected mesh islands matching world-space predicates (e.g. protruding gun barrels).""" + removed: dict[str, int] = {} + for obj_name, op, thresh in strip_islands: + obj = bpy.data.objects.get(obj_name) + if obj is None or obj.type != "MESH" or obj.data is None: + continue + bm = bmesh.new() + bm.from_mesh(obj.data) + bm.verts.ensure_lookup_table() + mw = obj.matrix_world + visited: set[int] = set() + del_verts: list[bmesh.types.BMVert] = [] + for v in bm.verts: + if v.index in visited: + continue + comp: list[bmesh.types.BMVert] = [] + stack = [v] + visited.add(v.index) + while stack: + cur = stack.pop() + comp.append(cur) + for e in cur.link_edges: + ov = e.other_vert(cur) + if ov.index not in visited: + visited.add(ov.index) + stack.append(ov) + pts = [mw @ c.co for c in comp] + hit = False + if op == "max_y>": + hit = max(p.y for p in pts) > thresh + elif op == "min_y<": + hit = min(p.y for p in pts) < thresh + elif op == "max_z>": + hit = max(p.z for p in pts) > thresh + if hit: + del_verts.extend(comp) + if del_verts: + bmesh.ops.delete(bm, geom=del_verts, context="VERTS") + bm.to_mesh(obj.data) + obj.data.validate(verbose=False) + obj.data.update() + removed[obj_name] = len(del_verts) + bm.free() + return removed + + +def _assemble_kestrel_hierarchy() -> None: + """Group Kestrel's flat root parts under Pelvis, Torso.pose, ArmL, and ArmR pivots.""" + torso_pose = bpy.data.objects.get("Torso.pose") + if torso_pose is None: + return + + def reparent_keep_world(obj: bpy.types.Object, parent: bpy.types.Object) -> None: + mw = obj.matrix_world.copy() + obj.parent = parent + obj.matrix_parent_inverse = Matrix.Identity(4) + obj.matrix_local = parent.matrix_world.inverted() @ mw + + pelvis = vc.make_empty("Pelvis", parent=None, location=(0.0, 0.0, 0.0)) + arm_l = vc.make_empty("ArmL", parent=torso_pose, location=(-1.62, 0.65, 1.50)) + arm_r = vc.make_empty("ArmR", parent=torso_pose, location=(1.62, 0.65, 1.50)) + bpy.context.view_layer.update() + + for obj in list(bpy.data.objects): + if obj in (pelvis, torso_pose, arm_l, arm_r): + continue + name = obj.name + if obj.parent is None and ( + name.startswith("Pelvis.") + or name.startswith("LegJoints") + or name.startswith("Thigh") + or name.startswith("Shin") + or name.startswith("Ankle") + or name.startswith("Foot") + ): + reparent_keep_world(obj, pelvis) + elif obj.parent is None and (name.startswith("Neck.") or name.startswith("Shoulder")): + reparent_keep_world(obj, torso_pose) + elif name.startswith("UpperArmL.") or name.startswith("ElbowL.") or name.startswith("ForearmL.") or name.startswith("HandL."): + reparent_keep_world(obj, arm_l) + elif name.startswith("UpperArmR.") or name.startswith("ElbowR.") or name.startswith("WeaponArm."): + reparent_keep_world(obj, arm_r) + bpy.context.view_layer.update() + + def _apply_existing_modifiers() -> None: """Drop BEVEL (which causes decimate spikes) and bake SOLIDIFY/BOOLEAN before stripping cutters.""" for obj_name in [o.name for o in bpy.data.objects]: @@ -413,14 +607,22 @@ def _normalize_materials_for_gltf() -> None: bsdf.inputs["Base Color"].default_value = (0.58, 0.60, 0.62, 1.0) bsdf.inputs["Metallic"].default_value = 0.94 bsdf.inputs["Roughness"].default_value = 0.22 + elif "optic_red" in lname: + bsdf.inputs["Base Color"].default_value = (0.14, 0.02, 0.015, 1.0) + bsdf.inputs["Metallic"].default_value = 0.0 + bsdf.inputs["Roughness"].default_value = 0.15 + if "Emission Color" in bsdf.inputs: + bsdf.inputs["Emission Color"].default_value = (1.0, 0.08, 0.03, 1.0) + if "Emission Strength" in bsdf.inputs: + bsdf.inputs["Emission Strength"].default_value = 1.6 elif "warhead" in lname: bsdf.inputs["Base Color"].default_value = (0.28, 0.10, 0.06, 1.0) bsdf.inputs["Metallic"].default_value = 0.35 bsdf.inputs["Roughness"].default_value = 0.45 - elif "mark" in lname and cover_col is not None and cover_amt >= 0.5: - bsdf.inputs["Base Color"].default_value = cover_col + elif "mark" in lname: + bsdf.inputs["Base Color"].default_value = cover_col if (cover_col is not None and cover_amt >= 0.5) else (0.48, 0.46, 0.42, 1.0) bsdf.inputs["Metallic"].default_value = 0.0 - bsdf.inputs["Roughness"].default_value = roughness if roughness is not None else 0.62 + bsdf.inputs["Roughness"].default_value = roughness if roughness is not None else 0.72 elif matched_pal is not None: bsdf.inputs["Base Color"].default_value = vc.srgb_hex_to_linear(matched_pal["hex"]) bsdf.inputs["Metallic"].default_value = float(matched_pal["metallic"]) @@ -486,6 +688,8 @@ def _decimate_mech_meshes(meshes: list[bpy.types.Object], target_tris: int, min_ after = _apply_crisp_normals_and_decimate(obj, ratio) return raw_total, after + min_main_ratio = 0.125 if raw_total > 150000 else 0.20 + def _target_for(obj: bpy.types.Object, t: int, k_val: float) -> int: if t <= min_keep_tris: return t @@ -497,10 +701,10 @@ def _decimate_mech_meshes(meshes: list[bpy.types.Object], target_tris: int, min_ or ".panels" in obj.name ) if is_detail: - return max(24, int(round(t * max(k_val * 0.50, 0.08)))) + return max(24, int(round(t * max(k_val * 0.50, 0.06)))) if t <= 220: return max(min(t, 44), int(round(t * max(k_val, 0.28)))) - return max(84, int(round(t * max(k_val, 0.20)))) + return max(84, int(round(t * max(k_val, min_main_ratio)))) if raw_total <= target_tris: k = 1.0 @@ -1085,7 +1289,7 @@ def retrofit_mech(spec: MechRetrofitSpec) -> dict[str, Any]: else None ) - # 3. For rigged meshes, strip weapon vertex groups cleanly + # 3. For rigged meshes, strip weapon vertex groups cleanly; strip protruding weapon islands stripped_vgs: dict[str, int] = {} if spec.strip_vertex_groups: for obj in bpy.data.objects: @@ -1093,6 +1297,10 @@ def retrofit_mech(spec: MechRetrofitSpec) -> dict[str, Any]: cnt = _strip_vertex_groups_from_mesh(obj, spec.strip_vertex_groups) if cnt > 0: stripped_vgs[obj.name] = cnt + if spec.strip_islands: + _strip_mesh_islands(spec.strip_islands) + if spec.mech_id == "kestrel": + _assemble_kestrel_hierarchy() # 4. Normalize procedural materials -> clean glTF PBR _normalize_materials_for_gltf() diff --git a/tools/vehicles/verify_glbs.py b/tools/vehicles/verify_glbs.py index 482fcf0..bc7694d 100644 --- a/tools/vehicles/verify_glbs.py +++ b/tools/vehicles/verify_glbs.py @@ -16,9 +16,9 @@ GEAR_DIR = REPO_ROOT / "assets" / "gear" EXPECTED_VEHICLES = ( "jackal", "mule", "ferret", "hornet", "mammoth", "ironclad", "anvil", "condor", - "breaker", "paladin", "raptor", "manticore", + "breaker", "paladin", "raptor", "manticore", "bastion", "spectre", "kestrel", ) -RETROFIT_MECHS = frozenset({"breaker", "paladin", "raptor", "manticore"}) +RETROFIT_MECHS = frozenset({"breaker", "paladin", "raptor", "manticore", "bastion", "spectre", "kestrel"}) EXPECTED_GEAR = ("mg_762", "autocannon", "recoilless", "copper_rad", "gilded_lance", "gold_radiator") @@ -395,7 +395,7 @@ def validate_vehicle(vid: str) -> dict[str, Any]: raise AssertionError(f"{vid}: GLB not grounded at minY=0 (got minY={g_min[1]:.4f})") size = g_max - g_min if vid in RETROFIT_MECHS: - if not (2.5 <= size[0] <= 10.0 and 5.0 <= size[1] <= 12.5 and 2.5 <= size[2] <= 10.0): + if not (2.5 <= size[0] <= 14.0 and 5.0 <= size[1] <= 12.5 and 2.5 <= size[2] <= 16.0): raise AssertionError(f"{vid}: implausible mech bounds size {size.tolist()}") elif not (1.2 <= size[0] <= 5.0 and 1.0 <= size[1] <= 3.5 and 2.5 <= size[2] <= 6.5): raise AssertionError(f"{vid}: implausible bounds size {size.tolist()}")