Page 2 of 4

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 3:47 pm
by shakotay2
Which blender version did you use for the plugin?
When I try 2.82 which the Niftools were allegedly written for I get:
"ImportError: cannot import name 'prod' from 'math' (unknown location)"

(I used blender 2.82, 64 bit, btw.)

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 3:49 pm
by xandro
I used blender 3.4 and it worked except for animations.

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 3:54 pm
by shakotay2
blender 32 bit or 64 bit version?

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 3:55 pm
by xandro
It's 64bit version.

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 4:24 pm
by shakotay2
well, see, there's a problem with the back legs:
.
pig_strange_legs.png
Quadruped models are said to be more difficult. Did you try a character model?
Or an animated chest, if any?

This will take some time to check the scripts. As always I'm very busy. So can take some weeks.
But don't expect more than some print lines for debugging.

When you delete the pig's mesh and look at its skeleton you can guess that it's faulty.
You might try a skeleton builder to get the correct skeleton. There's two tools, one from Durik, the other one from Bigchillghost.

btw, when unfolding the bones hierarchy of Scene root in the outliner it looks ok.
So it's assumed that the rotations were calculated wrongly (just a wild guess).

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 4:45 pm
by xandro
Here try this model : https://www.sendspace.com/file/fzm8eh
80% of animations works propertly, still there is a problem with others.
About those coordinates, someone told me there is a problem with calculating rotation's while developers told me "You don't know what you talk about" so I came here in hope someone could show me a right direction, that guy even send me all the math required to calculate it right, I'm just not great with python.

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 5:09 pm
by shakotay2
yeah, cool. You can export it to fbx and load it into Noesis.

The pig's head's moving nicely from 240 ms to 500 ms, for example.
edit: well, seems it's milliseconds, not frames in Noesis (up to 1200). In blender it's assumed to be frames (up to 250?)

Here's the pig's skeleton in smd format (maybe some rotation values are wrong?)

Code: Select all

version 1
nodes
  0 "Reference"  73
  1 "Reference NonAccum"  0
  2 "Bip01"  1
  3 "Bip01 Footsteps"  2
  4 "Bip01 Pelvis"  2
  5 "Bip01 Spine"  4
  6 "Bip01 Spine1"  5
  7 "Bip01 Spine2"  6
  8 "Bip01 Neck"  7
  9 "Bip01 Head"  8
  10 "Bip01 HeadNub"  9
  11 "Bip01 Ponytail1"  9
  12 "Bip01 Ponytail1Nub"  11
  13 "Bip01 Ponytail2"  9
  14 "Bip01 Ponytail2Nub"  13
  15 "Bip01 JawBone"  9
  16 "Dummy_Impact_05"  9
  17 "Dummy_Cast_Secondary"  9
  18 "Dummy_Cast_Primary"  9
  19 "Dummy_Impact_02"  9
  20 "Dummy_Head_Above"  9
  21 "Dummy_Head_Around"  9
  22 "Bip01 Clavicle.L"  8
  23 "Bip01 UpperArm.L"  22
  24 "Bip01 Forearm.L"  23
  25 "Bip01 Hand.L"  24
  26 "Bip01 Finger0.L"  25
  27 "Bip01 Finger0Nub.L"  26
  28 "Dummy_Impact_04"  22
  29 "Bip01 Clavicle.R"  8
  30 "Bip01 UpperArm.R"  29
  31 "Bip01 Forearm.R"  30
  32 "Bip01 Hand.R"  31
  33 "Bip01 Finger0.R"  32
  34 "Bip01 Finger0Nub.R"  33
  35 "Dummy_Impact_01"  30
  36 "Dummy_Impact_03"  6
  37 "Bip01 Thigh.L"  5
  38 "Bip01 Calf.L"  37
  39 "Bip01 HorseLink.L"  38
  40 "Bip01 Foot.L"  39
  41 "Bip01 Toe0.L"  40
  42 "Bip01 Toe0Nub.L"  41
  43 "Bip01 Thigh.R"  5
  44 "Bip01 Calf.R"  43
  45 "Bip01 HorseLink.R"  44
  46 "Bip01 Foot.R"  45
  47 "Bip01 Toe0.R"  46
  48 "Bip01 Toe0Nub.R"  47
  49 "Bip01 Tail"  5
  50 "Bip01 Tail1"  49
  51 "Bip01 TailNub"  50
  52 "Boar"  73
  53 "Bip01 Footsteps_end"  3
  54 "Bip01 HeadNub_end"  10
  55 "Bip01 Ponytail1Nub_end"  12
  56 "Bip01 Ponytail2Nub_end"  14
  57 "Bip01 JawBone_end"  15
  58 "Dummy_Impact_05_end"  16
  59 "Dummy_Cast_Secondary_end"  17
  60 "Dummy_Cast_Primary_end"  18
  61 "Dummy_Impact_02_end"  19
  62 "Dummy_Head_Above_end"  20
  63 "Dummy_Head_Around_end"  21
  64 "Bip01 Finger0Nub.L_end"  27
  65 "Dummy_Impact_04_end"  28
  66 "Bip01 Finger0Nub.R_end"  34
  67 "Dummy_Impact_01_end"  35
  68 "Dummy_Impact_03_end"  36
  69 "Bip01 Toe0Nub.L_end"  42
  70 "Bip01 Toe0Nub.R_end"  48
  71 "Bip01 TailNub_end"  51
  72 "Boar_end"  52
  73 "Scene Root"  -1
