Sign in to follow this  
Cybrosys

[.net] MDX - SimpleAnimation sample

Recommended Posts

Been going through the SimpleAnimation sample from the sdk for managed dx and i was wondering if there's any tutorial or information about all that's being done because it's a bit overwhelming at first. I know what skeletal animation is and all that but the simpleanimation is a cpl of steps beyond that, using influences, palettes and such. [Edited by - Cybrosys on July 2, 2005 7:56:54 AM]

Share this post


Link to post
Share on other sites
I am not sure for tutorial, but if you have some specific question, maybe I can help...
Regarding influences and paletes. SimpleAnimation uses indexed skinning, which means that ConvertToIndexedBlendedMesh() returns mesh with multiple attributes. Each attribute has mesh.NumberPaletteEntries bones/matrices. Nonindexed mesh would have this number usually 2-4 (each draw call sets up to four world matrices), but in indexed this number can be much larger as it has pallete (array of bones/matrices). Ideally, this number would be same as number of bones, in which case you would only need one DrawPrimitive() call to render whole mesh. However, this number is limited in number of available vertex constants, anyway you should make it as large as you can (larger this number, less DrawPrimitve() calls you need, better the framerate).
Influences is just number showing how much bones affect each vertex. It is used for setting appropriate parameter in vertex shader (NumBones parameter in shader). In fact it selects one of the 4 vertex shader in shaders array:
VertexShader vsArray[4] = { compile vs_1_1 VShade(1),
compile vs_1_1 VShade(2),
compile vs_1_1 VShade(3),
compile vs_1_1 VShade(4)
};

In VS2.0 or above this could be done with static branching, but in VS1.1 it is done this way...

I hope I helped a bit... If you have some more questions, just ask...

[Edited by - Bulma on July 2, 2005 12:49:24 PM]

Share this post


Link to post
Share on other sites
You've helped =)

I was wondering what a palette is and such when it comes down to skeletal animation, it's hard to grasp the whole picture without knowing the theory behind what they're doing, especially with their naming.

[Edited by - Cybrosys on July 2, 2005 3:16:54 PM]

Share this post


Link to post
Share on other sites
the problem with the simple animation sample is that the shader .fx file is not used by the sample! and it's also not 100% correct either in how it works.

I found that the blendweights seem to only be 2-weights with .x files. Not the full 4 weights. So blending in a shader becomes a lot easier:



...
float4 BlendWeights : BLENDWEIGHT,
int4 BlendIndices : BLENDINDICES,
...

PositionOut = mul(Position, WorldMatrixArray[BlendIndices.x]) * BlendWeights.x
+mul(Position, WorldMatrixArray[BlendIndices.y]) * (1-BlendWeights.x);



Something like.

The code itself isn't very nice either... Better than C++ but still none too readable.

Share this post


Link to post
Share on other sites
Yes, it is quite interesiting... They included .fx file but they use FF indexed vertex skinning instead (which runs in software as it is usually not supported in hardware)...

Share this post


Link to post
Share on other sites
=)

The lack of documentation, tutorials and such, what i think, is the reason managed hasn't gotten a bigger usage base. It's a shame seeing what managed is offering and what it will be able to offer in the future. But i'm hoping that documentation, information, tutorials and such will come soon enough, generally speaking of course.

Btw, FF index vertex skinning, what's that? It would be great if you guys knew of any article or information about all of this, seeing as you seem familiar with the technique and such.

Share this post


Link to post
Share on other sites
Quote:
Original post by Bulma
Yes, it is quite interesiting... They included .fx file but they use FF indexed vertex skinning instead (which runs in software as it is usually not supported in hardware)...

It used to have a dropdown where you could select HLSL/not and Indexed/not before they introduced the new GUI stuff.

Quote:
Original post by Cybrosys
Btw, FF index vertex skinning, what's that? It would be great if you guys knew of any article or information about all of this, seeing as you seem familiar with the technique and such.

What it is is not supported. Not anywhere I have seen anyway. I have heard that being a late introduced feature, and not nearly as flexable feature as the programmable equiv, many graphics hardware vendors chose to ignore it and focus on the programmable pipeline. I have not even been able to get it to work adaquately with the reference device let alone software vertex processing. My advice: pretend like it does not exist and use HLSL.

If you were to use it you would do so by including blend weights and blend verts in your declaration, setting IndexedVertexBlendEnable to true and setting up your matrix palette via device.Transform.SetWorldMatrixByIndex(n).

Quote:
Original post by RipTorn
I found that the blendweights seem to only be 2-weights with .x files. Not the full 4 weights. So blending in a shader becomes a lot easier:

PositionOut = mul(Position, WorldMatrixArray[BlendIndices.x]) * BlendWeights.x
+mul(Position, WorldMatrixArray[BlendIndices.y]) * (1-BlendWeights.x);


It is not the a character of XFiles that there are only two weights, but dependant on the complexity of your model. Tiny may only have two, but tiny is clunky and simple. (I have considered using up to eight with my vertex shader, but that is pushing it. No way with vs_1_1.) Make sure to blend (and re-normalize) your normals too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this