xen can Dynamic edit character mesh vertex position ?

May 11, 2009 at 2:50 AM

For example, I have an animation with the character A, it is. X files,

which have a vertex position x1, y1, z1, but now I would like to edit it to the location x2, y2, z2,

I would like to ask how to do it ? How to read and set vertex position ?

May 11, 2009 at 3:02 AM

You can't really do this.
Technically it's possible, but it's very difficult.

The reason for this is a bit complex, I'll try and explain:

Internally, models are stored in their native XNA format.

What I mean by this, is that the XNA model importer (the process that converts the .X file to an internal XNA format) only gives you a raw byte array (byte[]) and a vertex declaration. While the vertex data may be in a common format such as PositionNormalTexture (etc), it's not guaranteed to be - and quite likely to be different on the xbox. Basically, the data you get is what is defined in the .X file (which could well be anything).

So if you wanted to edit the vertex data, you'd need to decode it from the raw byte array - using the vertex declaration.
Because it's so complex, I don't expose the byte data - and the vertex buffers created a not dynamic.
Does that make sense?

Your best bet would be doing the modification in a vertex shader (assuming it's not too complex).