HeapsIO / heaps

Heaps : Haxe Game Framework
http://heaps.io
MIT License
3.22k stars 340 forks source link

Incorrect bone placement on some FBX animation files #1115

Open trethaller opened 1 year ago

trethaller commented 1 year ago

Here is animation which displays an incorrect placement on some bones (specifically the Clavicle ones) when the animation is exported with the model itself (Anim_walk_loop). When the geometry is not included in the animation file (Anim_walk2_loop.FBX), the problem disappears. We identified that this is caused by Position keys missing in the generated HMD file. When this optimization is disabled, the problem is resolved:

https://github.com/HeapsIO/heaps/blob/dd0f74e7c00997c70c2a234285027c55b04c75a7/hxd/fmt/fbx/BaseLibrary.hx#L989

            if( data.z != null && roundValues(data.z, def.z, M) )
                hasValue = true;
            // no meaningful value found
            if( !hasValue )
                continue;      // <-----------
            var keyCount = 0;
            if( data.x != null ) keyCount = data.x.length;

Sample file:

NG_anim_bug.zip

ncannasse commented 1 year ago

The problem is correctly understood.

We're trying to know if the position in the animation is different than the position in the default skin (in that sample there's a difference for L/R Clavicle)

The bug occurs then when:

The correct fix would be to either: