Page 2 of 6

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 1:16 pm
by MrAdults
NoeBone takes a string and/or an index to specify parent, for convenience. This way you can have it match bone hierarchies by names or by index. You're trying to pass in an int for the string argument, you rather want:

Code: Select all

b = NoeBone(bc, boneNames[bc], NoeMat43(list(k)), None, bc)
However, that means you're passing in the the bone's index as its parent index, which translates to "no parent", so rpgMultiplyBones will hand you back the same matrices you passed it. You'll need to use the correct hierarchy, unless there really are no parents, which means your bones are all in correct space already, not needing to be multiplied and not needing to be put in parent-local space. (since they have no parents)

When I refer to model space, bone-local space, etc., I'm talking about coordinate systems, not binary locations. :) So the animation data being in a different file doesn't have anything to do with what space things are in.

All the documentation there is on the Python API is in the __NPReadMe.txt file. I've been too lazy to make real documentation with example usages and all that, as the API is large enough that it would be its own undertaking, and when I have that kind of time I usually prefer to spend it actually programming. Which makes the API larger. It's a vicious cycle. ;)

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 2:41 pm
by shakotay2
Alsair wrote:This code should work with the skeletons + .bsc files I've included in my main post.
It surely would if one corrected the indentation errors at line 32 and 166. :D

Then I had a look at gr_010_body.bsc in Noesis and I wondered which would be the moving parts?
Although this could be solved by viewing the bot ingame
the strange bone indexing from 1 to 5, 9, 34, 36, 38, 39, 40 for the body doesn't make things clearer.

So from a practical point of view I would suggest you to start your investigation on a simpler model if any.
MrAdults wrote:It's a vicious cycle. ;)
Hehehe, I really hope Alsair becoming your fellow Noesis follower who will create a Noesis documentation thread where he will present a collection of links to all your valuable comments you've given so far on rapi functions.

Alsair, will you? :)

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 4:22 pm
by Demonsangel
shakotay2 wrote:Hehehe, I really hope Alsair becoming your fellow Noesis follower who will create a Noesis documentation thread where he will present a collection of links to all your valuable comments you've given so far on rapi functions.

Alsair, will you? :)
I started something like this a year ago, the only comments I got were "don't bother".

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 6:04 pm
by MrAdults
Who said don't bother? That would be very useful. Although my random comments wouldn't be that useful totally out of context. Real docs with my remarks in-context would be very helpful though. :)

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 6:38 pm
by Demonsangel
Can't remember really, I removed the pm's. But I basically asked for some Noesis regulars to help me since I still consider myself a rookie.
I think I removed the project from my drive so I only have this robust example attached below.
Noesis Manual.rar
The reason I wanted others to help is to filter out my errors or provide examples.

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 9:08 pm
by Alsair
MrAdults wrote:NoeBone takes a string and/or an index to specify parent, for convenience. This way you can have it match bone hierarchies by names or by index. You're trying to pass in an int for the string argument, you rather want:

Code: Select all

b = NoeBone(bc, boneNames[bc], NoeMat43(list(k)), None, bc)
However, that means you're passing in the the bone's index as its parent index, which translates to "no parent", so rpgMultiplyBones will hand you back the same matrices you passed it. You'll need to use the correct hierarchy, unless there really are no parents, which means your bones are all in correct space already, not needing to be multiplied and not needing to be put in parent-local space. (since they have no parents)

When I refer to model space, bone-local space, etc., I'm talking about coordinate systems, not binary locations. :) So the animation data being in a different file doesn't have anything to do with what space things are in.

All the documentation there is on the Python API is in the __NPReadMe.txt file. I've been too lazy to make real documentation with example usages and all that, as the API is large enough that it would be its own undertaking, and when I have that kind of time I usually prefer to spend it actually programming. Which makes the API larger. It's a vicious cycle. ;)
The only matrices I was able to locate was the ones found in the skeleton for each frame in the animation. (Per bone)
I'm not sure if there are more, but as far as I could tell I couldn't find any additional ones.
Anyways, after setting the bones how would I go about to transforming the current model to use the bone structure? (Unless thats what setBones is supposed to do, since apparently in my case it did nothing)

@ Shakotay2
The indentation is fine when I used it, not sure why it threw you an error.


Edit:

After some more research, it looks like I may need to use rapi.rpgBindBoneIndexBufferOfs and rapi.rpgBindBoneWeightBufferOfs.
Where/What would be the BoneIndexBuffer and the BoneWeightBuffer? (Do I even need this at all?)

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 10:56 pm
by howfie
usually there's a matrix set for the bind pose, which is separate from the animation data. you have to find it. sometimes it's not a matrix set either. Tekken 6, for example, use Euler angles for bone orientations. Dynasty Warriors uses quaternions.