end
skeleton
time 0
  0 0.000000 0.000000 0.000000 -0.000000 -1.570796 -1.570796
  1 0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000000
  2 517.459900 463.074432 515.832092 -1.570055 -0.000024 -0.000000
  3 -591.973633 -0.000066 -0.000018 1.570795 0.000000 -0.000000
  4 0.000115 -0.000074 -0.000017 -0.000000 -1.570796 -1.570797
  5 45.538841 55.676006 45.528015 1.191767 0.000006 0.000033
  6 164.696304 201.302734 164.673782 0.314925 0.000012 0.000016
  7 145.875610 178.290054 145.870728 0.183933 0.000003 0.000003
  8 -0.000014 93.754105 -0.200937 -0.000000 -0.000000 0.000000
  9 -0.000058 252.194473 0.000029 -1.397790 0.000050 0.000004
  10 -0.000074 298.048584 -0.000026 0.000000 0.000000 -0.000000
  11 -63.308262 -37.067284 -46.798855 -0.510581 -1.225192 1.792191
  12 -0.000059 195.990448 0.000116 1.571593 -0.000003 -3.141592
  13 102.855873 90.544868 80.694115 -2.989203 0.299004 1.845733
  14 0.000056 195.990479 -0.000072 1.571593 -0.000003 3.141593
  15 -1.767554 -218.092484 34.795414 3.141591 -0.095118 1.570796
  16 76.953209 -10.236980 531.403015 -3.141591 0.304331 1.570796
  17 10.028607 -196.528748 497.110565 -3.141591 0.312574 1.570797
  18 10.020944 -193.782288 496.316040 -3.141591 0.277684 1.570796
  19 102.759064 302.322357 -44.360611 -3.141591 0.304331 1.570796
  20 15.591098 406.861572 -94.534187 -3.141591 0.304331 1.570796
  21 15.417193 68.282410 14.109765 -3.141591 0.308373 1.570796
  22 145.585236 0.000090 0.200517 2.510821 0.001049 1.570722
  23 -0.000006 230.582291 0.000026 -1.315316 -0.339778 1.534946
  24 0.000144 507.108093 0.000047 -0.604740 0.000006 0.000003
  25 0.000005 204.178528 0.000016 -1.210856 0.090976 -0.250377
  26 0.000054 67.611160 -0.000018 0.000033 -0.000773 0.000033
  27 -0.000180 16.902819 -0.000042 -0.000000 0.000000 -0.000000
  28 53.875999 140.821945 113.337616 1.733357 -0.930459 -1.772541
  29 -145.585251 0.000119 0.201262 2.510822 -0.001072 -1.570706
  30 -0.000025 230.582535 -0.000225 -1.545917 0.339816 -1.535007
  31 -0.000065 507.108215 0.000050 -0.604730 0.000021 0.000011
  32 0.000021 204.178436 0.000107 -1.211005 -0.074903 0.252041
  33 -0.000027 67.611191 -0.000026 0.000033 0.000840 0.000033
  34 0.000116 16.902765 0.000038 3.141592 0.000000 0.000000
  35 -43.247368 43.655651 -58.757385 -0.035712 -0.122443 -1.275804
  36 -236.528778 121.321335 -154.707977 3.141559 1.507641 1.570766
  37 67.815338 43.736511 56.894299 1.401501 0.102906 2.909705
  38 0.000061 293.582458 -0.000058 -1.637556 -0.000040 0.000001
  39 0.000013 183.356033 -0.000011 1.561059 0.000000 0.000042
  40 -0.000038 177.932999 -0.000004 -0.128693 0.199656 0.156429
  41 -0.000081 62.202305 80.051582 1.570796 -0.000000 -0.000000
  42 0.000091 8.113413 -0.000001 -3.141593 -0.000000 0.000000
  43 -74.628746 -58.022881 -44.860973 1.761433 -0.102937 -2.909771
  44 -0.000044 293.582336 -0.000080 -1.673452 -0.000022 0.000001
  45 -0.000038 183.355911 0.000071 1.561032 0.000000 0.000037
  46 -0.000016 177.933105 0.000216 -0.458122 -0.238829 -0.084071
  47 -0.000013 62.202354 80.051628 1.570796 0.000000 0.000000
  48 -0.000004 8.113349 0.000003 -0.000000 0.000000 -0.000000
  49 -50.685326 -64.217865 -57.601292 2.108591 -0.000008 0.000028
  50 96.758041 118.265938 96.741570 -0.280043 -0.000061 0.000261
  51 0.000017 195.990570 -0.000004 1.571593 -0.000003 3.141593
  52 0.000000 0.000000 0.000000 -0.000000 -1.570796 -1.570796
  53 0.000005 295.986786 -0.000012 -0.000000 -0.000000 -0.000000
  54 -0.000025 155.017593 -0.000013 -0.000000 0.000000 -0.000000
  55 0.000018 195.990601 -0.000027 0.000000 0.000000 0.000000
  56 -0.000016 195.990555 0.000059 0.000000 0.000000 0.000000
  57 -0.000024 155.017609 0.000017 0.000000 0.000000 -0.000000
  58 0.000011 155.017548 -0.000053 -0.000000 0.000000 -0.000000
  59 0.000002 155.017502 0.000005 0.000000 0.000000 -0.000000
  60 -0.000001 155.017532 0.000018 0.000000 0.000000 -0.000000
  61 -0.000036 155.017563 0.000003 0.000000 0.000000 -0.000000
  62 0.000001 155.017456 0.000023 0.000000 0.000000 -0.000000
  63 -0.000000 155.017502 -0.000008 -0.000000 0.000000 -0.000000
  64 0.000023 16.902819 0.000014 -0.000000 0.000000 -0.000000
  65 -0.000005 196.016251 -0.000002 -0.000000 0.000000 0.000000
  66 0.000039 16.902754 0.000013 -0.000000 -0.000000 -0.000000
  67 0.000047 277.787476 0.000009 -0.000000 0.000000 0.000000
  68 -0.000005 263.815338 0.000003 -0.000000 0.000000 -0.000000
  69 -0.000016 8.113394 0.000001 0.000000 0.000000 -0.000000
  70 0.000032 8.113385 0.000001 -0.000000 0.000000 -0.000000
  71 0.000021 195.990570 0.000048 0.000000 -0.000000 0.000000
  72 0.000000 100.000000 -0.000000 -0.000000 0.000000 -0.000000
  73 0.000000 0.000000 0.000000 -1.570796 -0.000000 0.000000
