io7m / jcalcium

Skeletal animation
ISC License
0 stars 0 forks source link

Skeleton hashing #14

Closed io7m closed 7 years ago

io7m commented 7 years ago

Calculate a deterministic hash value from a compiled skeleton.

The hash value can then be recorded for both skeletons and their associated meshes (stamped into the meshes as SMF metadata). This allows for checking that a skeleton has not been modified without the associated meshes also having been re-exported.

io7m commented 7 years ago

This raises the question of what constitutes structural compatibility. For example, if a bone in a skeleton is renamed, then the skeleton would still be "compatible" in the sense that the positions and numbers of bones have not changed.

io7m commented 7 years ago

A skeleton is compatible if meshes bound to that skeleton will still continue to work after a change is made to the skeleton.

This means that:

This pretty much rules out all structural changes.

What happens if existing joints are moved/rotated/scaled? Does a mesh remain "compatible" with a skeleton when this happens?

io7m commented 7 years ago

What happens if existing joints are moved/rotated/scaled? Does a mesh remain "compatible" with a skeleton when this happens?

No, it doesn't.

io7m commented 7 years ago

If, in effect, absolutely everything is relevant to whether or not a skeleton remains compatible, then everything in the skeleton has to be included in the hash.

The question remains about the specifics of hashing. Inevitably, it's going to be a SHA256 sum of the skeleton data. Need to come up with a well-specified, portable, and deterministic way to turn a skeleton into a string and then hash that string.