Page 3 of 4

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 1:50 pm
by xandro
Yes, I forgot to mention NifSkope is playing every single animation perfectly I also tried the same thing you did with noesis It never showed any animation, this is all confusing.

I played around with .SMD but to be honest I have no idea what am I trying to do.

edit: I just tried improting humanSkeleton into blender and still no luck animations are not even working on 2 legs model
I tried import just skeleton as nif in Noesis everything looks perfect, even when I open it in blender (only skeleton without animations) looks great.
Once I add animations it's a mess.So I guess it has to do with some animations they are probably not calculated right.

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 2:40 pm
by shakotay2
The key is the keyframe (.kf) file. :D Since you're a coder you should be able to extract the frame data. Next step would be to combine skeleton and that data. (I used md5anim format some years ago for testing; not for nif, though.)

(If interpolated keyframes are used things become a little bit more complicated.)

edit: well, I see, the .kf file is the same as the Boar-nif. This is so ridiculous. What do these guys think?
Seems we need to rip the frames manually...

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 3:08 pm
by xandro
Hmm.. It's a real mess even I could get those framerates I'm not capable of combining them with skeleton.
I think Larian made a terrible job with all of this.
I simply want to export those models, maybe add them in unity, this game is so forgotten, underrated and no one wants to work on it.
And here I am talking with the possibly first modder who managed to mod this game.

How i can rip the frames manually?

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 3:41 pm
by shakotay2
xandro wrote: Fri Mar 31, 2023 3:08 pmAnd here I am talking with the possibly first modder who managed to mod this game.
I'm not sure whether I was the first one, more than ten years ago. What I know is: no one followed me, no one seemed to use my infos. Except you, maybe. :D
How i can rip the frames manually?
You wrote, you're a C# coder, didn't you? Thus you should know about data structures. Keyframes are rather simple (sometimes; harder, if interpolated, compressed, whatever f...)

In the Boar nif search for blocks of 26 zeroes. First occurence of keyframes should be at 0x55654. count there is (0x29) = 41, size of block= 312,
well could be bone number and a float (2+4 bytes), so weights table? No, numbers get much too high. So it's frametime and float?

I have no idea.

The next block at 0x557c4 has a count of 667, 667*6= 4002 -> 0xFA2, so calculated block end at 0x56766.
In fact it's 0x567AC, but that shouldn't matter. Seems it's 27 blocks, what does that mean?

Blocksizes vary, too much guesswork.

I'll leave you alone now. Maybe I could give you an impression, how to analyse that nif?
Maybe simply log some blocks and try to give their contents some meaning.

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 3:52 pm
by xandro
You made that guide and it helped me so much. I even managed to enable night in some areas in that game, people loved it.
Yes I'm C# dev I even created a tool to extract all .NIF textures from divinity 2 to .DDS.
I have problem understanding the data structure I never reversed engineered anything before this game and before your guide, only that made me learn it how to do it, and i'm still just a begginer.Once I find everything I need in HEX it's actually pretty simple to get all of that with some code.The hardest part is to analyze the whole .KF file.

It would be nice if you have any advice what should I look in those KF/NIF files, I know even nifSkope have option to show every offSet of specific block.

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 3:59 pm
by shakotay2
xandro wrote: Fri Mar 31, 2023 3:52 pmIt would be nice if you have any advice what should I look in those KF/NIF files, I know even nifSkope have option to show every offSet of specific block.
Yep, NifSkope is a pretty good "data viewer". In fact I have little to no knowledge about kf files. Plus, what we have isn't a real kf, afaics, but a nif file containing the animation frames.

So I'd suggest to log some of the blocks and show your results.

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 4:04 pm
by xandro
Okay one last question because I start working on that, what the result should look like once I get it.Am I looking for keyframes? how they look like?, I'm really not sure what I should find in that NIF file

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 4:30 pm
by shakotay2
xandro wrote: Fri Mar 31, 2023 4:04 pm Okay one last question because I start working on that, what the result should look like once I get it.Am I looking for keyframes? how they look like?, I'm really not sure what I should find in that NIF file
You shouldn't find keyframes, simply log some blocks; number (2 bytes), float (4 bytes).

