Hi guys again, in case someone is following up, i'm still stuck in the same place, i didn't expect this to be so hard... i added a TL;DR at the end in case someone doesn't want to eat the Charles Dickens chapter, this is going to be a big post since it's been a while i don't post so i'm gonna spit it all out.
fatduck wrote:You Bones Initial transformation are WRONG!
Remember the struct I post:
Code: Select all
struct Common_Obj_Properties {
dword Object_ID
char[] Object_Name
char[] Parent_Name
float ?? //always 0.1
float[16] Object_Transform_Matrix //Object_Version = 0.1 parent base, or 0.2 world base
float Object_Version
}
if Object_Version is 0.2, the Object_Transform_Matrix is already a world matrix. No need to consider the parent transformation
I know

, but thank you i managed to get the bones properly... however...
But the problem goes as follows.
I did the follwing check:
Code: Select all
if ObjVer == 0.2 then
(
newBone.transform = Transformation
)
else newBone.transform = Transformation * (newBone.parent.transform)
This goes for bones, However i had to do it the other way around in Meshes(Using local transform when it is 0.2)
Although this is supposed to be working most of the times I got forced to do A LOT OF CHECKS on the flags the name has to see if the model needs local or world transformation, because although i thought the 0.1 or 0.2 should be fine, it isn't
Let's take a look at a "Monster" and the "Player" bones.
I'm going to use 3 examples, the first one is the Player biped, which is in the character folder.
First, our beloved female shirt (Reminding i'm always the piece of code from the upper part)
The version is 0.1, there is not a single object that is 0.2, so we can say that it works.
Next Let's go to the first monster, the little girl.
Looks fine too, and the bones are 0.2, so everything is fine for now
Howeeeeever if we go to the second monster...
So there are two problems here
The first thing is that that is misplaced and should be up, this item is version 0.1, however, why it doesn't work with this object yet with the rest does?
This bug happens when the checks i did on the mesh transform are applied, but however, if i remove the checks and leave it just to the one above (Because i did extra checks on the mesh aside that one) This one will be right and the others won't
So the only thing it comes to my mind is that there must be something else that defines what is local and global transformation
Also as a curious thing The little girl had Bonesystem's version 0.2, while the Shirt and the grim reaper were 0.1, could this mean something? i don't know, but anyway, the only way to get the characters properly displayed is by removing the transformation matrix if their parent is the BONESYSTEM, so this at first shouldn't bother much..., but this is really weird, even though the world and local matrix are stated all the time i am forced to do a lot of checks because it changes too often.
First i have to check if the object has "oct" on it's name, since this is the collision mesh and must be local transformed so it belongs to the mesh, and this is 0.1!
Then, i have to check if the objects belong to the "blast" helper, since this moves a lot of objects in the map and if i don't apply local transformation the objects go all over the place.
Code: Select all
else if((findstring msh.parent.name "blast") != undefined) then
(
msh.transform = Transformation * (msh.parent.transform)
)
And some of them are parent of parents, so even if i add this, there are some maps like
this one that need to get the local matrix applied, so i would have to check the parent's parent if it's "blast" to get the job done.
Buuut if i do this, the following error appears when i try to run the grim reaper:
Code: Select all
-- Unknown property: "name" in undefined
in line 440.
Code: Select all
else if((findstring msh.parent.name "blast") != undefined) then
The reason is probably because there is no parent, i guess, or i don't know,
So summing up, the transformation is screwed no matter how hard i try, but i'm sure the 0.2 and 0.1 floats are not enough.
Some screwed weapons.
Also, i'm sorry, i may be too dumb, but i don't know how to get skinning working, i tried a lot of stuff from differen't people's help, and i didn't get with the right key, i thought this could be done easier than the rest but i'm having a REALLY hard time to do skinning, i'm sorry, i am totally lost here and i don't know anymore what to do >_<, i even rewrote the whole script to make it more organized but didn't do the trick. Also fatduck you told me to check your fatimporter's skinning script but it's encrypted so i can't really check it q_q
I tried my best, but skinning beats me, maybe it's easier than i think, but i ran out of ideas and sources..., crawled from all the skinning scripts, (such as Diablo II for example), but got no results.
I belive It's almost done, but something is missing:
It looks like some vertex don't get skinned, but some of them actually get applied.
The last thing i have is from shakotay2, which helped me to point out the follwing issue:
Code: Select all
for i = 1 to Num_Skin_Bone do
(
BoneSkinName = readstring f
--print "Bone Name:"
print BoneSkinName
--append Skin_Bones BoneSkinName
MaBone = (GetNodeByName BoneSkinName)
skinOps.addbone skinMod MaBone 1
for m = 1 to 16 do readfloat f
ClassOf ObjectToExportt
kmax = skinOps.GetNumberBones skinMod
k= 0;
while k < kmax do
(
k = k + 1; --print k
BN1 = skinOps.GetBoneName skinMod k 0; BN2 = (GetNodeByName BoneSkinName).name
format "<%> <%>\n" BN1 BN2
if BN1 == BN2 then
(
bone_id = k
k = kmax; print "break k-loop"
)
)
ClassOf msh
num_Skin_Data = readlong f
--print "Number of Skin Data:"
--print num_Skin_Data
append Skin_Data num_Skin_Data
for i = 1 to num_Skin_Data do
(
Vert_Index =readlong f #unsigned
Weight = readfloat f
skinOps.setVertexWeights skinMod (Vert_Index+1) bone_id Weight
--append Skin_Vert_Index Vert_Index
--append Skin_Vert_Weight Weight
)
)
So it turns out that if we check at the log, BN1 and BN2 will never met, however i managed to make some of them get met.

which may mean why some of the vertex are never met, but i am not sure how to handle this.
Found out a minor issue, that although is not a big deal, maybe someone knows how to deal with, it has to do with the materials,
in concrete with the MultiMaterial.
In line 483:
Code: Select all
if((findstring ObjName "alpha") != undefined) then
(
map.opacityMap = bitmaptexture name:("Opacity_"+ObjName)
map.opacityMap.filename = map.diffuseMap.filename
if((findstring ObjName "alphablend1") != undefined) then
(
map.opacityMap.monoOutput = 1
)
else if((findstring ObjName "Alphatest") != undefined) then
(
map.opacityMap.monoOutput = 1
)
)
The error is: -- Unknown property: "opacityMap" in undefined, so i guess it doesn't identify it, however this only happens in the map
i gave above, ds5_station (in case you missed it,
this one)
Again this is not a great deal, but if someone knows what is wrong it will be great
Anyways.
Script redone
To do list:
Skinning
Animation
- Fix the Transformation matrix issue (world and local things,there must be something else that tells what to use rather than a lot of checks, or maybe not...)
Some models with multiple objects
here.
- Rewrite the material section into something that doesn't make the program throw errors(mostly multi-material issues).
- Fix the mesh import, since there are still models that are not working, these models are packed
here.
The errors are mostly in the material section and in the transformation section (the checks are bad and it might crash since it lacks parents probably), and some others make the whole program crash
(As shakotay2 stated before, there is a point that reads a giant count and it crashes, but i am not sure where the problem is.)
For some reason the script stops working everytime i close 3DS so i have to do some random changes and put it back how it was everytime i start, not sure if i'm the only one, would be good to know if osmeone else experiences this, it's like it doesn't open the file, or i don't know, it's a weird bug because it actually works.
I have to rewrite the whole script in another file and when i finish it works on the previous one, i seriously don't understand this.
Other things i found:
Remember the Katana_a.scn, which had a weird animation pattern?, well i never noticed, but we allways got a unknown flag that always was 0, and turns out that in this one the flag is 1, and then it starts naming all the animation names, this can lead to an unknown loop i don't know yet, i will find it out eventually, but thank god i found out that there was a difference, i was so desperate about this issue!
Anyways, in case that you did it, thank you for reading all of this, and if you have any clues on how to get any things fixed, please, let me know, this thing is going to kill me this way
And that's it for today, heading to the bed, good night
TL;DR: Transformation is a mess and I'm getting really annoyed by Skinning, yet i think it's almost done, but i don't know to be honest.