Wildenhaus / Index

A tool for browsing and extracting assets from Halo 2 Anniversary.
16 stars 1 forks source link

minigun__h isn't weighted properly #16

Open Wildenhaus opened 2 years ago

Wildenhaus commented 2 years ago

Bones/weighting is broken for minigun__h and probably a handful of other places too

image

The object hierarchy is like so

h
  _b_base
    _b_gun
      _minigun_base
      _minigun_medium
      _minigun_destroyed
        _minigun_destroyed
        _minigun_destroyed
      _m_camera_0
      _m_primary_trigger_0
    _m_driver_0
    _m_minigun_damage_0
    _m_target_main_0
  _minigun_base

The issue here seems to be due to the way we're resolving bones in ConvertModelToAssimpSceneProcess::ApplySkinCompoundData().

In this case, the issue is with _b_base and _b_gun. The skin compound's "Bone IDs" point to _minigun_base and _minigun_destroyed_$p1, and then later on we're resolving both of those objects to the _b_gun bone, so everything gets parented to that with a weight of 1.

I suspect that the bone ids in the skin compound aren't actually bone ids, but either mesh ids or the index of the bone within the hierarchy.

Wildenhaus commented 2 years ago

I did an experiment to see if I could fix the bones only to be more baffled by what came next.

The minigun's base and gun are a single mesh. The SkinCompound has weights that are applied to the vertices of the mesh. After applying them and importing, it appears that both the gun and the base are weighted to the gun bone. Then, there are loose, overlapping vertices that are weighted to the base bone.

Screenshot (i moved the loose vertices to the side) image

Really not sure what Saber is doing here. My only guess is that these loose vertices are supposed to serve as some sort of anchor point or replacement for the other vertices.

But that guess brings up another issue. The loose, overlapping vertices don't encompass the entire base - the top part isn't there. So even if those overlapping verts served as a replacement, the top portion of the base would still be parented to the gun bone.

It's very possible that weights just aren't being applied right, but the loose vertices thing isn't exclusive to this model. We'll have to figure out what's going on with those.

Point of interest: S3DObject -> GeomData -> SplitIndex/NumSplits looks like splitindex is identical to the object id?