<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.xna.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XNA Framework Content Pipeline</title><link>http://forums.xna.com/forums/55.aspx</link><description>Get the most from your art assets in XNA Game Studio Express</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 0.0)</generator><item><title>Re: Custom Model Importer -- what to do with bone data?</title><link>http://forums.xna.com/forums/thread/203205.aspx</link><pubDate>Fri, 24 Jul 2009 14:29:57 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:203205</guid><dc:creator>N E D Gold</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/203205.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=203205</wfw:commentRss><description>The animation section threw me for a loop (pun intended), and I was not able to get past that.&amp;nbsp; I decided to put this project on hold and move on to something else with the intention of re-visiting it when my C#/XNA skills have improved.&lt;br /&gt;
&lt;br /&gt;
Good luck Hangman, I hope you succeed where I have failed.&lt;br /&gt;</description></item><item><title>Re: Custom Model Importer -- what to do with bone data?</title><link>http://forums.xna.com/forums/thread/201750.aspx</link><pubDate>Mon, 20 Jul 2009 23:02:00 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:201750</guid><dc:creator>Hangman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/201750.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=201750</wfw:commentRss><description>Okay I think I got this.
In my content processor (which takes data from my importer) now I have this:

&lt;font face="Lucida Console" size="2"&gt;
BoneContent skeleton = MeshHelper.FindSkeleton(input);
IList&amp;lt;BoneContent&amp;gt; bones = MeshHelper.FlattenSkeleton(skeleton);
&lt;/font&gt;

