Parik27/DragonFF

Feature: Support for Embedded Mesh in Bone

dreamsyntax opened this issue · 16 comments

There exists some models in Shadow the Hedgehog and Sonic Heroes where meshes are attached to bone, and bones may be nested within those skins. OMEGA.DFF is one such model.

The model throws this error on import with DragonFF
image
image

The model throws this error on import with @Psycrow101 's DragonFF-multimesh
image
image

image

Source for debugging:
Shadow the Hedgehog Omega:
omega.zip

3DSMax Hierarchy Example:
Where tri = bone; Circle = mesh
unknown

image

following this issue and attaching Omega and Tails from Sonic Heroes, as those suffer from the same exact issue:
OMEGA_TAILS-SH.zip
this one including the model (DFF), textures (TXD and PNG) and animations (ANM) for more diversity on testing the models during and after the procedure.

DragonFF uses data extracted from the skin section to create frames for the scene. As dreamsyntax said, in Omega, skin sections are missing, which is why the armature to which the meshes are attached is not created. This causes an exception to be thrown in the multi-mesh addon.

To fix this problem, we need to figure out how to combine skin data and frame data. I think we should create armature based on frame data, supplementing it with skin data, but I'm not sure that the frame transformation matrices will exactly match the skin transformation matrices. I'll try to experiment with this, but I can't guarantee perfect results.

For now I have coded a temporary fix for Omega.

image

Please note that the armature will not be created, resulting in incorrect export and animations.

DragonFF.zip

UPD: with armature

DragonFF.zip

DragonFF uses data extracted from the skin section to create frames for the scene. As dreamsyntax said, in Omega, skin sections are missing, which is why the armature to which the meshes are attached is not created. This causes an exception to be thrown in the multi-mesh addon.

To fix this problem, we need to figure out how to combine skin data and frame data. I think we should create armature based on frame data, supplementing it with skin data, but I'm not sure that the frame transformation matrices will exactly match the skin transformation matrices. I'll try to experiment with this, but I can't guarantee perfect results.

For now I have coded a temporary fix for Omega.

image

Please note that the armature will not be created, resulting in incorrect export and animations.

DragonFF.zip

UPD: with armature

DragonFF.zip

Unsurprisingly importing MTN files do not work properly, but with armature available its a step in the right direction! Thank you very much

Unsurprisingly importing MTN files do not work properly, but with armature available its a step in the right direction! Thank you very much

I checked omega.bon and found that some bone ids are unexpectedly undefined (have a value of -1). Try the modified version of io_scene_sth_mtn. Animations should work correctly.
io_scene_sth_mtn.zip

Unsurprisingly importing MTN files do not work properly, but with armature available its a step in the right direction! Thank you very much

I checked omega.bon and found that some bone ids are unexpectedly undefined (have a value of -1). Try the modified version of io_scene_sth_mtn. Animations should work correctly. io_scene_sth_mtn.zip

Ah I recall running into that while trying to update the 3dsmax bon script. Giving it a try

Seems good for the few I've tried!

2023-10-09.15-07-48_c.mp4
2023-10-09.15-10-03_c.mp4

I will verify the heroes models next, to see if they also work properly. Thank you!

This is a bit off topic, but I can't seem to trigger your bulk import function for .mtn.

I see the code change, but when selecting a folder no mtns are imported. When multi-selecting individual mtns it just defaults to the first letter one.

The two known problematic models in heroes work fine + tested the existing rw anm plugin.

heroes_omega_c.mp4
heroes_tails_fly_c.mp4

Seems good to me, I'll leave this open until the PR is created / merged.

This is probably an issue for the sh mtn plugin; Actually confirmed DragonFF issue. While Omega is fixed, Shadow Tails is not. I think this is because of the multi .bon case

Image on TAILS.DFF -> TAILS.BON -> tails_atc.MTN
image

TAILS_SHAD.zip

Another such similar case of nested mesh is GUNBIGFOOT

With this DragonFF update the initial DFF works fine, but again MTN does not
image

image

SHADOW_BIGFOOT.zip

Unsurprisingly importing MTN files do not work properly, but with armature available its a step in the right direction! Thank you very much

I checked omega.bon and found that some bone ids are unexpectedly undefined (have a value of -1). Try the modified version of io_scene_sth_mtn. Animations should work correctly. io_scene_sth_mtn.zip

Just an update on this, this seems to break for all other shadow the hedgehog animations besides omega. Shadow's animations become scrambled if using this version.

CORRECTION:

It's actually this new DragonFF version that causes the Shadow animations to break, regardless of io_scene plugin

old io_scene plugin:
image

new io_scene plugin:
image

Above is shadow_body.dff -> sh.bon -> sh_atc_eda.mtn

shadow_ex.zip

Unsurprisingly importing MTN files do not work properly, but with armature available its a step in the right direction! Thank you very much

I checked omega.bon and found that some bone ids are unexpectedly undefined (have a value of -1). Try the modified version of io_scene_sth_mtn. Animations should work correctly. io_scene_sth_mtn.zip

Just an update on this, this seems to break for all other shadow the hedgehog animations besides omega. Shadow's animations become scrambled if using this version.

CORRECTION:

It's actually this new DragonFF version that causes the Shadow animations to break, regardless of io_scene plugin

old io_scene plugin: image

new io_scene plugin: image

Above is shadow_body.dff -> sh.bon -> sh_atc_eda.mtn

shadow_ex.zip

Remove Copy Transforms constraint for mesh object
image

Or try this
DragonFF.zip

Or try this DragonFF.zip

BigFoot anims look mostly good, I noticed there's a few frames that seem to spasm out in most anms

BFA_WALK

bfa_walk_c.mp4

BFA_DAMAGE

bfa_damage_c.mp4

Tails seems to work properly now.
Shadow seems to work properly now.

I see the code change, but when selecting a folder no mtns are imported. When multi-selecting individual mtns it just defaults to the first letter one.

I still can't figure out how to invoke your bulk import you added.

I still can't figure out how to invoke your bulk import you added.

In Blender, animations are available in the Dope Sheet editor (Shift + F12). There you need to go to Action Editor. A list of actions will be available on the right.
image

BigFoot anims look mostly good, I noticed there's a few frames that seem to spasm out in most anms

The problem is with the io_scene_sth_mtn addon. Wrong Bezier curve handlers result in incorrect keyframe interpolation. I'll see how this can be fixed.

Or try this DragonFF.zip

To re-iterate the status of this, which branch will this live in and does it make sense to have this as a PR for the main branch or only multi-mesh?

Or try this DragonFF.zip

To re-iterate the status of this, which branch will this live in and does it make sense to have this as a PR for the main branch or only multi-mesh?

This change is currently in the multi-mesh branch. I think this branch is not tested enough to merge into the main branch.

Or try this DragonFF.zip

To re-iterate the status of this, which branch will this live in and does it make sense to have this as a PR for the main branch or only multi-mesh?

This change is currently in the multi-mesh branch. I think this branch is not tested enough to merge into the main branch.

@Psycrow101 would be curious on your thoughts about a checkbox option in the DFF Import/Export popup to handle as latest master does vs with multi mesh.
Would it be infeasible given the amount of changes? The dual branches leads to some confusion for end users.