SMD

From SimsWiki
Jump to: navigation, search

The .smd format is an ASCII text format describing 3d geometry, which supports bones, animations, a triangle mesh with multiple bone weights.

There are 2 kinds of .smd's, Reference smd's, which describe the model and its bones/initial bone positions, and animation smd's which only contain the bone information, and the animation.

Contents

The Format

A smd file starts with a version (it is always 1)

version 1

Bone Hierarchy (Nodes Section)

This section describes the bones in the model, and the hierarchy of them.

It starts with the word "nodes". Each line following it contains, the id of the new bone, the name, and the id of its parent bone.

eg..

0 "Joint58" -1 
1 "Joint8" -1 
2 "auskel" -1 
3 "root_trans" 2 
4 "root_rot" 3

Bones with a parent of -1 denotes no parent.

The nodes section ends with the word "end" as with all sections in a smd.

Pose Information (Skeleton Section)

This section describes the initial bone positions in a reference smd, and the keyframes of the animation in a animation smd.

The section starts with the word "skeleton". Then each keyframe of the animation starts with the word "time" followed by a frame number or time code. In a Reference smd, the frame number will always be 0. In each line in the time section contains, the id of the bone, the x y and z offset from the parent, and the x y and z rotation of the bone in radians.

eg..

5 0.000000 0.111000 0.000000 0.000000 0.000000 0.000000
6 0.000000 -0.200000 0.000000 0.000000 0.000000 0.000000
7 0.066000 -0.110000 0.000000 3.054332 0.000000 0.034907

The skeleton section ends with the word "end" as with all sections in a smd.

Mesh (Triangles Section)

Here is where the meat of a smd is, the mesh, in triangles.

The section starts with the word "triangles".

Each face in the mesh is preceded by the texture name, but for Sims 2 purposes it will always be "map.bmp". Each line in the face contains.. The bone the vertex belongs to (for Sims 2 purposes it will always be 0), the position of the vertex(x y z), the normal of the vertex(x y z), the texture coordinate of the vertex(x y), the number of bone weights on the vertex(can be omitted), the id of the bone, and the weight the influence the bone has over the vertex, repeated for each bone weight the vertex has.

eg..

map.bmp
0 -0.099629 0.182824 -0.000026 0.155139 0.837329 -0.524226 0.922665 0.011105 1 12 1.000000
0 -0.115848 0.177672 -0.000026 -0.410081 0.772132 -0.485433 0.929514 0.014846 1 12 1.000000
0 -0.115854 0.178729 0.021031 -0.377106 0.736762 0.561224 0.930177 0.032500 1 12 1.000000
map.bmp
0 -0.099629 0.182824 -0.000026 0.155139 0.837329 -0.524226 0.922665 0.011105 1 12 1.000000
0 -0.115854 0.178729 0.021031 -0.377106 0.736762 0.561224 0.930177 0.032500 1 12 1.000000
0 -0.099070 0.183574 0.021030 0.209672 0.777254 0.593224 0.923110 0.025416 1 12 1.000000

As with all sections in a smd, it ends with "end".

Example smd

Below is a example cube in smd format...

version 1
nodes
0 "SmdMiscBone" -1
end
skeleton
time 0
0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
end
triangles
map.bmp
0 1.000000 0.999999 1.000000 0.666646 0.666646 0.333323 0.000000 1.000000 0
0 1.000000 1.000000 -1.000000 0.408246 0.408246 -0.816492 0.000000 0.000000 0
0 -1.000000 1.000000 -1.000000 -0.408246 0.816492 -0.408246 1.000000 0.000000 0
map.bmp
0 1.000000 0.999999 1.000000 0.666646 0.666646 0.333323 0.000000 1.000000 0
0 -1.000000 1.000000 -1.000000 -0.408246 0.816492 -0.408246 0.000000 0.000000 0
0 -1.000000 1.000000 1.000000 -0.666646 0.333323 0.666646 1.000000 0.000000 0
map.bmp
0 -1.000000 -1.000000 -1.000000 -0.577349 -0.577349 -0.577349 0.000000 1.000000 0
0 -1.000000 -1.000000 1.000000 -0.577349 -0.577349 0.577349 0.000000 0.000000 0
0 -1.000000 1.000000 1.000000 -0.666646 0.333323 0.666646 1.000000 0.000000 0
map.bmp
0 -1.000000 -1.000000 -1.000000 -0.577349 -0.577349 -0.577349 0.000000 1.000000 0
0 -1.000000 1.000000 1.000000 -0.666646 0.333323 0.666646 0.000000 0.000000 0
0 -1.000000 1.000000 -1.000000 -0.408246 0.816492 -0.408246 1.000000 0.000000 0
map.bmp
0 1.000000 -1.000000 -1.000000 0.816492 -0.408246 -0.408246 0.000000 1.000000 0
0 0.999999 -1.000001 1.000000 0.333323 -0.666646 0.666646 0.000000 0.000000 0
0 -1.000000 -1.000000 -1.000000 -0.577349 -0.577349 -0.577349 1.000000 0.000000 0
map.bmp
0 0.999999 -1.000001 1.000000 0.333323 -0.666646 0.666646 0.000000 1.000000 0
0 -1.000000 -1.000000 1.000000 -0.577349 -0.577349 0.577349 0.000000 0.000000 0
0 -1.000000 -1.000000 -1.000000 -0.577349 -0.577349 -0.577349 1.000000 0.000000 0
map.bmp
0 1.000000 1.000000 -1.000000 0.408246 0.408246 -0.816492 0.000000 1.000000 0
0 1.000000 0.999999 1.000000 0.666646 0.666646 0.333323 0.000000 0.000000 0
0 1.000000 -1.000000 -1.000000 0.816492 -0.408246 -0.408246 1.000000 0.000000 0
map.bmp
0 1.000000 0.999999 1.000000 0.666646 0.666646 0.333323 0.000000 1.000000 0
0 0.999999 -1.000001 1.000000 0.333323 -0.666646 0.666646 0.000000 0.000000 0
0 1.000000 -1.000000 -1.000000 0.816492 -0.408246 -0.408246 1.000000 0.000000 0
map.bmp
0 1.000000 0.999999 1.000000 0.666646 0.666646 0.333323 0.000000 1.000000 0
0 -1.000000 1.000000 1.000000 -0.666646 0.333323 0.666646 0.000000 0.000000 0
0 0.999999 -1.000001 1.000000 0.333323 -0.666646 0.666646 1.000000 0.000000 0
map.bmp
0 -1.000000 1.000000 1.000000 -0.666646 0.333323 0.666646 0.000000 1.000000 0
0 -1.000000 -1.000000 1.000000 -0.577349 -0.577349 0.577349 0.000000 0.000000 0
0 0.999999 -1.000001 1.000000 0.333323 -0.666646 0.666646 1.000000 0.000000 0
map.bmp
0 1.000000 1.000000 -1.000000 0.408246 0.408246 -0.816492 0.000000 1.000000 0
0 1.000000 -1.000000 -1.000000 0.816492 -0.408246 -0.408246 0.000000 0.000000 0
0 -1.000000 -1.000000 -1.000000 -0.577349 -0.577349 -0.577349 1.000000 0.000000 0
map.bmp
0 1.000000 1.000000 -1.000000 0.408246 0.408246 -0.816492 0.000000 1.000000 0
0 -1.000000 -1.000000 -1.000000 -0.577349 -0.577349 -0.577349 0.000000 0.000000 0
0 -1.000000 1.000000 -1.000000 -0.408246 0.816492 -0.408246 1.000000 0.000000 0
end
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox