Sign in to follow this  
fire332211

3d Model Formats

Recommended Posts

Hi, I am interested in loading quake .bsp files, but first I need understand how the 3d geometry is stored when saving a 3d model to any format in general. I understand that when a model is rendered, it is made up of triangles, but could you please explain how exactly the data is stored in a file? Thanks

Share this post


Link to post
Share on other sites
Quote:
I need understand how the 3d geometry is stored when saving a 3d model to any format in general

That's a very general question, and the best I can do is give you a very general answer as there are many file formats for geometry of various sorts.

Data generally appears as one or more of the following groups:

Vertex data (usually in a set of 3 coordinates X, Y, Z)
Normal data (usually in a set of 3 values nx, ny, nz)
Face indices ( a set of 3 vertex indices which form a triangle )
Texture coordinates ( a set of 2 values tu, tv )
Materials ( a set of values perhaps containing color, a texture name, etc. )

Each of those data sets is usually preceded by some sort of indication of what group follows. E.g., for vertex data-

// a DirectX mesh
Mesh {
234; // number of vertices in mesh
0.715, 0.5, 1.0;,
0.715, 0.3, 1.0;,
...
}
// an OBJ file
v 0.715 0.5 1.0 // each set of vertex data preceded by 'v'
v 0.715 0.3 1.0
...

Share this post


Link to post
Share on other sites
Quote:
Original post by Buckeye
Quote:
I need understand how the 3d geometry is stored when saving a 3d model to any format in general

That's a very general question, and the best I can do is give you a very general answer as there are many file formats for geometry of various sorts.

Data generally appears as one or more of the following groups:

Vertex data (usually in a set of 3 coordinates X, Y, Z)
Normal data (usually in a set of 3 values nx, ny, nz)
Face indices ( a set of 3 vertex indices which form a triangle )
Texture coordinates ( a set of 2 values tu, tv )
Materials ( a set of values perhaps containing color, a texture name, etc. )

Each of those data sets is usually preceded by some sort of indication of what group follows. E.g., for vertex data-

// a DirectX mesh
Mesh {
234; // number of vertices in mesh
0.715, 0.5, 1.0;,
0.715, 0.3, 1.0;,
...
}
// an OBJ file
v 0.715 0.5 1.0 // each set of vertex data preceded by 'v'
v 0.715 0.3 1.0
...


Thanks a lot, that's just what I needed

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this