Important information: this site is currently scheduled to go offline indefinitely by end of the year.

[Help] import .hkx file

Post questions about game models here, or help out others!
Post Reply
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

[Help] import .hkx file

Post by zaramot »

Hello everyone.
I'm trying to write maxscript for .hkx skeleton files. It's native Havok .hkx files, I can open them with Havok Content Tool, but there's no option to export it. Need help to understand bone matrix there, any tip or advice will be very helpful.
Image
You do not have the required permissions to view the files attached to this post.
Making model-import scripts, PM
User avatar
Bastien
advanced
Posts: 70
Joined: Sun Apr 15, 2012 1:08 am
Has thanked: 27 times
Been thanked: 13 times

Re: [Help] import .hkx file

Post by Bastien »

Edit: The tool below is both for animations and skeletons.

Are you writing a script based on the binary or xml version of the hkx ?

I haven't written a script yet but I was planning to do so based on this tool, which converts havok 2010 binary to xml and then to kf(niftools?) that can be imported to 3ds max
You might want to take a look
https://github.com/figment/hkxcmd
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4291
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1151 times
Been thanked: 2244 times

Re: [Help] import .hkx file

Post by shakotay2 »

zaramot wrote:[...]It's native Havok .hkx files, I can open them with Havok Content Tool, but there's no option to export it.
If you have 3dsmax it would be useful to do it the reverse way:
Image
This way I created a hkt file (==hkx, when 'Binary' chosen on export) and the corresponding xml.

Code: Select all

		<hkparam name="bones" numelements="67">
			<hkobject>
				<hkparam name="name">Bip01</hkparam>
				<hkparam name="lockTranslation">false</hkparam>
			</hkobject>
...
...
	<hkobject name="#0154" class="hkxNode" signature="0x58b0eebe">
		<!-- memSizeAndFlags SERIALIZE_IGNORED -->
		<!-- referenceCount SERIALIZE_IGNORED -->
		<hkparam name="attributeGroups" numelements="0"></hkparam>
		<hkparam name="name">Bip01 R Toe0Nub</hkparam>
		<hkparam name="object">null</hkparam>
		<hkparam name="keyFrames" numelements="2">
			(1,000000 0,000000 0,000000 0,000000)(0,000000 1,000000 0,000000 0,000000)(-0,000000 0,000000 1,000000 0,000000)(3,639171 0,000000 0,000000 1,000000)
			(1,000000 0,000000 0,000000 0,000000)(0,000000 1,000000 0,000000 0,000000)(-0,000000 0,000000 1,000000 0,000000)(3,639171 0,000000 0,000000 1,000000)
		</hkparam>
For some weird reason hkxcmd.exe from Skyrim Nexus doesn't convert your hkx nor does it PEPE.
(Might be a version's issue cause I have an older (non skyrim) hkx which is being converted.)

Then I realized that it's possible to export to xml in the standalone HavokContentTool, too.
I think you just missed to scroll up in the Format's combo box of the File save to dialogue. :)

So this being the bone matrix of c_skeleton.hkx:

Code: Select all

			<hkparam name="referencePose" numelements="83">
				(0.000000 102.375999 0.000000)(0.000000 -0.707107 0.000000 0.707106)(1.000000 1.000000 1.000000)
				(0.000000 0.000000 0.000000)(0.499999 0.500000 0.500000 0.500001)(1.000000 1.000000 1.000000)
...
It has 83 lines, one for each bone
So this (0.000000 102.375999 0.000000) should be the position
and this (0.000000 -0.707107 0.000000 0.707106) the rotation of 0. Bip01 Pelvis, but that's just a guess.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: [Help] import .hkx file

Post by zaramot »

Thanks Shakotay2 for the tips, I exported this skeleton to XML like you did and tried those values as possition/rotation, but they didn't fit. I have no clue what to do with them now, hkxcmd.exe works only for files created with havok content tools 2010.02 and earlier, this skeleton was created with 2011.01 version of HCT, that's bad.
Making model-import scripts, PM
User avatar
Bastien
advanced
Posts: 70
Joined: Sun Apr 15, 2012 1:08 am
Has thanked: 27 times
Been thanked: 13 times

Re: [Help] import .hkx file

Post by Bastien »

You could try changing the ID version yourself in the file and then run hkxcmd, ir worked for me with another 2010 version (Resident Evil ORC animation files). (replace in offset 40 with this "hk_2010.2.0-r1".)

This code might also be useful as reference:
https://github.com/figment/hktcnv

If nothing works, you should start digging into the code and/or contact figment to get the format specifications. One project of mine for the future is support hkx animations for Blender, so I will certainly dig into that code soon.


cheers.
User avatar
Bastien
advanced
Posts: 70
Joined: Sun Apr 15, 2012 1:08 am
Has thanked: 27 times
Been thanked: 13 times

Re: [Help] import .hkx file

Post by Bastien »

edit: Double post
User avatar
zaramot
double-veteran
double-veteran
Posts: 783
Joined: Wed Jan 05, 2011 12:41 pm
Has thanked: 39 times
Been thanked: 855 times

Re: [Help] import .hkx file

Post by zaramot »

Thanks for the info Bastien, changing ID didn't help, but this tool hktcnv could be useful! I guess, it should convert 2011.1 version into 2010.2, since it converts 2011.3 .hkx files.
Making model-import scripts, PM
reichelmarcia
ultra-n00b
Posts: 1
Joined: Wed Jul 26, 2023 9:41 am

Re: [Help] import .hkx file

Post by reichelmarcia »

With your help, Shakotay2, I was able to export the skeleton to XML and experiment with the suggested settings for position and rotation, but the results were inconclusive. Since hkxcmd.exe is only compatible with files made in HCT 2010.02 or prior (and this skeleton was made in HCT 2011.01), I'm at a loss as to what to do with them.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4291
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1151 times
Been thanked: 2244 times

Re: [Help] import .hkx file

Post by shakotay2 »

I fear you*re digging up a deadly dead thread. :D

My last words on "hkx" seem to be here:
shakotay2 wrote: Tue May 17, 2016 9:09 am
In the same thread you'll find Snaz (see github link) and wolfin who made significant progress both, afair.

There's also a project from PredatorCZ, Havok 3ds max/Noesis importer/exporter plugins, which should be mentioned here.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
Post Reply