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

[Noesis] Plugin to export to a new format

Post questions about game models here, or help out others!
Alsair
advanced
Posts: 66
Joined: Fri Jun 15, 2012 10:55 am
Has thanked: 4 times

[Noesis] Plugin to export to a new format

Post by Alsair »

Just need to figure out how to import SFX data, if that's even possible in Noesis? And is it possible to import collision data into Noesis?

Also, lets say I export my game model as .obj and then made some changes to the obj model, how/what would I have to do to export that obj model back to my game's format (via Noesis)? I have the entire structure of the file already, but I have no idea how to convert it back to normal. I was wondering, since Noesis is able to load all the supported model types, is it possible to read the model data drawn by Noesis and use that to write into the file, rather than parse the obj file directly? This way it would maximize compatibility? Also, would the bone names still be stored, since they are needed to be associated with the original skeleton file.
Last edited by Alsair on Wed Jul 03, 2013 11:09 pm, edited 42 times in total.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4286
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Bone Mapping with Skeleton

Post by shakotay2 »

Alsair wrote:The problem is, I am unable to identify the structure of the skeleton file.
Why starting with bone06 which appears to be the head bone? Why not starting with the body parenting? (bone01..05)
Which kind of monster is this?

Anyway this is a dump of gr_bone.bon
from address 0x1304a6:

Code: Select all

A0 71 F3 26 
-0.023781  0.881102 -0.181916 0.000000   // rotation
 0.899672  0.024285  0.000013 0.000000
 0.004922 -0.181849 -0.881423 0.000000
-0.724543  78.850624 8.867167 1.000000  // position

-0.025428  0.879284 -0.190297 0.000000
 0.899641  0.024870 -0.005299 0.000000
 0.000082 -0.190370 -0.879636 0.000000
-0.770086 78.314934  8.512207 1.000000

-0.030081   0.873726 -0.213772 0.000000
 0.899397   0.026028 -0.020178 0.000000
-0.013406   -0.214303 -0.874011 0.000000
-0.899963   77.700729 7.514522 1.000000

-0.037345   0.863854 -0.249722 0.000000
0.898584   0.026413 -0.043013 0.000000
-0.033956   -0.251114 -0.863591 0.000000
-1.105014   76.986885 5.977794 1.000000

-0.046852   0.848857 -0.295376 0.000000
0.896779   0.024426 -0.072049 0.000000
-0.059939   -0.298069 -0.847091 0.000000
-1.376558   76.144737 4.009815 1.000000

-0.058227   0.828017 -0.347847 0.000000
0.893625   0.018603 -0.105304 0.000000
-0.089692   -0.352196 -0.823355 0.000000
-1.705532   75.148705 1.722245 1.000000

-0.071077   0.800981 -0.404199 0.000000
0.888918   0.007940 -0.140578 0.000000
-0.121545   -0.410324 -0.791745 0.000000
-2.081883   73.985062 -0.771028 1.000000

-0.084963   0.767947 -0.461561 0.000000
0.882672   -0.007873 -0.175581 0.000000
-0.153857   -0.469249 -0.752418 0.000000
-2.494184   72.657814 -3.356892 1.000000

-0.099398   0.729762 -0.517269 0.000000
0.875143   -0.028332 -0.208138 0.000000
-0.185052   -0.525971 -0.706478 0.000000
-2.929508   71.191910 -5.927074 1.000000

-0.113828   0.687936 -0.569024 0.000000
0.866827   -0.052125 -0.236418 0.000000
-0.213667   -0.577952 -0.655987 0.000000
-3.373468   69.633598 -8.382324 1.000000

-0.127633   0.644573 -0.615008 0.000000
0.858420   -0.077261 -0.259124 0.000000
-0.238378   -0.623343 -0.603837 0.000000
-3.810497   68.048309 -10.635828 1.000000

-0.140131   0.602246 -0.653959 0.000000
0.850761   -0.101291 -0.275583 0.000000
-0.258010   -0.661089 -0.553526 0.000000
-4.224190   66.516663 -12.614957 1.000000

-0.150577   0.563831 -0.685142 0.000000
0.844751   -0.121558 -0.285691 0.000000
-0.271517   -0.690881 -0.508882 0.000000
-4.597660   65.128906 -14.260590 1.000000
But this looks like keyframes I assume.

For the structure (i.e. the parenting) you should look at the beginning of the bon file:

Bone 11, 19
Bone 10, 19
Bone 12, 19
Bone 14, 19 etc.

What I find strange are some cut strings like "one03" (disabled bone?)
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?"
Alsair
advanced
Posts: 66
Joined: Fri Jun 15, 2012 10:55 am
Has thanked: 4 times

Re: Bone Mapping with Skeleton

Post by Alsair »

Yeah I found that odd too, also I did some more research on the unknown data (after the anim frames)

It turns out

unknowndata (unused data? - 0x2423) some of the data in here controls the actual hitbox of when a monster is attacked.

I was looking at the head since that object only used one bone so I thought it would be easier to find the association/offsets for this bone.


Also, is there a way to calculate how many matrixes there are? I still can't seem to find how the game knows how many to read.

Edit:

It turns out each group of matrix is apart of one frame in the animation (just as you said), I tested this by editing some values and seeing the head disappear in a specific frame.


Still have no clue on how to map them Noesis though x.x
Last edited by Alsair on Wed Jul 03, 2013 10:55 pm, edited 1 time in total.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4286
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Bone Mapping with Skeleton

Post by shakotay2 »

Alsair wrote:Still have no clue on how to map them Noesis though x.x
The matrices?

Want to get the bones structure or want to display the animations?

Maybe try one step after the other. :D

Don't know how comfortable Noesis is in handling animations.

For unknown animation files I tend to transfer their keyframes to .x format to get them viewed using DirectX Viewer.

Here's a snippet from my try with LastChaos Healer:

Code: Select all