end

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 5:13 pm
by xandro
Hmm okay this is step :D I tried exporting it with noesis before and it never worked except for raw mesh.
How could I check if rotations are good? maybe compare them with one from nifSkope? I'm not sure, nifskopes uses different coordinate system as far as I know.
Also how did you get those numbers?

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 5:30 pm
by shakotay2
xandro wrote: Thu Mar 30, 2023 5:13 pmHow could I check if rotations are good?
For the pig the mouth is moving nicely from 950 ms to the end. This means rotations for related bones are correct. This is strange, usually when using wrong formulas every bone is affected. In some cases (other format, though) I set all rotations to zero and checked the translation. but this doesn't work always.

Thus I could see whether the skeleton was intact.

Instead of wild guessing I'd recommend to build the skeleton using a skeleton finder. There's some dozens of example here in the forum by Bigchillghost and Durik. With some luck there's a nif example among them, dunno.
maybe compare them with one from nifSkope? I'm not sure, nifskopes uses different coordinate system as far as I know.
The main problem with Nifskope is that it exports to obj only. At least the last version I used one or two years ago.

Ha, well, I remember having had NifSkope compiled on my old PC. I have no idea whether I can get it running again (because of HD change).

"The numbers?" Simply export as SMD from Noesis after having dragged an fbx onto it. Yeah, one of the coolest features of Noesis. Wouldn't want to miss it...

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 5:32 pm
by xandro
So you are telling me the skeleton could be the problem and I should try to export it on some other way?
Because those nif files are from parts(mesh,skeleton,animations) and I merge them in one NIF so blender could open them otherwise there is couple of problems.