This will give you a list of BoneContent (bones), and it will have the right number of bones. 
From that, just give a look at the Skinned Model XNA sample (I&amp;#39;m looking at it right now).</description></item><item><title>Re: Custom Model Importer -- what to do with bone data?</title><link>http://forums.xna.com/forums/thread/201668.aspx</link><pubDate>Mon, 20 Jul 2009 18:29:26 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:201668</guid><dc:creator>Hangman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/201668.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=201668</wfw:commentRss><description>Did you do any progress on this? I&amp;#39;m exactly in your same situation. My model.Bones array contains not only the bones, but the meshes as well.
Thanks in advance!</description></item><item><title>Re: Custom Model Importer -- what to do with bone data?</title><link>http://forums.xna.com/forums/thread/196393.aspx</link><pubDate>Sat, 04 Jul 2009 19:32:47 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:196393</guid><dc:creator>N E D Gold</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/196393.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=196393</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://forums.xna.com//Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;N E D Gold:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
Disregarding the animation data for the moment, I added these two lines:&lt;br /&gt;
...&lt;br /&gt;
private int boneDataIndex;&lt;br /&gt;
...&lt;br /&gt;
boneDataIndex = meshBuilder.CreateVertexChannel&amp;lt;BoneWeightCollection&amp;gt;(VertexChannelNames.Weights());&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
but I receive an error (Unable to parse ms3d txt file. Exception: Object reference not set to an instance of an object. )&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br /&gt;
&lt;br /&gt;
I&amp;#39;m making progress!!!&lt;br /&gt;
&lt;br /&gt;
I first thought the above error was some sort of syntax error because all I did was tell the meshBuilder I was going to add some bone weights to it.&amp;nbsp; But Nooooo, in this case the error means it wants bone data now!&amp;nbsp; P.S. only use that statement and the other bone related statements if your model actually has bone data.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
In this case, this means I need to process the bone data portion of the ms3d file before I process the vertex data.&amp;nbsp; Why?&amp;nbsp; Because I have learned that&amp;nbsp; CreateVertexChannel(weights) requires a BoneWeightCollection as input which is a collection of one or more BoneWeight objects that specify the name and weight for that vertex.&amp;nbsp; The BoneWeight.Name must match a BoneContent.Name object already in existence.&amp;nbsp; Thus, I have to build all of the BoneContent objects first.&amp;nbsp; And that&amp;#39;s fine, as this is where you build the skeleton hierarchy that I was previously concerned with.&amp;nbsp; Unfortunately, bone data comes after vertex data in the ms3d file, so two passes are required.&amp;nbsp; (Actually, this pre-processing must also be done for building up the Materials ahead of the vertices as well, so my importer makes three passes; one for the materials, one for the bones, and lastly one for the vertex/tex cood/normals).&lt;br /&gt;
&lt;br /&gt;
Now I think I have a proper skeleton of bones so let&amp;#39;s skip ahead to the generic model drawing fragment below:&lt;br /&gt;
&lt;br /&gt;
// Copy any parent transforms.&lt;br /&gt;
Matrix[] transforms = new Matrix[model.Bones.Count];&lt;br /&gt;
model.CopyAbsoluteBoneTransformsTo(transforms);&lt;br /&gt;
&lt;br /&gt;
In my test model, I have 46 bones.&amp;nbsp; But this model is kind of weird in that it had a camera attachment point (cam bone) that wasn&amp;#39;t directly connected to the rest of the bones (it was a second root bone).&amp;nbsp; Since you can&amp;#39;t have two root bones (as I learned the hard way) I created a master root bone and attached the main skeleton with this cam bone.&amp;nbsp; Anyway, that means I should have 46+1 bones in the model.&amp;nbsp; However, in the above code, model.Bones.Count = 52.&amp;nbsp; Huh?&lt;br /&gt;
&lt;br /&gt;
I then loaded a simple model that is only two triangles and no bones whatsoever, yet model.Bones.Count = 2.&amp;nbsp; So that got me thinking....BoneContent extends from NodeContent and NodeContent is the return value for Importers.&amp;nbsp; Each mesh you process is also a NodeContent object that is added as a child to the root node that will become the return value.&amp;nbsp; (Bones are also added as children to the root node.)&amp;nbsp; So, for the simple two triangle model, you have the main root node plus the mesh node = 2 nodes and apparently nodes also means bones.&lt;br /&gt;
&lt;br /&gt;
Back to my test model, it has 4 meshes, so let&amp;#39;s see if it adds up:&amp;nbsp; 1 root node return value + 4 mesh nodes + 46 bone nodes + 1 master root bone node = 52.&amp;nbsp; Yea!!!!&amp;nbsp; it works.&lt;br /&gt;
&lt;br /&gt;
But wait!&amp;nbsp; Won&amp;#39;t this throw a monkey wrench in the works when it comes to animating later on?&amp;nbsp; How am I going to separate mesh nodes from bone nodes?&amp;nbsp; I guess I&amp;#39;ll soon find out as I tackle animation next.&lt;br /&gt;
&lt;br /&gt;
- - - - - - - -&lt;br /&gt;
Although my Importer builds w/o errors and draws correctly I won&amp;#39;t know if the bones I added are actually correct until I start to move them.&amp;nbsp; After all, the model was drawn correctly before I even started adding bones to it.&lt;br /&gt;
&lt;br /&gt;
Could someone please confirm that I&amp;#39;m on the right track?&amp;nbsp; I&amp;#39;d really appreciate it.&amp;nbsp; Thanks!&lt;br /&gt;
&lt;br /&gt;</description></item><item><title>Re: Custom Model Importer -- what to do with bone data?</title><link>http://forums.xna.com/forums/thread/195941.aspx</link><pubDate>Fri, 03 Jul 2009 02:37:27 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:195941</guid><dc:creator>N E D Gold</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/195941.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=195941</wfw:commentRss><description>Here is an example of the data I&amp;#39;m working with:&lt;br /&gt;
&lt;br /&gt;
Bones: 46&lt;br /&gt;
&amp;quot;base&amp;quot;&lt;br /&gt;
&amp;quot;&amp;quot;&lt;br /&gt;
24 0.009673 -0.012660 0.000000 0.000000 0.000000 0.000000&lt;br /&gt;
156&lt;br /&gt;
1.000000 0.000000 0.000000 0.000000&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
I have the number of bones in the model, the current bone name, parent bone name (or &amp;quot;&amp;quot; if root).&lt;br /&gt;
&lt;br /&gt;
24 is a flag that I ignore&lt;br /&gt;
0.009673 -0.012660 0.000000 is the bone position&lt;br /&gt;
0.000000 0.000000 0.000000 is the bone rotation&lt;br /&gt;
156 is the number of position keys for animation&lt;br /&gt;
1.000000 is the first frame time&lt;br /&gt;
0.000000 0.000000 0.000000 is the position at that time&lt;br /&gt;
...and so forth&lt;br /&gt;
&lt;br /&gt;
Disregarding the animation data for the moment, I added these two lines:&lt;br /&gt;
...&lt;br /&gt;
private int boneDataIndex;&lt;br /&gt;
...&lt;br /&gt;
boneDataIndex = meshBuilder.CreateVertexChannel&amp;lt;BoneWeightCollection&amp;gt;(VertexChannelNames.Weights());&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
but I receive an error (Unable to parse ms3d txt file. Exception: Object reference not set to an instance of an object. )&lt;br /&gt;
&lt;br /&gt;
Hmmm... &lt;br /&gt;
&lt;br /&gt;
well, I had initially looked at this method previously, but I failed to see how this will work given the data I have to work with.&amp;nbsp;&amp;nbsp; Since I don&amp;#39;t actually have any weights, I suppose I could just assign a weight of one, once I get that line working.&amp;nbsp; Is this right?:&amp;nbsp; Create 46 BoneWeight objects (46 = number of bones in the model) all with a weight of 1.0 and whatever the name of the bone (such as &amp;quot;base&amp;quot; in the above example).&amp;nbsp; Track these in a list so when I&amp;#39;m processing the vertex data I can use the SetVertexChannelData(boneDataIndex, boneList[boneNdx])???&lt;br /&gt;
&lt;br /&gt;
My concerns are that I am not specifying the hierarchy for the bones, nor the initial position or rotation.&amp;nbsp;&amp;nbsp; This is why I&amp;#39;m lost and seek help.&lt;br /&gt;
&lt;br /&gt;
I would also like to know where I can stuff the animation data.&lt;br /&gt;
&lt;br /&gt;
TIA&lt;br /&gt;</description></item><item><title>Re: Custom Model Importer -- what to do with bone data?</title><link>http://forums.xna.com/forums/thread/195891.aspx</link><pubDate>Thu, 02 Jul 2009 23:19:55 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:195891</guid><dc:creator>Shawn Hargreaves</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/195891.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=195891</wfw:commentRss><description>The Content Pipeline object model represents skinned data as a VertexChannel&amp;lt;BoneWeightCollection&amp;gt;, with key VertexChannelNames.Weights().&lt;br /&gt;
&lt;br /&gt;
This channel holds a list of 1+ weights for the vertex, storing the bone name and weight strength for each bone that influences the vertex.&lt;br /&gt;</description></item><item><title>Custom Model Importer -- what to do with bone data?</title><link>http://forums.xna.com/forums/thread/195873.aspx</link><pubDate>Thu, 02 Jul 2009 22:13:27 GMT</pubDate><guid isPermaLink="false">4aa5dbf6-357b-46b2-b5b2-1b660a6dc370:195873</guid><dc:creator>N E D Gold</dc:creator><slash:comments>0</slash:comments><comments>http://forums.xna.com/forums/thread/195873.aspx</comments><wfw:commentRss>http://forums.xna.com/forums/commentrss.aspx?SectionID=55&amp;PostID=195873</wfw:commentRss><description>I use MilkShape for my modeling needs, but the FBX exporter doesn&amp;#39;t want to play nice with Game Studio 3.1 (at least not for me anyway).&amp;nbsp; So I have decided to learn how to write a custom model importer for MS3D.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Using the OBJImporter example as a reference, I have successfully modified it to accept the MS3D ASCII version of a model.&amp;nbsp; It creates the meshes and applies the textures beautifully [ I&amp;#39;m so proud :-) ] but I&amp;#39;m not sure what to do with the bone structures.&lt;br /&gt;
&lt;br /&gt;
When processing the verts, tex cood, and norms, there was a reference to a bone index that I ignored because I don&amp;#39;t know what to do with it.&amp;nbsp; This index just specifies to which bone that vertex is associated with.&amp;nbsp; At first I thought I should set up a vertex channel like I did with the tex cood and normals, but the only channel name that seemed close was Weights and that doesn&amp;#39;t seem to be what I&amp;#39;m looking for (or is it?)&lt;br /&gt;
&lt;br /&gt;
Also, the MS3D file has a whole section on bones that I don&amp;#39;t know how to process.&amp;nbsp; This section contains the following info:&lt;br /&gt;
&lt;br /&gt;
# of bones&lt;br /&gt;
bone name&lt;br /&gt;
parent bone name&lt;br /&gt;
flags, position, and rotation&lt;br /&gt;
// animation info&lt;br /&gt;
# position keys&lt;br /&gt;
{ time, position }&lt;br /&gt;
# rotation keys&lt;br /&gt;
{ time, rotation }&lt;br /&gt;
&lt;br /&gt;
I&amp;#39;m also looking at the Skinned Model example for clues.&amp;nbsp; However, that is a Content Processor and I&amp;#39;m working on an Importer.&amp;nbsp; (It seems to me, the Importer should be able to create the bone information first which would later be processed by the Content Processor).&amp;nbsp; I&amp;#39;m also not sure about this Tag thingamajig as called for in the Skinning example.&lt;br /&gt;
&lt;br /&gt;
So, what am I supposed to do with this bone information?&lt;br /&gt;
&lt;br /&gt;</description></item></channel></rss>