Frame Bip01 {

 FrameTransformMatrix {  1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,-0.000000,1.087123,-0.005999,1.000000;;
  }
  Frame Bip01_Pelvis {

   FrameTransformMatrix {   1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.003336,1.000000;;
   }
   Frame Bip01_Spine {

    FrameTransformMatrix {    1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,-0.000000,0.078779,0.016375,1.000000;;
    }
    Frame Bip01_Spine1 {

     FrameTransformMatrix {  1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.119362,0.002851,1.000000;;
     }
     Frame Bip01_Spine2 {
...
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?"
Alsair
advanced
Posts: 66
Joined: Fri Jun 15, 2012 10:55 am
Has thanked: 4 times

Re: Bone Mapping with Skeleton

Post by Alsair »

For now I was thinking of using one frame from all the bones and map them to the mesh, and if possible try to integrate frame by frame animation in Noesis. I am just hoping to get my models standing nicely rather than in one clunk of junk in the middle.

I just want to map the relevant data Noesis requires for a model to have a bone structure behind it, and if it requires matrices from one frame than that would be good.
Alsair
advanced
Posts: 66
Joined: Fri Jun 15, 2012 10:55 am
Has thanked: 4 times

Re: Bone Mapping with Skeleton

Post by Alsair »

Anyways, I've updated the main topic to add in more structure data for the skeleton. I still have no clue on how to map it though, think you can post a snippet of the code for Noesis that does this?
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4286
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Bone Mapping with Skeleton

Post by shakotay2 »

Alsair wrote:Anyways, I've updated the main topic to add in more structure data for the skeleton. I still have no clue on how to map it though, think you can post a snippet of the code for Noesis that does this?
Well, then first of all:
What's the name of the game?
2nd: your thread title seems to lack "using Noesis"
3rd: your request seems to concern MrAdults himself. :D
MrAdults wrote:[...]hierarchical bone transforms for the skeleton. You can let Noesis do that for you too. Just set up your NoeBones with standard parent-relative matrices and then call rapi.multiplyBones. (syntax is "boneList = rapi.multiplyBones(boneList)")
In noesis\plugins\phyton I found this:
__NPReadMe.txt
//writeanim handler should be defined as def fmtWriteAnim(anims, bsOut), where anims is a list of NoeAnim and bsOut is a NoeBitStream that should have the resulting anim binary written into it

__NPExample.txt
"Stand-alone animations cannot be written to the .noepy format."

Just wondering what's the opposite of "stand-alone" animations.

It also might be worth to look at: fmt_bulletwitch_cpr.py
#this is an example of how to use procedural animations to test your weighting (this assumes bone 11=right shoulder and bone 16=left shoulder)
#panims = [NoeProceduralAnim("bone011", 30.0, 1, 0.1), NoeProceduralAnim("bone016", 60.0, 1, 0.1)]
#anims = rapi.createProceduralAnim(cpr.boneList, panims, 100)
#mdl.setAnims(anims

or in pluginsource, bayonetta.cpp
#if 0 //create a procedural anim where bayonetta turns her upper torso and hips
if (bones)


You might search for noeAnim in xentax forum.

There's a thread by Demonsangel (Titan Quest)
viewtopic.php?f=16&t=8405

Last not least: viewtopic.php?f=33&t=4582
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?"
Alsair
advanced
Posts: 66
Joined: Fri Jun 15, 2012 10:55 am
Has thanked: 4 times

Re: Bone Mapping with Skeleton

Post by Alsair »

This looks good I will take a further look at this tomorrow. Do you have Skype or something in case I need help with something? That would be great thanks. Also my first step is to sucessfully have the bones mapped behind the skeleton followed by the anims afterwards, I will try to find some examples relevant to my issue.
Last edited by Alsair on Wed Jul 03, 2013 10:56 pm, edited 1 time in total.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4286
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1147 times
Been thanked: 2242 times

Re: Bone Mapping with Skeleton

Post by shakotay2 »

Alsair wrote:This looks good I will take a further look at this tomorrow. Do you have Skype or something in case I need help with something?
I'm not very good/productive in live communication I guess. :D
But feel free to PM me.

Also I'm no expert with animations. Don't have a deeper insight in using Noesis rapi functions.
Just answered you because I'm interested in understanding for myself how to display animations.
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?"
Alsair
advanced
Posts: 66
Joined: Fri Jun 15, 2012 10:55 am
Has thanked: 4 times

Re: Bone Mapping with Skeleton

Post by Alsair »

shakotay2 wrote:
Alsair wrote:This looks good I will take a further look at this tomorrow. Do you have Skype or something in case I need help with something?
I'm not very good/productive in live communication I guess. :D
But feel free to PM me.

Also I'm no expert with animations. Don't have a deeper insight in using Noesis rapi functions.
Just answered you because I'm interested in understanding for myself how to display animations.


What else would I have to do?
Last edited by Alsair on Wed Jul 31, 2013 12:02 am, edited 1 time in total.
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: [Noesis] Bone Mapping with Skeleton

Post by howfie »

not always, every game is different.
there are hundreds of scripts on this site... you should check out some of chrrox's noesis scripts to learn how to do bone mapping. also, the tomb raider 2013 script also contains bone mapping and it works great. you should look at that code.
Alsair
advanced
Posts: 66
Joined: Fri Jun 15, 2012 10:55 am
Has thanked: 4 times

Re: [Noesis] Bone Mapping with Skeleton

Post by Alsair »

Okay, I'm unable to find the Child/Parent index for each bone. Would this be located within the skeleton file or the object file itself?

Also I'm doing this but it results in an error.
Last edited by Alsair on Wed Jul 31, 2013 12:02 am, edited 2 times in total.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: [Noesis] Bone Mapping with Skeleton

Post by MrAdults »

You'd have to post your full script for someone to diagnose your error, I couldn't tell you what's wrong just from that descrption.

Some things that should be clarified here:

1) In Noesis terminology, bone mapping generally refers to the process of remapping per-weight bone indices, a common practice for games that use bone palettes. This is probably not what you want.

2) When your models are "one clunk of junk in the middle", that generally means your vertices are in bone-local space. To fix this, you go through and transform your vertices using your bone matrices and weights. You need to make sure your bone matrices are all in model space too, not relative to their parents. If you have parent-local bone matrices, this can be corrected with rapi.rpgMultiplyBones. If you don't want to run through and transform your vertex positions/normals/etc. yourself, you can use the recently-added rapi.rpgSkinPreconstructedVertsToBones function:

Code: Select all

	{"rpgSkinPreconstructedVertsToBones", RPGSkinPreconstructedVertsToBones, METH_VARARGS, "skins all relevant committed (via immEnd/rpgCommitTriangles) vertex components using the provided bone list. must be performed prior to rpgConstructModel. (O)"}, //args=bone list
For Noesis to do these transforms for you, you will have to feed it valid vertex weights. If your format doesn't use explicit weights and only provides a per mesh or per vertex bone index, just feed that index to Noesis for each vertex, while using a weight value of 1.0.

3) Your format, like many others, might lack any kind of "base pose" skeleton, and it provides only animation matrices. There's no real reason in terms of vertex skinning to provide a base pose when your vertices are in bone space. So yeah, you can take your matrices from a frame of animation data, and use them to skin the verts. It is quite likely, though, that those matrices will be local to each other, so you will need to use rapi.rpgMultiplyBones after you've set your bones up with matrices from a frame of animation.

4) Unlike model bone matrices, Noesis animation matrices are local to each other. Most games have animation data in local space, so you can pass it straight to Noesis. However, if animation matrices are all in absolute model space (meaning you don't have to use rapi.rpgMultiplyBones to use them as your main skeleton), you will need to put them back in parent-local space. This can be accomplished by transforming each animation matrix by the inverse of its parent bone's matrix for that particular animation frame.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Bone Mapping with Skeleton

Post by MrAdults »

Oh, and:
shakotay2 wrote:Just wondering what's the opposite of "stand-alone" animations.
Stand-alone animations there refers to animation data without model data. For example, the BioVision Hierarchy format that Noesis supports is an animation-only format. If you wanted to support animation-only .noepy files, you'd modify that chunk of code to write out an animation-only .noepy file. The way that example script is written, it'll accept being the animation export target, but only if it's also the model export target, because it wants to combine animations into the model format.
Alsair
advanced
Posts: 66
Joined: Fri Jun 15, 2012 10:55 am
Has thanked: 4 times

Re: [Noesis] Bone Mapping with Skeleton

Post by Alsair »

MrAdults wrote:You'd have to post your full script for someone to diagnose your error, I couldn't tell you what's wrong just from that descrption.

Some things that should be clarified here:

1) In Noesis terminology, bone mapping generally refers to the process of remapping per-weight bone indices, a common practice for games that use bone palettes. This is probably not what you want.

2) When your models are "one clunk of junk in the middle", that generally means your vertices are in bone-local space. To fix this, you go through and transform your vertices using your bone matrices and weights. You need to make sure your bone matrices are all in model space too, not relative to their parents. If you have parent-local bone matrices, this can be corrected with rapi.rpgMultiplyBones. If you don't want to run through and transform your vertex positions/normals/etc. yourself, you can use the recently-added rapi.rpgSkinPreconstructedVertsToBones function:

Code: Select all

	{"rpgSkinPreconstructedVertsToBones", RPGSkinPreconstructedVertsToBones, METH_VARARGS, "skins all relevant committed (via immEnd/rpgCommitTriangles) vertex components using the provided bone list. must be performed prior to rpgConstructModel. (O)"}, //args=bone list
For Noesis to do these transforms for you, you will have to feed it valid vertex weights. If your format doesn't use explicit weights and only provides a per mesh or per vertex bone index, just feed that index to Noesis for each vertex, while using a weight value of 1.0.

3) Your format, like many others, might lack any kind of "base pose" skeleton, and it provides only animation matrices. There's no real reason in terms of vertex skinning to provide a base pose when your vertices are in bone space. So yeah, you can take your matrices from a frame of animation data, and use them to skin the verts. It is quite likely, though, that those matrices will be local to each other, so you will need to use rapi.rpgMultiplyBones after you've set your bones up with matrices from a frame of animation.

4) Unlike model bone matrices, Noesis animation matrices are local to each other. Most games have animation data in local space, so you can pass it straight to Noesis. However, if animation matrices are all in absolute model space (meaning you don't have to use rapi.rpgMultiplyBones to use them as your main skeleton), you will need to put them back in parent-local space. This can be accomplished by transforming each animation matrix by the inverse of its parent bone's matrix for that particular animation frame.
1.) I just want the model standing in a way that is displayed in the game.


2.) What would you say would be the ideal method to use in my situation? The animation + bone data is all stored in a skeleton file. (Meaning it's not in local-space - not in the model) Also, I am unable to locate the child index/parent index id in the skeleton file, is this absolutely necessary? How would I go about transforming the vertices in Noesis, are there any examples that does this? Also I noticed you don't have documentation for your methods (well I couldn't find any), like msdn, or javadocs.

3.) You're right based on what I've analyzed so far. I was thinking of using one keyframe from the animation's matrices to construct the stance.

4.) Based on my analysis, I was only able to find animation data (e.g. matrices for each frame) in the skeleton.
Last edited by Alsair on Wed Jul 31, 2013 12:03 am, edited 2 times in total.
Post Reply