OpenGL MS3D - bones, animations... and DirectX

This topic is 5119 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi, I moved all of the the MS3D loading code from Real Soon Now in my DirectX project (but merged the two classes to one), Unfortunatly, I cannot get it to work. It's even so tricky.. that half of the time my computer simply crashes (I still hear Winamp, but no user input possible in anyway, and nothing responds) After a week of "torture" I've decided to try it here. I have read like all posts related to "ms3d" or "milkshape" using search. Some mention changing the matrices (and vertex order from 0,1,2, to 0,2,1, because OGL is "righthanded" and DX is "lefthanded" (well, that's how my view is set up. Tried that, no luck. Some posts mention doing "strange" things with matrices. I just can't follow exactly what they mean, I've tried a few examples, but again, no success. I've tried rendering as a TriangleList,TriangleStrip, and a pointlist (which somehow only shows a few points?), no success, the first two lead to something shown below. The model renders perfectly in the OGL version from RSN. I've searched everywhere on the net as well, and only found OpenGL examples. (Quite strange, I wonder why to be honest :).) if I ever manage to get it to work I'll probably put the source online, seeing how much trouble other people have had in the past, and still have (like me). But, first.. I have to get it working. Did someone every successfully port Brett's OpenGL code? here is my quick snippet to put everything in a vertexarray. Ofcourse this is temporarily ;). I just loop through all the triangles and append the vertices as they come fro mthe indexbuffer.
			for ( int j = 0; j < m_pMeshes.m_numTriangles; j++ )
{

int triangleIndex = m_pMeshes.m_pTriangleIndices[j];
const Triangle* pTri = &m_pTriangles[triangleIndex];

for ( int k = 0; k < 3; k++ )
{
int index = pTri->m_vertexIndices[k];

// { NEW }
if ( m_pVertices[index].m_boneID == -1 )
{
// same as before
//glTexCoord2f( pTri->m_s[k], pTri->m_t[k] );
//glNormal3fv( pTri->m_vertexNormals[k] );
//glVertex3fv( m_pVertices[index].m_location );

myVertex[n].x  = m_pVertices[index].m_location[0];
myVertex[n].y =  m_pVertices[index].m_location[2];
myVertex[n].z = m_pVertices[index].m_location[1];
myVertex[n].nx = 0;
myVertex[n].ny = 0;
myVertex[n].nz = 0;
myVertex[n].tu = 0;
myVertex[n].tv = 0;
myVertex[n].tu2 = 0;
myVertex[n].tv2 = 0;

}
else
{
// rotate according to transformation matrix
const Matrix& final = m_pJoints[m_pVertices[index].m_boneID].m_final;

//glTexCoord2f( pTri->m_s[k], pTri->m_t[k] );

//Vector newNormal( pTri->m_vertexNormals[k] );
//newNormal.transform3( final );
//newNormal.normalize();
//glNormal3fv( newNormal.getVector());

Vector newVertex (m_pVertices[index].m_location);

newVertex.transform( final );

float newVec[4];

newVec[0] =  newVertex.getVector()[0];
newVec[1] =  newVertex.getVector()[2];
newVec[2] =  newVertex.getVector()[1];

myVertex[n].x  = newVec[0];
myVertex[n].y =  newVec[1];
myVertex[n].z =  newVec[2];
myVertex[n].nx = 0;
myVertex[n].ny = 0;
myVertex[n].nz = 0;
myVertex[n].tu = 0;
myVertex[n].tv = 0;
myVertex[n].tu2 = 0;
myVertex[n].tv2 = 0;

}
// { end NEW }

n++;
}

triangles++;


Any help is appreciated, ajoling

Share on other sites
Gidday,
If you hav'nt allready, go to MS3d site, download the OCX Viewer, install it, then using WinZip you can obtain the source code to it.
It is quite easy to break down and use what you need.
I found it very handy when writing my MS3D animator.
Its in C++ DX9 :)

TakeCare.

Share on other sites
Quote:
 Original post by OldfellaGidday,If you hav'nt allready, go to MS3d site, download the OCX Viewer, install it, then using WinZip you can obtain the source code to it.It is quite easy to break down and use what you need.I found it very handy when writing my MS3D animator.Its in C++ DX9 :)TakeCare.

Hi,

I thought the OCX only read ASCII files? Well, I'll check it out tommorow morning again then ;)

Share on other sites
Edit,

Nevemrind I actually found it. :). Many thanks.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 14
• 9
• 9
• 9
• 10
• Forum Statistics

• Total Topics
632912
• Total Posts
3009185
• Who's Online (See full list)

There are no registered users currently online

×