For understanding keyframes you need to google, I guess. Learn about transition/translation and rotation, and quaternions, maybe.

Here's frame matrices:
shakotay2 wrote: Sat Jun 29, 2013 8:34 am
This is code to read keyframes (example only,does not fit for every animation format):

Code: Select all

    for fd=1 to Frame_cnt do
	    (
		    rot = RotationAnimation()
		    rot.BoneId = i
		    rot.KeyFrame = i*200-10
		    x = ReadFloat stream
		    y = ReadFloat stream
		    z = ReadFloat stream
		    w = ReadFloat stream
			
		    rot.Quaternion = quat x y z w
	
		    append allRotations rot
	    )

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 4:49 pm
by xandro
Thanks I'm checking everything in nifskope for now I even remove bunch of branchs that was useless I removed all other animation and just left one to see what is going to happen, everything works fine but nifSkope if giving me wrong offSet for some things.

Here is the screenshot of something they called "Compact Control Points" : https://prnt.sc/deBC4VNkqA-b
I tried removing those and animations is breaking(like one leg is not moving anymore...)

I found where they are (thanks to nifSkope) : https://prnt.sc/7N1D78mG97C7
For some reason those numbers are not in the order in hex like in the nifSkope.'
Now even I manage to create a tool to get those numbers what should my next step be I have no clue. I just know I will have to combine them somehow with skeleton and display them somewhere.

edit : So what I found I discovered is that I will surely need those "Compact Control Points", still I have to check what else.
After all I do from NifSkope I can't import it in blender again.
I tried comparing values from Compact Control Points with the one from SMD file and they are not there hmm?

Re: NIF to FBX?

Posted: Sat Apr 01, 2023 5:10 pm
by shakotay2
Ok, forget the blocks I assumed to be logged: they seem to contain just "per vertex weights".

This is funny. Where, the hell, are the frames in this d... nif?

edit: meanwhile I'd guess they're preceded by 000000 FFFFFFFF. There's 1108 of them in the boar nif.

Re: NIF to FBX?

Posted: Sat Apr 01, 2023 5:37 pm
by xandro
It's really weird.
I'm right now trying to create own tool to export those skeletons (for now) but I'm with something.

This is SMD exported by nif and I discovered the numbers on the right side are some references to bones I guess.
Here is a picture : https://prnt.sc/AA1Cz7V_tHhK

I can't find those number anywhere in the file I even tried using NifSkope but it's a different.
Here is the skeleton I'm trying to analyze : https://www.sendspace.com/file/ni5vc9

Anyway I tried to find something in those anim nif files but no luck with that, they used NIF files for almost everything textures,objects,items,animations I even found the one that are used for some settings in game It's ridiculous.

I asked to many folks and no one managed to do it.They are probably not interested or not capable of.

edit :
Here is the animation of model where I removed all other animation and left only one to make it easier to analyze : https://www.sendspace.com/file/2dej89

I only found those `Compact Control Points` which has some numbers Im not sure what they mean, on the other hand I don't see any floats values.

Re: NIF to FBX?

Posted: Sat Apr 01, 2023 7:05 pm
by shakotay2
xandro wrote: Sat Apr 01, 2023 5:37 pmThis is SMD exported by nif and I discovered the numbers on the right side are some references to bones I guess.
That's the parent ids. Time to learn the basics...

Re: NIF to FBX?

Posted: Sat Apr 01, 2023 7:08 pm
by xandro
Okay but where are those Id's in nif file?

Re: NIF to FBX?

Posted: Sun Apr 02, 2023 12:19 am
by 05SpeedMaster
shakotay2 wrote: Sat Apr 01, 2023 7:05 pm Time to learn the basics...
Now that right there is PRICELESS!
:lol:

Re: NIF to FBX?

Posted: Sun Apr 02, 2023 12:24 am
by xandro
I'm sorry about it but I never before heard of .SMD files, it's my first time working with it.