Kuribo64
Views: 19,980,917 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
04-16-24 05:07 PM
Guest:

0 users reading Model File Format (General Usage)! | 1 bot

Main - Computers and technology - Model File Format (General Usage)! Hide post layouts | New reply


Yoshimaster96
Posted on 03-12-16 11:29 PM (rev. 2 of 03-12-16 11:30 PM) Link | #68454
Since there appears to be no such thing as a shaded model format, I did the honors of making one! Following is the specifications for the SMF and CTF files that make up a model:

SMF (Shaded Model File)
Format Specification V1.0

TEXDEF struct:
Each TEXDEF struct contains texture and shader info, and points to the primitives that use the texture.

Bytes|Field Name|Desc.
-----+----------+-----
0004 | NUM_TEXS | Contains the number of textures in the file.
-----+----------+-----
For each texture...
-----+----------+-----
0002 | TEX0_ID | ID of first texture to use in condensed shader.
0002 | TEX1_ID | ID of second texture.
0004 | SHDR_LEN | Length of shader.
-----+----------+-----
Shader data of specified length padded with F nibbles...
-----+----------+-----
0004 | PTR_MDL | Pointer to model data.

MODEL struct:
Stores the model data (duh).

Bytes|Field Name|Desc.
-----+----------+-----
0004 | NUM_TRIS | Number of triangles.
-----+----------+-----
For each triangle...
-----+----------+-----
000C | VTX_POS | Vertex positions.
000C | VTX_NRM | Vertex normals.
0008 | VTX_UVS | Vertex UVs.
000C | VTX_TAN | Vertex tangents.
000C | VTX_BIT | Vertex bitangents.

Note that a texture ID of 0xFFFF indicates a default noise texture.

Shader Commands
~~~~~~~~~~~~~~~~

0 ZERO
1 ONE
2 HALF
3 FRESNEL
4 TEXZERO
5 TEXONE
6 MULT
7 MIX
8 REFLECT
9 REFRACT
A LAMBERT
B NORMAL
C RADVIS
D IRRADVIS
E ~
F ~

-=[EXAMPLES]=-

4F //EMISSIVE
66A4DF //DIFFUSE
766AD468C3 //DIELECTRIC
6684CF //METAL
6678934C //GLASS

~~~~~~~~~~~~~~~~

CTF (Compiled Texture File)
Format Specification V1.0

TEXINFO struct:
Stores the information of each textures, including width, height, and color format.

Bytes|Field Name|Desc.
-----+----------+-----
0004 | NUM_TEXS | Number of textures in the file.
-----+----------+-----
For each texture...
-----+----------+-----
0004 | WIDTH | Width.
0004 | HEIGHT | Height.
0004 | CLR_FMT | Color format (0 is I, 1 is IA, 2 is RGB, 3 is RGBA).
0004 | PTR_IMG | Points to raw, uncompressed image data.

My Youtube Channel:
Yoshimaster96smwc
Some layout tips/code!

-Yoshimaster96

Jesse
Posted on 03-13-16 12:36 PM Link | #68464
cool but you forgot the most basic thing for a model. Also .obj covers every aspect of models pretty nicely, plus its in ascii

Arisotura
Posted on 03-13-16 12:59 PM Link | #68466
well binary formats are quicker and easier to parse, software-wise

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Spacey
Posted on 03-13-16 02:29 PM (rev. 3 of 03-13-16 02:35 PM) Link | #68467
Valves smd format is pretty good, it has a lot of community supported tools for blender, and some tools for 3dsmax, it's an ascii format, though its fairly extensive. IIRC (I haven't worked with it in a while) it has support for some shaders as well as lighting, the official docs are here, though you may want to look at the texture mapping part as vtf/vmt files (whats used for materials) are what handle all of that.
EDIT: Slight correction.

Yoshimaster96
Posted on 03-13-16 03:36 PM (rev. 2 of 03-13-16 03:38 PM) Link | #68469
Thanks for all the feedback, will make some changes for V1.1:

Add some things I forgot to write down
Add cubemap support, as well as compilation of scenes with several objects, and basic animations

My Youtube Channel:
Yoshimaster96smwc
Some layout tips/code!

-Yoshimaster96

Baby Luigi
Posted on 03-13-16 07:47 PM Link | #68487
Posted by Spacey
Valves smd format is pretty good, it has a lot of community supported tools for blender, and some tools for 3dsmax, it's an ascii format, though its fairly extensive. IIRC (I haven't worked with it in a while) it has support for some shaders as well as lighting, the official docs are here, though you may want to look at the texture mapping part as vtf/vmt files (whats used for materials) are what handle all of that.
EDIT: Slight correction.


