Archived

This topic is now archived and is closed to further replies.

MichaelNolan

Milkshape Ascii files...

Recommended Posts

K-1    122
MilkShape ASCII''s are pretty easy to load. I think NeHe had a tutorial on loading MilkShape''s ms3d files too, #31. Anyway, here''s a summary of the files components.

For a simple model, like a single triangle, you''ll have something like this at the start of the file:

// MilkShape 3D ASCII

Frames: 30
Frame: 1

Meshes: 1

Then comes the name of the mesh with a dummy number and the material index.

"Triangles" 1 0

Then the number vertices

3

Then the vertex values, listed in this order:
dummy X Y Z S T dummy (the S and T are texture coordinates for the material)

1 -2.500000 -2.000000 0.000000 0.000000 0.000000 -1
1 6.250000 2.750000 0.000000 0.000000 0.000000 -1
1 -2.000000 6.250000 0.000000 0.000000 0.000000 -1

Then the number of normals

1

Then the normal components (X Y Z)

0.000000 0.000000 1.000000

Then the number of faces

1

Then the vertex indices for the face, stored in this order
dummy Vertex1 Vertex2 Vertex3 NormalX NormalY NormalZ dummy

1 0 1 2 0 0 0 1

Then the material list, with the number of materials

Materials: 1

The material name

"Material01"

Then the

Ambient
0.250980 0.000000 0.250980 1.000000

Diffuse
0.800000 0.800000 0.800000 1.000000

Specular
0.000000 0.000000 0.000000 1.000000

and Emission values
0.000000 0.000000 0.000000 1.000000

two more dummy values
0.000000
1.000000

then the texture file and another string that looks like a dummy
"texture.jpg"
""

Then unless you''ve added in a bone structure, the bones will be zero

Bones: 0

I haven''t gotten that far in my research into the ASCII files but this will work for simple models.

Share this post


Link to post
Share on other sites
nfz    122
Check out the link below. This is the web site for MilkShape 3D. Download MSViewer.zip. Included in the zip is source code to load a MS3D ASCII file format. There is even code there showing how to animate bones. Code is missing for texturing, setting up materials and normals but its not hard to figure out.

http://www.swissquake.ch/chumbalum-soft/ms3d/download.html

Included in one of the header files is a breakdown of the file format. By the way, there are no dummy values in the ASCII file format.

Share this post


Link to post
Share on other sites
K-1    122
I know there aren''t any "dummy" values, per se. They were just the items I hadn''t figured out what they did yet. I hadn''t seen the source for loading a model on the MilkShape website. That''ll make my development a lot easier now, thanks.

---
K-1 Productions: Come visit us here.

Share this post


Link to post
Share on other sites