Page 1 of 1

HAVOK *.hkx

Posted: Wed Dec 24, 2014 10:38 pm
by Oleg
Hi All!

I've searched the forum, checked most of result topics and still have a doubt whether this format was ever explored and/or any documentation was made available.

May be some of you have valuable links to any tools that can deal with these files and/or have some drafts of binary file format that I could start with?

Also, if someone knows or have any tool that can visualize the *.hkx file, this could make things much easier, as it's really hard to explore or finally create a modded file with no chance to visualize result.


Background: Ubisoft Disrupt engine is under a scalpel. Model format and materials are almost done, but physics model is the problem now.

Re: HAVOK *.hkx

Posted: Wed Dec 24, 2014 11:20 pm
by cra0
Volfin and I are working on hkx for alien isolation. I have most the data structures dumped from 2013

Re: HAVOK *.hkx

Posted: Thu Dec 25, 2014 12:43 am
by JohnHudeski
Just get the free sdk or havok tool. Its pretty easy

Re: HAVOK *.hkx

Posted: Thu Dec 25, 2014 1:29 am
by volfin
I'm working on a tool to convert HKX to SMD to enable transfer of skeletons and eventually animations. But it still needs a lot of work. As Cra0 mentioned we are using it primarily for Alien: Isolation (skeleton only) at this time, but eventually i want to clean it up and make it more generic. It's just a matter of having the time to refine it. Also need to find more examples of various files created with various SDK versions.

Re: HAVOK *.hkx

Posted: Thu Dec 25, 2014 6:53 am
by SergeantJoe
volfin wrote:Also need to find more examples of various files created with various SDK versions.
Well you can easily get files from Skyrim, Sleeping Dogs, Alien Isolation, and Sleeping Dogs DE. That's Havok 2010, 2011, 2012, and 2013 right there.

And plus there's already an open-source extractor for 2010.

Re: HAVOK *.hkx

Posted: Thu Dec 25, 2014 12:08 pm
by Oleg
I've skim through some of hkx files related to vehicle physics and these seems to contain quite a lot of info. For example, the general collision volumes (visually looks like vertices and faces/connectivity_links indices) for all vehicle objects end up on about 20Kb of data and the overal hkx file is about 180-200Kb. Looking at class list I can't say clearly which data requires that much of info followed by collision volumes.

hkClass
hkClassMember
hkClassEnum
hkClassEnumItem
nomadVehiclePhysResourceData
hkpRigidBody
kpListShape
hkpConvexVerticesShape
hkpConvexVerticesConnectivity
hkpCylinderShape
hkpConvexTransformShape
hkpBoxShape
hkpConvexTranslateShape
hkpConstraintInstance
hkpLimitedHingeConstraintData
hkpPositionConstraintMotor
hkpStaticCompoundShape
hkpBvCompressedMeshShape

I can say that geometry file (xbg) contains pre-defined vertices deformation data, so barely the hkx file will have the deformation. However, it can contain mapping of physical volume to geometry vertices, so hit/damage on collision vertex would cause visual geometry vertices to increase level of deformation. Additionally, geometry vertices utilize some ID assignment in a mesh that is used by game for emissive mesh lights (headlights, taillights) and these are bounded to some physics in hkx too (probably just a bit of info needed to save I guess).

Looking at the rest of the data, it doesn't make any sense to me at the moment as it's very irregular. Probably, this is a "BvCompressedMeshShape".

Unfortunately, it doesn't seem to be possible to create .hkx file for the game separately from the affecting geometry data, so external tools could barely be used. So, the free sdk with havok tool is not a solution. I still wonder whether some visualization or dumping tools avail? Can original havok tool visualize the hkx file?

As my tool is a payware solution, I can't ask for any others work, but if someone can share initial info for inspiration, it would be very helpful. :)

P.S. the skeleton seems to be out of hkx file, as each model is equipped with "reference skeleton" file (XML converted to binary) and the file looks to be included for reference only, as damaging the file or zeroing-out it and putting into a mod does not cause any changes in game.

Re: HAVOK *.hkx

Posted: Thu Dec 25, 2014 2:10 pm
by shakotay2
Oleg wrote:Can original havok tool visualize the hkx file?
which hkx file do you mean?

Generally the havok standalone tool can visualize hkx files. (But I didn't check it with "hkx files related to vehicle physics")
It also allows saving as XML:
HavokToolsFramework-Standalone.JPG
As I wrote here (post as of Thu Dec 05, 2013 1:11 pm): viewtopic.php?f=16&t=10730&hilit=hkx&start=105
You load the mesh, add the skeleton and the animation
It was GirlMesh.hkx, GirlSkeleton.hkx, girlrunningAnim.hkx
I found the hkx files here at the end of Civfreak's post:
http://forums.elementalgame.com/398524

Re: HAVOK *.hkx

Posted: Fri Dec 26, 2014 1:12 am
by volfin
SergeantJoe wrote:
volfin wrote:Also need to find more examples of various files created with various SDK versions.
Well you can easily get files from Skyrim, Sleeping Dogs, Alien Isolation, and Sleeping Dogs DE. That's Havok 2010, 2011, 2012, and 2013 right there.

And plus there's already an open-source extractor for 2010.
Yeah i have a few. as for Hkxcmd, it only converts between HKX and XML, which isn't that handy. being able to convert from HKX diretcly to SMD/BVH or other directly importable format is better.

Re: HAVOK *.hkx

Posted: Fri Dec 26, 2014 9:25 am
by SergeantJoe
volfin wrote:being able to convert from HKX diretcly to SMD/BVH or other directly importable format is better.
If you convert it to xml you can open it in the Havok standalone tool, which can then convert into a useable format I believe. I think Shako made a post on that.

But you're right, it's better to convert it directly to SMD.

Re: HAVOK *.hkx

Posted: Sat Dec 27, 2014 12:25 am
by volfin
SergeantJoe wrote:
volfin wrote:being able to convert from HKX diretcly to SMD/BVH or other directly importable format is better.
If you convert it to xml you can open it in the Havok standalone tool, which can then convert into a useable format I believe. I think Shako made a post on that.
I'd be intersted in more info about that. But all my experience with the havok creation tools is they are made to convert things to HKX, not the other way around. If by standalone tool you mean the Filter Manager, i've never got it to work on any file i've tried. always exits with no explaination.

Re: HAVOK *.hkx

Posted: Sat Dec 27, 2014 6:16 pm
by Skykila
there is a utility AssetCc2 (hkSDK_Root\Tools\BatchProcess\AssetCc). It can convert any erialized .HKX file to xml .hkx

Re: HAVOK *.hkx

Posted: Sat Dec 27, 2014 6:54 pm
by Oleg
Skykila wrote:there is a utility AssetCc2 (hkSDK_Root\Tools\BatchProcess\AssetCc). It can convert any erialized .HKX file to xml .hkx
this seems to fail on .hkx files I have. but it can convert tagged xml file into native xml version and native xml into binary file. at least I have something to start from by comparing xml and associated binary file. :|