problem with a custom .X parser

Started by
1 comment, last by vlzvl 15 years, 9 months ago
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.
http://jolt-3d.sf.netJolt3D! 3D Game Engine,1999-2008
Advertisement
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.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

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
http://jolt-3d.sf.netJolt3D! 3D Game Engine,1999-2008

This topic is closed to new replies.

Advertisement