btw, i would remove that download link to all of the models, it might piss Rich (the author of Noesis) off lol.

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 11:12 pm
by Alsair
Oh, I didn't know it violated the rules.

The game is free to play, and the client itself is available for for anyone to download. This is merely an archive of some of the model files from the game.

I'll see what MrAdults says whether it's permitted or not, and I'll remove it based on his request.

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 11:15 pm
by howfie
oh ok, cool, then i might download it then too he he he. what game was this again?

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 11:17 pm
by Alsair
howfie wrote:oh ok, cool, then i might download it then too he he he. what game was this again?
It's an MMO game, with pretty cool models.

Re: [Noesis] Bone Mapping with Skeleton

Posted: Mon Jul 01, 2013 11:57 pm
by howfie
so i looked at gr_bone briefly.

did you look at the data from offsets

0x50D5 to 0x1E7E0 using a stride of 0xEF? there are 0x1B4 entries, one of the columns is a zero-based index and another 6 columns are standard little-endian floats. last two columns are short and kind of reference something... you can ignore the CDCDCDCD crap and the Bone01 one01 ne01 stuff. this appears to be the list of joints. since there are 6 float values i would try xyz and euler first... depending on if the floats are oftentimes like 1.57 (pi/2).

Re: [Noesis] Bone Mapping with Skeleton

Posted: Tue Jul 02, 2013 1:30 am
by MrAdults
howfie wrote:usually there's a matrix set for the bind pose, which is separate from the animation data. you have to find it. sometimes it's not a matrix set either.
Like I said, plenty of games don't use a bind pose, especially when vertices are in bone-local space. Also like I said, given that his verts are in bone-local space, he doesn't actually need the bind pose even if it exists separately.

Regarding transforming your verts ("fitting them to the skeleton"): Again like I mentioned some posts ago, you can skin model verts to a bone list with rapi.rpgSkinPreconstructedVertsToBones. It takes a list of NoeBones as input and operates on all committed vertices in the active RPG context. As indicated by my other post.

These valuable remarks of mine would be much more valuable if people would read them.

If you can't find per-vertex weight or index values, you'll find a per-vertex-chunk bone index or it'll be dictated by the chunk ordering or whatever else the format wants to do to provide it. If you don't have per-vertex values, you can generate a bytearray from a single value to bind using something like:

Code: Select all

data = noePack("i"*numVerts, *[boneIndex]*numVerts)

Re: [Noesis] Bone Mapping with Skeleton

Posted: Tue Jul 02, 2013 2:38 am
by Alsair
MrAdults wrote:
howfie wrote:usually there's a matrix set for the bind pose, which is separate from the animation data. you have to find it. sometimes it's not a matrix set either.
Like I said, plenty of games don't use a bind pose, especially when vertices are in bone-local space. Also like I said, given that his verts are in bone-local space, he doesn't actually need the bind pose even if it exists separately.

Regarding transforming your verts ("fitting them to the skeleton"): Again like I mentioned some posts ago, you can skin model verts to a bone list with rapi.rpgSkinPreconstructedVertsToBones. It takes a list of NoeBones as input and operates on all committed vertices in the active RPG context. As indicated by my other post.

These valuable remarks of mine would be much more valuable if people would read them.

If you can't find per-vertex weight or index values, you'll find a per-vertex-chunk bone index or it'll be dictated by the chunk ordering or whatever else the format wants to do to provide it. If you don't have per-vertex values, you can generate a bytearray from a single value to bind using something like:

Code: Select all

data = noePack("i"*numVerts, *[boneIndex]*numVerts)
I've tried using rpgSkinPreconstructedVertsToBones on my existing Bone List, but no changes occured. I've used it after I committed the vertices.

Re: [Noesis] Bone Mapping with Skeleton

Posted: Tue Jul 02, 2013 3:09 am
by howfie
rich, you really love making things more complex than they really are :P. did you look at the bon file this guy posted? he's got more problems than just figuring out which noesis function to call lol.

Re: [Noesis] Bone Mapping with Skeleton

Posted: Tue Jul 02, 2013 3:18 am
by Alsair
howfie wrote:rich, you really love making things more complex than they really are :P. did you look at the bon file this guy posted? he's got more problems than just figuring out which noesis function to call lol.

Sorry if I'm bothering you guys too much, this is my first time working with 3d models, and my first time with Noesis :P

I thought it would be something interesting to do.

I am a programmer, so I picked up a lot of it quite quickly.


Edit:

@howfie
I just filled that entire region with 00's and launched the game. The model loads perfectly with no issues. One thing I noticed, when I do an action (e.g. block, jump, run) and then stop (meaning it switches back to the idle standing animation) I get some frame lag.
Other than that the model appears to be normal.