this thread will have a full description of the MDL0 file format (better than the wiki) this post will focus on v9, while the others will be using specs from v9 for the other versions. Please PM me if you have any new info. Thank you :)
the MDL0 header defines the basis for the MDL0 standards Global MDL0 Header: 0x00: 'MDL0' 0x04: string table offset 0x08: version 0x0C: BRES offset
the Resource List structure is determined by the MDL0 version: Lists: 0x00(4): Definitions List 0x04(4): Bones List 0x08(4): Vertices List 0x0C(4): Normals List 0x10(4): Colors List 0x14(4): UV Points List 0x18(4): Materials List 0x1C(4): Nodes List 0x20(4): Objects List 0x24(4): Textures List 0x28(4): Pallets List
the Local Header: gives info about the MDL0 Local Header: 0x2C(4): Name Offset 0x30(4): properties length 0x34(4): properties Offset 0x38(4): unknown (0) 0x3C(4): unknown (0) 0x40(4): Vertices count 0x44(4): Faces count 0x48(4): unknown (0) 0x4C(4): Link count 0x50(4): unknown (0x01010000) 0x54(4): properties length (copy??) 0x58(24): Bounds
after the header comes the Links which link to the bones, Definitions, materials, etc... 0x00(4): count 0x04(4*count): ID
If a model has 7 bones, 13 weights, and bones 0 and 3 are dummy's the Links would look like this: 00000001 00000002 00000004 00000005 00000006 FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 00000000 00000003
so the Links to weighted bones come first, then it's the dummy bones.
the Link index in the bones would index to it's weighted position here... eg: bone 0's index would be 11 bone 5's index would be somewhere w/in the weight links (say... 8) and if bone 6's index is 10, I'm assuming bone 5 would use both 8 and 9 (all the weighted bones own at least 1 weighted index)
after that comes the resource group table. the List offsets (in the header) point to the group data, and the data offset + the list offset points to the data eg: Object_Data = (Objects_List+data_offset)
here's what the relocation group data looks like: relocation group header: 0x00(4): block length 0x04(4): number of offsets
resource group offsets: 0x00(2): Group ID 0x02(2): pad 0x04(2): Prev ID 0x06(2): Next ID 0x08(4): string offset 0x0C(4): data offset
directly after the resource groups comes the Textures (the references) we'll deal with those later... let's just cover the sectioning data for now :)
Definitions: these aren't front-forward in 3D applications... (same as the Links)
but basically... they link the data between ojects, materials, and bone weights. BJ knows about how they work. Type 1: 0x00(1): '01' (Stop command) stops the read process Type 2: 0x00(1): '02' 0x01(2): Bone index 0x03(2): Parent Bone ID will add description later Type 3: 0x00(1): '03' 0x01(2): ID 0x03(1): Weight Count 0x04(2): Bone Table index 0x06(4): Weight -0x0A(2): Bone Table index -0x0C(4): Weight these hold the weights for the bone with this weight ID (not the bone ID), and are also used for returning the bone matrix (the bone matrices are used for generating the transformed vertices) Type 4: 0x00(1): '04' 0x01(2): Object index 0x03(2): Material index 0x05(2): Bone index 0x07(1): unknown will add description later all I know is it's for material linkage Type 5: 0x00(1): '05' 0x01(2): ID 0c03(2): Bone ID used for bones with single or no influence
Bones: the bones here don't really act for anything but animation. they control a vert's position in a 3D vector space based on it's influence (it's weight) to that bone.
however, IK bone chains are kind of a special case... these deal with 1 bone acting as a muscle (when scaled), causing a chain of say... 3 bones to move along with it. (such as bones in a finger, a leg, or an arm)
the muscle bone is basically a dummy bone... all the influences are affected by the bones this bone controls.
0x00(4): Block Length 0x04(4): MDL0 Offset 0x08(4): String Offset 0x0C(4): Bone ID 0x10(4): Link index (use the list if -1) 0x14(4): Flags (not all are known) 0x18(4): Pad 1 0x1C(4): Pad 2 0x20(12): Scale 0x2C(12): Rotation 0x38(12): Translation 0x44(24): Bounds 0x5C(4): Parent Offset 0x60(4): Child Offset 0x64(4): Next Offset 0x68(4): Previous Offset 0x6C(4): Bone Strings/Properties Offset (part2)
0100 - unknown 0200 - HasGeometry 0300 - unknown '031F' appears to be the typical flags
Vertices: vertices are one of the main building blocks of a model. they control what the model looks like, how it will move when animated, along with other things
The verts follow the global vector header defined here: Global Vector Header: 0x00(4): Block size 0x04(4): MDL0 Offset 0x08(4): Data Offset 0x0C(4): String Offset 0x10(4): Index ID 0x14(4): Has Bounding Box 0x18(4): Data type 0x1C(1): Entry Stride 0x1D(1): Divizor 0x1E(2): Entry count
0x20(4): Bounds (+padding)
the data type further defines how the data is read: 0: u8 / pow(2.0,Divizor) 1: s8 / pow(2.0,Divizor) 2: u16 / pow(2.0,Divizor) 3: s16 / pow(2.0,Divizor) 4: float
Normals: the normals control basically which direction the texture will display on a polygon. there are other advanced features I've seen in the MDL0 format that appear to be controlled by nodes
the normals follow the same data format as the verts
Colors: these would be your typical vertex colors in 3D applications. these are actually a seperate instance from materials that work to re-define a material color.
0x00(4): Block size 0x04(4): MDL0 Offset 0x08(4): Data Offset 0x0C(4): String Offset 0x10(4): Index ID 0x14(4): Has Alpha 0x18(4): Format 0x1C(1): Entry Stride 0x1D(1): unknown 0x1E(2): Entry count
the color formatting is further defined here: Formats: 0: RGB565 1: RGB8 2: RGBX8 (24bit RGB??) 3: RGBA4 4: RGBA6 5: RGBA8
UV's: the UV's control the position of a texture on a polygon. there are seperate channels (up to 8) to control the positioning for different textures. (for say... using the same model with different textures to be used as costumes)
these also follow the vert data format.
Materials: the materials alone don't control much but color, texturization, and speculation. most of the magic is done by the shaders contained w/in the material. the shaders control a slue of things from making a model appear like glass to renderring fur. the shaders also control the shadow cast of a model.
very little is known about the MDL0 data though 0x00(4): Block size 0x04(4): MDL0 Offset 0x08(4): String Offset 0x0C(4): ID 0x10(4): unknown 0x14(1): Texture count 0x15(1): Layer count 0x16(1): Shader Type (same on linked Node) 0x17(1): unknown 0x18(4): Normal settings 0x1C(1): unknown 0x1D(1): unknown 0x1E(1): Shader Texture layers (max 10) 0x1F(1): unknown 0x20(4): unknown 0x24(4): unknown 0x28(4): Node offset (references the linked Node) 0x2C(4): Texture count 0x30(4): Layer offset 0x34(4): unknown 0x38(4): offset to Shader registers 0x3C(4): unknown offset
these are some of the settings for the above data: shader types: 0: unknown 1: light/glow* 2: Toon 3: Lambert 4: metal* 5: reflective* 6: environ.* 7: Phong 8+: unknown (all parameters marked with * don't exist in 3D applications)
the shader actually starts just after the pading after the material header, and ends after the registers.
the Shader registers are located directly at that offset. it normally has a TEV structure just after a few settings. after that structure comes 3 structures that set the registers (hi and lo), set the null register values (I think), and set the texture reference values.
after that comes 1 or 2 XF blocks that define the texture layers. (1 XF block per texture layer)
There's still further documentation to come on these. >_>
Nodes: Not too much is known about the data here either...
the nodes control alot of similarities to the shaders, but the nodes can handle more on the fine detailing end, where as the shaders can't.
what the nodes control can be a range of things dealing with the visual element... (color, hue, sat, clarity, specularity, texture affection, and a whole bunch of other things) there are also logic nodes that are controlled by scripts to control how they work. (image timing, color blinking, and other things)
Objects: this is where all the data is combined. the objects basically define a model space, and link all the model and material data in MDL0 files, the objects hold the faces (polygons) that link the verts, normals, and UV's
objects also allow parenting to other objects, and are usually parented to bones
Header: 0x00(4): Block Size 0x04(4): MDL0 offset 0x08(4): Bone table ID (if -1, use weight table) 0x0C(8): CP format specs (hi and lo) 0x14(4): XF Normal specs 0x18(4): attributes block size 0x1C(4): attribute flags 0x20(4): attributes offset 0x24(4): data Size 0x28(4): data Size (copy??) 0x2C(4): data offset 0x30(4): XF format specs 0x34(4): Unknown (Always 0x00000000) 0x38(4): String offset 0x3C(4): ID 0x40(4): Number of vertices 0x44(4): Number of faces
Weight table 0x00(4): Number of weights 0x##(2): Weight ID
the attributes come after the Weight table and define alot of what's in te header: they also follow the wii format code note: this is what's actually used (not the data in the header) attribute definitions: 08 00 = host - colors, normals, and textures 08 10 = unknown 08 20 = unknown 08 30 = SetMatricesA 08 40 = SetMatricesB 08 50 = CP hi 08 60 = CP lo 08 70 = UVAT Group 0 08 80 = UVAT Group 1 08 90 = UVAT Group 2
up next is the Primitives the Primitives contain data that's used either for transform puposes, or geometric purposes.
Primitive Types: 20 - vert transform 28 - Normal transform 30 - UV transform 38 - Light transform
chunks of data are defined to hold the transform primitives before the geometry primitives.
vert/normal transform primitives work as such: 0x00(1): '20' or '28' 0x01(2): weight ID 0x03(.5): unknown 0x03.5(1.5): index/12 as for the facepoints, the length of the facepoint is defined by the CP list.
here's an example CP list: [1,0,1,0,0,0,0,0,0,3,3,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0] this would define a facepoint with a length of 9 ('## ## #### #### ## ####')
here's how it works: the CP hi defines the: -vertex/Normal transform -UV0 transform ... -UV7 transform -Vertex index -Normal index -Color0 index -Color1 index
the CP lo defines the: -UV0 index ... -UV7 index - vert mtx array - normal mtx array - UV mtx array - light mtx array - NBT - Max number of attributes - end marker (0xff)
the values in the above list determine the length of the read values in the facepoints: 0 - null 1 - direct (memory access) 2 - 8bit index 3 - 16bit index
I'm a python programmer like 404, I use Python 2.7 since it has more support for python 3x, but isn't as demanding. (PyOpenGL is also slower for Python 3x)
HexEdit Pro 5.0 - A professional hex editor, built by Andrew, with template support and many more features used for viewing and testing the data structures of a file. For more information, go to https://github.com/AndrewWPhillips/HexEdit/tree/master/HexEdit For color-highlighting support download and replace BinaryFileFormat.dtd in the program directory.
Templates I've built for HexEdit Pro 4.0:
DAT (HAL Labs) - coming soon MDL0 - removed TEX0 - removed REFT - removed REFF - todo REL - todo
^ these will be merged into a single template for NW4R once the link returns you'll have to manually apply the template or create symlinks for each filetype because HexEdit doesn't have template mapping functionality
EDIT: sorry everything's kinda disappeared, this stuff will return I promise just been having numerous issues with big corporations screwing me in various ways I'm working on solutions of my own, so just be patient
as for why I've removed most of the old entries from the table, the sources were either lost or are too old to be of any relevance. some were also on 4Shared, which is a service I've dropped (along with Mediafire).
free, no known bugs, and many new features. HexEdit's built-in template editor makes it easy to view the data of different files you can get templates (made for smash hacking) here: http://brawlimports.proboards.com/index.cgi?board=templates
a screenshot:
the next version I release will be able to highlight the hex values in different colors (defined by the template)
the screenshot is actually my MDL0 template loading a version11 mdl0 brawl uses version9 mdl0s
EDIT: I'll be releasing any templates I make here well, more like notifying about the release >_>
quick overview before clicking: this gives you my program, as well as other resources needed for my method... you will need blender for my method (preferrably 2.49)
note: this is only an alpha version so don't be surprised if you find any bugs I did my best to eliminate most of them though >_>
first off, I didn't want to ask in the help section becase of it being considered the "noob" section... I posted it here because I want to know how it works, and no noob is gonna tell me that :/
so yea... I tried making psy village, and ended up freezing my wii... how is it done??
I have a final dest mod that I want to do... but I'm not sure exactly as to which one to use...
here's the stage layout:
The middle of the floor of dest is glass. When you hit the glass enough times, it cracks, then brakes. With the diamond under that glass is exposed, it's easy to hit. After destroying the Diamond, Dest explodes into a heap of junk (there's still a stage there)
the glass can re-appear if the diamond isn't destroyed
I was thinking to use the Sky World REL for this, but it only supports the codes for the glass
I have a model hack I'm dealing with, and well... long story short... I had to rename the FIRST bone to TransN... now I need to add a bone before TransN, and name it TopN anyone got anything helpful??
don't even mention to name the first bone to TopN and the second bone to TransN... that doesn't work as the model doesn't scale or animate correctly
ok so the problem is when you walk/run, or roll in the game, the point of origin is supposed to take on the new coordinates at the end of the animation... but it dosn't and the char snaps back to the original position and just replays the animation without giong anywhere... how do I fix that??
hey... I'm working with Pikachu's thunder... (remodding my old green thunder)
don't even bring up DarkBones green thunder I made a better one before him from the first red thunder hack...
anyways... WpnPikachuDengekidama is the mdl0 I'm working with (pikachu's in-air thunder jolt) the glow on it is blue... how do I go about making it green??
I've tried ghanging the color values of the mdl0... but any changes I make to it (other than the header) never show up...
if you need an example, I'll use one of DB's images: this one uses a differant mdl0... but the same attributes apply (it's blue)