Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!
You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!
*tips hat* EveningAfter a long six months, it's good to see the code being put to use. Best of luck to you my friends
By the way, who's commenting the code in Japanese?
Like Chuy said, it would be Bero, he's the only one who's worked on the modset so far and he is the only one of us that is from Japan.After a long six months, it's good to see the code being put to use. Best of luck to you my friends
By the way, who's commenting the code in Japanese?
Most of it was just analyzing the formats in a hex editor.So, I can ask you question if I want?
Well, how did you discover meaning of variables in each files?
Did you use USB Gecko? I have that, but I'm trying to understand variables without that.
First of all, good to see you again. You probably don't remember me since I posted in the BrawlBox thread all of two or three times, but I followed it pretty closely and greatly enjoy your programs.Haha, I would have to write quite a bit. I really should have release a technology document on the formats and how to work with them, but I never had the time.
Most of the data formats are pretty straightforward, and I tried keeping field names sensible. Most of what I was doing was discovery and experimentation, so I avoided comments in case I was wrong. But then, never went back to document things.
If you want to know how something works just ask. I could probably offer a better explanation in the end.
...And has been yearning for that last step to be completed ever since.Seeing that the newest BrawlBox has the potential to import new models (but can't because it won't save or even export MDL0s properly) makes me .
Well, thanks for all your hard work, anyway, Kryal. I eagerly wait for your return. In the mean time, I'm gonna fiddle around with this beta BrawlBox.
Just because I got models into the program doesn't mean I could save them. Look here: http://code.google.com/p/brawltools/source/browse/#svn/trunk/BrawlLib/SSBB/ResourceNodes/MDL0First of all, good to see you again. You probably don't remember me since I posted in the BrawlBox thread all of two or three times, but I followed it pretty closely and greatly enjoy your programs.
Second of all, is your offer of wisdom open to anyone, or just Bero? Because from what I gathered in the BrawlBox thread, the one format everyone seemed most interested in was MDL0, and how to continue the work you began with the version .64 beta. RandomTBush did some experimentation with the beta and it seemed to import models fine from Maya 2011, only problem being that the shader commands don't get set up, which prevents the BrawlBox beta from saving or exporting the files.
Basically I'd like to know what you know regarding MDL0 shaders, and how to fix their implementation. If this is asking too much, please don't hesitate to give me an internet smack upside the head. I'm simply an anxious fan who saw this:
...And has been yearning for that last step to be completed ever since.
//--------------------------------------
//--- 010 Editor v3.0.6 Binary Template
//--------------------------------------
typedef struct AIPDHeader
{
char Tag[4];
uint DataOffset; //Version? Always 0xC
uint Unknown1; //0
uint Unknown2; //0
};
typedef struct DefBlock
{
float _float1;
float _float2;
ushort _short1 <format=hex>;
ushort _short2 <format=hex>;
ushort _short3 <format=hex>;
ushort _short4 <format=hex>;
float _float3;
float _float4;
ushort _short5 <format=hex>;
ushort _short6 <format=hex>;
ushort _short7 <format=hex>;
ushort _short8 <format=hex>;
float _float5;
ushort _short9 <format=hex>;
ushort _short10 <format=hex>;
float _float6;
ushort _short11 <format=hex>;
ushort _short12 <format=hex>;
float _float7;
float _float8;
float _float9;
float _float10;
uint _int1 <format=hex>;
uint _int2 <format=hex>;
uint _int3 <format=hex>;
uint _int4 <format=hex>;
uint _int5 <format=hex>;
uint _int6 <format=hex>;
uint _int7 <format=hex>;
char _char1 <format=hex>;
char _char2 <format=hex>;
char _char3 <format=hex>;
char _char4 <format=hex>;
};
typedef struct SubBlock
{
ushort _short1 <format=hex>;
ushort _short2 <format=hex>;
ushort _short3 <format=hex>;
ushort _short4 <format=hex>;
float _float1;
float _float2;
ushort _short5 <format=hex>;
ushort _short6 <format=hex>;
ushort _short7 <format=hex>;
ushort _short8 <format=hex>;
ushort _short9 <format=hex>;
ushort _short10 <format=hex>;
char _char1 <format=hex>;
char _char2 <format=hex>;
char _char3 <format=hex>;
char _char4 <format=hex>;
ushort _short11 <format=hex>;
ushort _short12 <format=hex>;
uint _int1 <format=hex>;
uint _int2 <format=hex>;
uint _int3 <format=hex>;
};
typedef struct UnkBlock
{
char Padding[64];
};
typedef struct Type1Entry
{
byte command <format=hex>;
if(command != 0)
{
byte control1 <format=hex>;
byte control2 <format=hex>;
}
};
typedef struct Type1
{
Type1Entry Entry;
while(Entry.command != 0)
Type1Entry Entry;
};
typedef struct Type2Entry
{
char char1 <format=hex>;
char char2 <format=hex>;
char char3 <format=hex>;
char char4 <format=hex>;
char char5 <format=hex>;
char char6 <format=hex>;
};
typedef struct Type2
{
ushort _id;
byte _flag;
byte _numEntries;
local int i;
for(i = 0 ; i < _numEntries ; i++)
Type2Entry Entry;
};
typedef struct Type1List
{
uint Offsets1[28];
local long offset = FTell();
local int i;
for(i = 0 ; i < 28 ; i++)
{
if(Offsets1[i] == 0)
byte NULL;
else
{
FSeek(Offsets1[i]);
Type1 Entry;
}
}
FSeek(offset);
};
typedef struct Type2List
{
uint Offsets1[33];
local long offset = FTell();
local int i;
for(i = 0 ; i < 33 ; i++)
{
if(Offsets1[i] == 0)
byte NULL;
else
{
FSeek(Offsets1[i]);
Type2 Entry;
}
}
FSeek(offset);
};
AIPDHeader Header;
DefBlock Def1;
DefBlock Def2;
SubBlock Sub1;
SubBlock Sub2;
UnkBlock Unk;
//Offsets are relative to beginning of file
Type1List List1;
Type2List List2;
Smacked it is, then. I guess I deserved that. Oh well, thanks for replying, I appreciate it all the same.Just because I got models into the program doesn't mean I could save them. Look here: http://code.google.com/p/brawltools/source/browse/#svn/trunk/BrawlLib/SSBB/ResourceNodes/MDL0
Sorry. I just get a lot of questions like that. Quite frankly, everything you need to know is available to you. There's a certain level of understanding that is necessary in order to manipulate this data.Smacked it is, then. I guess I deserved that. Oh well, thanks for replying, I appreciate it all the same.
Your code is fascinating to read, BTW.
oh, too bad you nearly gave up on MLD0 but I am glad you took your time to visit us :3I've pretty much given up on MDL0, just too stressful. OBJ files do not work with skins, which is why I never bothered.
Since people are trying to get model manipulation working here are some suggestions:
- If you want to support blender, use the .blend file format. All of the plugins are too old and broken for anything else to work properly.
- For everything else, use Collada AND FBX. Both have text formats.
- If you want OBJ support, use it for static meshes only.
--HEADER NOTES--
first 4 bytes always 4D 44 4C 30 or MDL0 in ASCII
offset 4 always 00
bytes 08 through 0F always 00 00 00 09 FF FF FF 80
bytes 10 thourgh 12 always 00 00 05
byte 13 always 90
bytes 14 through 16 always 00 00 05
bytes 18 through 1A always 00 00 0A
bytes 1C through 1D always 00 00
bytes 20 through 21 always 00 00
bytes 24 through 25 always 00 00
bytes 28 through 29 always 00 00
bytes 2C through 2D always 00 00
bytes 30 through 31 always 00 00
bytes 34 through 35 always 00 00
bytes 38 through 3C always 00 00 00 00 00
bytes 40 through 4F always 00 00 00 40 FF FF FF C0 00 00 00 00 00 00 00 00
bytes 50 through 53 is number of vertices in hex
bytes 54 through 57 is number of faces in hex
bytes 58 through 5B always 00 00 00 00
bytes 5C through 5F is number of nodes in hex
bytse 60 through 67 always 01 01 00 00 00 00 00 40
bytes 82 through 83 is number of nodes in hex
bytes 84 through 86 always 00 00 00
bytes 88 through 8A always 00 00 00
bytes 8C through 8C always 00 00 00
bytes 90 through 92 always 00 00 00
bytes 94 through 96 always 00 00 00
--BONE NOTES--
bones are D0 bytes big
first 6 bytes always 00 00 00 D0 FF FF
44 bytes after start of bone is BoneMin
50 bytes after start of bone is BoneMax
20 bytes after start of bone is Scale
2C bytes after start of bone is Rotation
38 bytes after start of bone is Translation
10 bytes after start of bone is NodeID
14 bytes after start of bone is Flags
--VERTICES NOTES--
first 4 bytes are TotalLen, or how big the vertices file is
8 bytes after start is DataOffset
C bytes after start is StringOffset
1E bytes after start is number of vertices
--NORMALS NOTES--
--COLORS NOTES--
--UV POINTS NOTES--
--MATERIALS1 NOTES--
--MATERIALS2 NOTES--
--POLYGONS NOTES--
--TEXTURES1 NOTES--
MDL0 HEADER
Offset Name
0x00 MDL0 Identifier
0x04 MDL0 Size
0x08 Sections
0x0C Model Nodes Offset
0x10 Definitions List
0x14 Bones List
0x18 Vertices List
0x1C Normals List
0x20 Colors List
0x24 UV Points List
0x28 Materials 1 List
0x2C Materials 2 List
0x30 Polygons List
0x34 Textures 1 List
0x38 Textures 2 List
0x3C Model Name Offset
0x40 Header Length
0x44 Header Offset
0x48 Unknown 1
0x4C Unknown 2
0x50 # of Vertices
0x54 # of Faces
0x58 Unknown 3
0x5C # of Nodes
0x60 Version
0x62 Unknown 4
0x64 Unknown 5
0x68 Box Min. X
0x6C Box Min. Y
0x70 Box Min. Z
0x74 Box Max. X
0x78 Box Max. Y
0x7C Box Max. Z
0x80 # of Nodes (Copy?)
BONE HEADER
0x00 Header Length
0x04 MDL0 Offset
0x08 String Offset
0x0C Bone Index
0x10 Node ID
0x14 Flags
0x18 Pad 1 (?)
0x1C Pad 2 (?)
0x20 Scale X
0x24 Scale Y
0x28 Scale Z
0x2C Rotation X
0x30 Rotation Y
0x34 Rotation Z
0x38 Translation X
0x3C Translation Y
0x40 Translation Z
0x44 Box Min. X
0x48 Box Min. Y
0x4C Box Min. Z
0x50 Box Max. X
0x54 Box Max. Y
0x58 Box Max. Z
0x5C Parent Offset
0x60 First Child Offset
0x64 Next Offset
0x68 Previous Offset
0x6C Bone Strings/Properties Offset
0x70 FrameMatrix Set 1 Float 1
0x74 FrameMatrix Set 2 Float 1
0x78 FrameMatrix Set 3 Float 1
0x7C FrameMatrix Set 4 Float 1
0x80 FrameMatrix Set 1 Float 2
0x84 FrameMatrix Set 2 Float 2
0x88 FrameMatrix Set 3 Float 2
0x8C FrameMatrix Set 4 Float 2
0x90 FrameMatrix Set 1 Float 3
0x94 FrameMatrix Set 2 Float 3
0x98 FrameMatrix Set 3 Float 3
0x9C FrameMatrix Set 4 Float 3
0xA0 InverseBindMatrix Set 1 Float 1
0xA4 InverseBindMatrix Set 2 Float 1
0xA8 InverseBindMatrix Set 3 Float 1
0xAC InverseBindMatrix Set 4 Float 1
0xB0 InverseBindMatrix Set 1 Float 2
0xB4 InverseBindMatrix Set 2 Float 2
0xB8 InverseBindMatrix Set 3 Float 2
0xBC InverseBindMatrix Set 4 Float 2
0xC0 InverseBindMatrix Set 1 Float 3
0xC4 InverseBindMatrix Set 2 Float 3
0xC8 InverseBindMatrix Set 3 Float 3
0xCC InverseBindMatrix Set 4 Float 3
POLYGONS HEADER
0x00 Total Length
0x04 MDL0 Offset
0x08 Node ID
0x0C Flags 1
0x10 Flags 2
0x14 Unknown 1
0x18 Def. Size
0x1C Def. Flags
0x20 Def. Offset
0x24 Data Length
0x28 Data Length (Copy?)
0x2C Data Offset
0x30 Unknown 2
0x34 Unknown 3
0x38 String Offset
0x40 (Undocumented for now)
POLYGON TYPES
0x20 Bone Def 1
0x28 Bone Def 2
0x30 Bone Def 3
0x80 Quads
0x90 Triangles
0x98 Triangle Strip
0xA0 Triangle Fan
0xA8 Lines
0xB0 Line Strip
0xB8 Points
TEXTURES 1 HEADER
0x00 # of entries
0x04 Materials 1 Offset
0x08 Materials 2 Offset
TEXTURES 2 HEADER
0x00 # of entries
0x04 Materials 1 Offset
0x08 Materials 2 Offset
I've started to document after 0x40 on polygon's, for another 8 or so bytes it's more header IIRC, and then it's polygons positions in hexadecimal, which you can convert to float. The same goes for vertices after their header. I actually learned that when trying to find how AiS converted to .dae from MDL0, and found that when you convert the float numbers in it to hexadecimal you'll find the polygons and vertex groups in the MDL0 if you search for that number in the MDL0 file. I'm also starting to test adding more vertices to a model, using the traditional vertex hacking method (not DDVB) and then editing some values throughout the file. It might not seem helpful now, but it could eventually XDHere's some of my notes. I didn't fill in anything for Vertex, Normals, etc. yet, but I'll do so later. And I think I might've listed the wrong values for a few things.
And I don't have the values used for the lists yet, because I'm not even sure what half of the values are for. (I know one set's for the offset, and one's for the string, but I'm not sure about the other two.)Code:MDL0 HEADER Offset Name 0x00 MDL0 Identifier 0x04 MDL0 Size 0x08 Sections 0x0C Model Nodes Offset 0x10 Definitions List 0x14 Bones List 0x18 Vertices List 0x1C Normals List 0x20 Colors List 0x24 UV Points List 0x28 Materials 1 List 0x2C Materials 2 List 0x30 Polygons List 0x34 Textures 1 List 0x38 Textures 2 List 0x3C Model Name Offset 0x40 Header Length 0x44 Header Offset 0x48 Unknown 1 0x4C Unknown 2 0x50 # of Vertices 0x54 # of Faces 0x58 Unknown 3 0x5C # of Nodes 0x60 Version 0x62 Unknown 4 0x64 Unknown 5 0x68 Box Min. X 0x6C Box Min. Y 0x70 Box Min. Z 0x74 Box Max. X 0x78 Box Max. Y 0x7C Box Max. Z 0x80 # of Nodes (Copy?) BONE HEADER 0x00 Header Length 0x04 MDL0 Offset 0x08 String Offset 0x0C Bone Index 0x10 Node ID 0x14 Flags 0x18 Pad 1 (?) 0x1C Pad 2 (?) 0x20 Scale X 0x24 Scale Y 0x28 Scale Z 0x2C Rotation X 0x30 Rotation Y 0x34 Rotation Z 0x38 Translation X 0x3C Translation Y 0x40 Translation Z 0x44 Box Min. X 0x48 Box Min. Y 0x4C Box Min. Z 0x50 Box Max. X 0x54 Box Max. Y 0x58 Box Max. Z 0x5C Parent Offset 0x60 First Child Offset 0x64 Next Offset 0x68 Previous Offset 0x6C Bone Strings/Properties Offset 0x70 FrameMatrix Set 1 Float 1 0x74 FrameMatrix Set 2 Float 1 0x78 FrameMatrix Set 3 Float 1 0x7C FrameMatrix Set 4 Float 1 0x80 FrameMatrix Set 1 Float 2 0x84 FrameMatrix Set 2 Float 2 0x88 FrameMatrix Set 3 Float 2 0x8C FrameMatrix Set 4 Float 2 0x90 FrameMatrix Set 1 Float 3 0x94 FrameMatrix Set 2 Float 3 0x98 FrameMatrix Set 3 Float 3 0x9C FrameMatrix Set 4 Float 3 0xA0 InverseBindMatrix Set 1 Float 1 0xA4 InverseBindMatrix Set 2 Float 1 0xA8 InverseBindMatrix Set 3 Float 1 0xAC InverseBindMatrix Set 4 Float 1 0xB0 InverseBindMatrix Set 1 Float 2 0xB4 InverseBindMatrix Set 2 Float 2 0xB8 InverseBindMatrix Set 3 Float 2 0xBC InverseBindMatrix Set 4 Float 2 0xC0 InverseBindMatrix Set 1 Float 3 0xC4 InverseBindMatrix Set 2 Float 3 0xC8 InverseBindMatrix Set 3 Float 3 0xCC InverseBindMatrix Set 4 Float 3 POLYGONS HEADER 0x00 Total Length 0x04 MDL0 Offset 0x08 Node ID 0x0C Flags 1 0x10 Flags 2 0x14 Unknown 1 0x18 Def. Size 0x1C Def. Flags 0x20 Def. Offset 0x24 Data Length 0x28 Data Length (Copy?) 0x2C Data Offset 0x30 Unknown 2 0x34 Unknown 3 0x38 String Offset 0x40 (Undocumented for now) POLYGON TYPES 0x20 Bone Def 1 0x28 Bone Def 2 0x30 Bone Def 3 0x80 Quads 0x90 Triangles 0x98 Triangle Strip 0xA0 Triangle Fan 0xA8 Lines 0xB0 Line Strip 0xB8 Points TEXTURES 1 HEADER 0x00 # of entries 0x04 Materials 1 Offset 0x08 Materials 2 Offset TEXTURES 2 HEADER 0x00 # of entries 0x04 Materials 1 Offset 0x08 Materials 2 Offset
95% of the MDL formats have already been decoded for you. http://code.google.com/p/brawltools/source/browse/trunk/BrawlLib/SSBB/Types/MDL0.cs
Because the saving didn't work for that version, I basically learned how to make models by hand from both comparing the DAE to the original MDL0, and through BrawlBox. The source code is all Greek to me. @_@Just because I got models into the program doesn't mean I could save them. Look here: http://code.google.com/p/brawltools/source/browse/#svn/trunk/BrawlLib/SSBB/ResourceNodes/MDL0