Sorry, When I said "numbers" I meant rotations, thanks I will check that in noesis.
Also I remember noesis could export nif skeleton to fbx.
Here is the skeleton of the pig : https://www.sendspace.com/file/8652du

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 5:51 pm
by shakotay2
That skeleton looks decent. Now it's just a matter of time to combine this skeleton with the animation frames. :D But who will do it? :eek:

But it has less bones and the hierarchy might be different. Maybe not so easy to perform?

Code: Select all

version 1
nodes
  0 "Scene Root"  -1
  1 "Reference"  0
  2 "Reference NonAccum"  1
  3 "Bip01"  2
  4 "Bip01 Footsteps"  3
  5 "Bip01 Pelvis"  3
  6 "Bip01 Spine"  5
  7 "Bip01 Spine1"  6
  8 "Bip01 Spine2"  7
  9 "Bip01 Neck"  8
  10 "Bip01 Head"  9
  11 "Bip01 HeadNub"  10
  12 "Bip01 Ponytail1"  10
  13 "Bip01 Ponytail1Nub"  12
  14 "Bip01 Ponytail2"  10
  15 "Bip01 Ponytail2Nub"  14
  16 "Bip01 JawBone"  10
  17 "Dummy_Impact_05"  10
  18 "Dummy_Cast_Secondary"  10
  19 "Dummy_Cast_Primary"  10
  20 "Dummy_Impact_02"  10
  21 "Dummy_Head_Above"  10
  22 "Dummy_Head_Around"  10
  23 "Bip01 L Clavicle"  9
  24 "Bip01 L UpperArm"  23
  25 "Bip01 L Forearm"  24
  26 "Bip01 L Hand"  25
  27 "Bip01 L Finger0"  26
  28 "Bip01 L Finger0Nub"  27
  29 "Dummy_Impact_04"  23
  30 "Bip01 R Clavicle"  9
  31 "Bip01 R UpperArm"  30
  32 "Bip01 R Forearm"  31
  33 "Bip01 R Hand"  32
  34 "Bip01 R Finger0"  33
  35 "Bip01 R Finger0Nub"  34
  36 "Dummy_Impact_01"  31
  37 "Dummy_Impact_03"  7
  38 "Bip01 L Thigh"  6
  39 "Bip01 L Calf"  38
  40 "Bip01 L HorseLink"  39
  41 "Bip01 L Foot"  40
  42 "Bip01 L Toe0"  41
  43 "Bip01 L Toe0Nub"  42
  44 "Bip01 R Thigh"  6
  45 "Bip01 R Calf"  44
  46 "Bip01 R HorseLink"  45
  47 "Bip01 R Foot"  46
  48 "Bip01 R Toe0"  47
  49 "Bip01 R Toe0Nub"  48
  50 "Bip01 Tail"  6
  51 "Bip01 Tail1"  50
  52 "Bip01 TailNub"  51
