XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Question about SkinningSample's Vertex Shader

Last post 1/10/2008 7:06 PM by Shawn Hargreaves. 1 replies.
  • 1/10/2008 4:56 PM

    Question about SkinningSample's Vertex Shader

    I've been looking over the SkinningSample for awhile now.  I've been puzzled by a few areas, but the one thats bugging me is the declaration in SkinnedModel.fx.

    The input for the vertex shader includes the usual suspects: Position, Normals & Texture coordinates.  But it also includes two more: BoneIndices & BoneWeights. 

    Where did they come from?  No where in the example are they set up.  For that matter, its not like VertexFormat is setup anywhere in the code.  So, I'm guessing that this is already setup for you in the Model class.  Am I right?  And if so, how would you declare a different VertexFormat that wasn't those five things?  (For example adding a color variable.)  I'm also guessing that you would have to create a custom Model class.

     

  • 1/10/2008 7:06 PM In reply to

    Re: Question about SkinningSample's Vertex Shader

    The vertex format depends entirely on what data is contained in your model. If you write a custom model processor, you can tweak this by adding or removing vertex channels. If you use our default processor, that just passes through whatever data channels it found in the input .x or .fbx file.

    A skinned model contains bone indices and weights data: I believe the processor used in this sample checks to make sure this data is present, so you'll get an error if you try to use it with a model that does not contain skinning information.

    If there was no skinning data in the input model, a processor could potentially generate those data channels, although of course it would have a hard time guessing which bone(s) each vertex should be attached to: you normally want the artist to set that stuff up in the modelling program.
    XNA Framework Developer - blog - homepage
Page 1 of 1 (2 items) Previous Next