Sign in to follow this  
vlzvl

problem with a custom .X parser

Recommended Posts

hello, im creating an .X (directx format) custom decoder & i recently hit in a difficult to me issue: How to normalize vertices, after their skinning (moved somewhere depending on a parent -> child logic) The 'MeshNormals' template in the .X files cant help here (i think) because they have the -static- normal for the static version of the model. So, without second thought, i started to normalize my triangles by group-smoothing them, which means neighbors has to be found first, then take their flat normal etc. etc. This appraoch really works but when you have a model of 5000+ tris & 30+ frames, this can be ridiculusly slow (about 30-40 secs in a medium cpu) So, i ask if there is an easier way, say transforming somehow the 'static' normals to meet their skinned vertices? has anyone solved WITHOUT THE D3D EXTENSIONS ? I forgot to tell you, this custom decoder works without D3DX* funcs, and i want to leave it that way... Thanx in advance.

Share this post


Link to post
Share on other sites
I assume you're using some sort of matrix to position and rotate your vertex positions with respect to their parent transformations. Use the same matrix, leaving out the translation ( set _41, _42, _43 to 0 ), for the vertex normals (assuming you're using a column-major transformation matrix).

If the vertex normals are correct for the ragdoll pose (the -static- pose), they're good for the skinned mesh.

Share this post


Link to post
Share on other sites
yesss, the zero-position of matrix did the job!
It was really stupid to apply the matrix (previously) on original
normals & waiting to get correct skinned normals ;) i -never- thought that normals actually havent positions ;) ...now the performance really improved,
my very thanx

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