end
skeleton
time 0
  0 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000
  1 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000
  2 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000
  3 -0.000000 52.770729 59.964443 0.000000 -0.000000 -1.570795
  4 -0.000000 0.000000 -59.197372 0.000000 -0.000000 1.570795
  5 -0.000000 0.000000 0.000000 -0.000000 -1.570796 -1.570795
  6 10.139530 -0.010773 0.000014 -0.000005 0.000001 1.192445
  7 36.609955 -0.024542 -0.000001 -0.000000 -0.000001 0.315119
  8 32.420204 -0.007331 -0.000001 -0.000000 -0.000000 0.184036
  9 9.375415 -0.020087 -0.000000 0.000000 0.000000 -0.000000
  10 25.219458 0.000003 -0.000001 -0.000002 0.000003 -1.398568
  11 29.804855 0.000003 -0.000001 -0.000000 0.000000 0.000000
  12 8.112296 -1.618045 -18.132809 -1.818831 1.260274 -0.574104
  13 19.599062 0.000007 0.000002 3.141592 -0.000003 1.570000
  14 7.950425 -1.899242 20.265848 -2.888400 -1.299467 -0.572248
  15 19.599056 -0.000002 -0.000014 -3.141592 -0.000003 1.570000
  16 -21.809240 3.479539 -0.176734 -0.000000 -1.570796 -3.046475
  17 -1.023701 53.140301 7.695333 -0.000000 -1.570796 2.837261
  18 -19.652868 49.711071 1.002868 -0.000000 -1.570796 2.829019
  19 -19.378227 49.631603 1.002105 -0.000000 -1.570796 2.863909
  20 30.232227 -4.436053 10.275923 -0.000000 -1.570796 2.837261
  21 40.686115 -9.453411 1.559119 -0.000000 -1.570796 2.837261
  22 6.828235 1.410981 1.541732 -0.000000 -1.570796 2.833220
  23 0.000010 0.020042 14.558525 1.570796 -0.852983 1.570000
  24 23.058250 -0.000005 -0.000004 -1.538602 -0.031556 -1.124208
  25 50.710808 0.000006 0.000002 0.000000 -0.000000 -0.200000
  26 20.417854 0.000000 -0.000001 0.258563 -0.005290 -1.385574
  27 6.761121 -0.000001 -0.000000 -0.000796 0.000000 -0.000000
  28 1.690283 0.000000 -0.000001 -0.000000 0.000000 -0.000000
  29 14.082219 11.333744 5.387600 -1.690804 -0.000001 0.630550
  30 0.000011 0.020130 -14.558525 -1.570796 0.852977 1.570000
  31 23.058250 -0.000008 0.000001 1.538602 0.031556 -1.124208
  32 50.710819 0.000004 -0.000004 -0.000000 -0.000000 -0.200000
  33 20.417858 0.000001 0.000004 -0.254472 0.020400 -1.389525
  34 6.761122 -0.000001 0.000002 0.000796 -0.000000 -0.000000
  35 1.690279 -0.000000 -0.000000 -0.000000 0.000000 3.141592
  36 4.365568 -5.875739 -4.324728 -0.004591 -1.278076 -0.123117
  37 12.132133 -15.470763 -23.652884 -0.000000 -1.570796 1.633949
  38 -3.735413 9.426335 20.347826 2.917799 0.089684 1.572859
  39 29.358227 -0.000002 -0.000003 -0.000000 0.000000 -1.419884
  40 18.335594 0.000003 -0.000002 0.000000 0.000000 1.304289
  41 17.793306 -0.000001 0.000001 0.177600 0.163503 -0.236019
  42 6.220233 8.005159 0.000000 -0.000000 -0.000000 1.570796
  43 0.811335 -0.000000 0.000001 -0.000000 0.000000 -3.141593
  44 -3.735416 9.426451 -20.347771 -2.917799 -0.089689 1.572860
  45 29.358234 -0.000007 -0.000003 0.000000 0.000000 -1.419884
  46 18.335588 0.000004 -0.000002 0.000000 0.000000 1.304289
  47 17.793318 0.000006 -0.000001 -0.177599 -0.163502 -0.236019
  48 6.220235 8.005167 0.000000 -0.000000 -0.000000 1.570796
  49 0.811338 -0.000000 0.000001 0.000000 -0.000000 -0.000000
  50 -13.550591 -6.909731 -0.000009 -0.000009 -0.000003 -3.126749
  51 21.522713 -0.014268 0.000000 0.000019 0.000264 0.417888
  52 19.599062 0.000002 0.000001 3.141593 -0.000003 1.570000