.smds also save the skin, something I consider pretty valuable for all models. the only thing I don't really like about the .smd model format is that whenever I import the model, all parts get lumped under one object, so if I want to make an object modification, i have to painstakingly detach an object and edit it and reskin it.

Yoshimaster96
Posted on 03-13-16 10:31 PM (rev. 5 of 03-13-16 10:41 PM) Link | #68501
Update! (Animation will come in a later version.)

SMF (Shaded Model File)
Format Specification V1.01

TEXDEF struct:
Each TEXDEF struct contains texture and shader info, and points to the primitives that use the texture.

Bytes|Field Name|Desc.
-----+----------+-----
0004 | NUM_TEXS | Contains the number of textures in the file.
-----+----------+-----
For each texture...
-----+----------+-----
0002 | TEXC_ID | ID of main texture.
0002 | TEXN_ID | ID of normal map texture.
0004 | SHDR_LEN | Length of shader.
-----+----------+-----
Shader data of specified length padded with F nibbles...
-----+----------+-----
0004 | PTR_MDL | Pointer to model data.

MODEL struct:
Stores the model data (duh).

Bytes|Field Name|Desc.
-----+----------+-----
0004 | NUM_TRIS | Number of triangles.
-----+----------+-----
For each triangle...
-----+----------+-----
000C | VTX_POS | Vertex positions.
000C | VTX_NRM | Vertex normals.
0008 | VTX_UVS | Vertex UVs.
000C | VTX_TAN | Vertex tangents.
000C | VTX_BIT | Vertex bitangents.
0004 | VTX_VIS | Vertex visibility.

Shader Commands
~~~~~~~~~~~~~~~~

0 ZERO
1 ONE
2 FRESNEL
3 TEXTURE
4 RADVIS
5 IRRADVIS
6 MULT
7 MIX
8 REFLECT
9 REFRACT
A LAMBERT
B NORMAL
C ~
D ~
E ~
F ~

-=[EXAMPLES]=-

3F //EMISSIVE
66A35F //DIFFUSE
766A356842 //DIELECTRIC
66834F //METAL
66789234 //GLASS

~~~~~~~~~~~~~~~~

CTF (Compiled Texture File)
Format Specification V1.0

TEXINFO struct:
Stores the information of each textures, including width, height, and color format.

Bytes|Field Name|Desc.
-----+----------+-----
0004 | NUM_TEXS | Number of textures in the file.
-----+----------+-----
For each texture...
-----+----------+-----
0004 | WIDTH | Width.
0004 | HEIGHT | Height.
0004 | CLR_FMT | Color format (0 is I, 1 is IA, 2 is RGB, 3 is RGBA).
0004 | PTR_IMG | Points to raw, uncompressed image data.

My Youtube Channel:
Yoshimaster96smwc
Some layout tips/code!

-Yoshimaster96

Yoshimaster96
(post deleted) #68502

Baby Luigi
Posted on 03-13-16 10:49 PM Link | #68503
yeah, would help if this model format also saves the rig

Yoshimaster96
Posted on 03-13-16 11:29 PM Link | #68504
Posted by Baby Luigi
yeah, would help if this model format also saves the rig

Will be added fairly soon.

My Youtube Channel:
Yoshimaster96smwc
Some layout tips/code!

-Yoshimaster96

Jesse
Posted on 03-14-16 09:17 PM Link | #68553
you still forgot that important thing, this model wouldn't even work.

Yoshimaster96
Posted on 03-15-16 02:09 PM Link | #68615
Posted by Jesse
you still forgot that important thing, this model wouldn't even work.

Work how?

My Youtube Channel:
Yoshimaster96smwc
Some layout tips/code!

-Yoshimaster96

LeftyGreenMario
Posted on 03-15-16 02:36 PM Link | #68619
Maybe he means by modeling software not being able to recognize it!? I don't know either.

Yoshimaster96
Posted on 03-15-16 03:35 PM Link | #68623
Posted by LeftyGreenMario
Maybe he means by modeling software not being able to recognize it!? I don't know either.

Yeah, that's it I'm guessing, which makes sense. I'm just hoping that, with the advent of shaders in consoles, this might make modding a bit easier. Consider it being proactive.

My Youtube Channel:
Yoshimaster96smwc
Some layout tips/code!

-Yoshimaster96


Main - Computers and technology - Model File Format (General Usage)! Hide post layouts | New reply

Page rendered in 0.045 seconds. (2048KB of memory used)
MySQL - queries: 27, rows: 224/224, time: 0.011 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.