end

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 6:19 pm
by xandro
How I can combine skeleton with animation frames? I'm willing to do it, I'm just not sure if I can.
So I still don't get it is the skeleton or animation problem? I always thought it's some animation problem.
It have less bones? what does that mean, you compared the Boar.nif and the one I sent you? with the skeleton?

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 7:00 pm
by shakotay2
xandro wrote: Thu Mar 30, 2023 6:19 pm How I can combine skeleton with animation frames? I'm willing to do it, I'm just not sure if I can.
That's not a 15 minutes job. You'll need some experience for such. If you can't do it for yourself you need to wait 'til someone spends the time.
So I still don't get it is the skeleton or animation problem?
If I knew the solution I'd tell. Surely. I didn't check the animation frames.
What I can see is that the last skeleton.nif you uploaded looks decent. So that could be a good start.
It have less bones? what does that mean, you compared the Boar.nif and the one I sent you? with the skeleton?
Yes, I just compared both SMDs which I uploaded. There's no magic behind this.

I've already spent more time than intended. If you want it quick I can't serve, sorry. As I said, maybe in some weeks.

Re: NIF to FBX?

Posted: Thu Mar 30, 2023 7:56 pm
by xandro
Okay, thank you so much

Re: NIF to FBX?

Posted: Fri Mar 31, 2023 11:52 am
by shakotay2
The funny thing is that NifSkope plays the boar's animation perfectly. But as I said this version exports to .obj only.
If I don't miss something I'll need to patch the source code (which I neither have the time nor am, well, capable :eek: ) to get the anims out.
(afair there was a .dae export in one of those dozens of versions...)

edit: well, I'm such a dumbo. You can "Save As" Keyframe (*.kf). That it is...
.
Boar-Anim.jpg
(hmm, dragging the .kf onto Noesis and loading the skeleton.nif doesn't show an animation. I could have sworn it worked with some other format, some day...) .kfa has the same contents as .kf, btw

I finally tried to combine nif/kf using said blender plugin. This is what it tells then:

niftools:INFO:Animation estimated at 24 frames per second.
niftools:WARNING:Unknown KF root block found : Scene Root
niftools:WARNING:This type isn't currently supported: <class 'generated.formats.nif.nimain.niobjects.NiNode.NiNode'>
niftools:INFO:Finished successfully