Jump to content

Mesh asset format picture.


Drongle McMahon
 Share

You are about to reply to a thread that has been inactive for 4398 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

The mesh asset format is described in a wiki page. Understanding it can help to explain some otherwise perplexing things. So I made this picture for myself, that may be useful for others. It may also be inaccurate, so I would welcome any suggestions for corrections or improvements, or even a reasoned rejection of the whole thing. I will incorporate corrections by replacing the image here, so that it stays at the top.

This is now the updated version incorporating suggestions and corrections.

meshassetformatv5.png

Anyone is free to use this however they wish.

  • Like 4
Link to comment
Share on other sites

Yes. That's why there are three numbers. I do like that, but it doesn't show that there is a vertex list. I think that is important. The vertices are not confined within a triangle. Some vertices are referenced by two or more triangles. So it's not quite right. Something in between is needed, I think.

Whatabout this ...

meshassetformatv2.png

Link to comment
Share on other sites

I like that version. It gives more detailed information about the vertices and their relations to triangles and answers one more question (max. verts per mesh)

some more remarks:

 

  • From the discussion in the other thread we learn that one vertex is potentially counted multiple times. From the schema you provide, it looks more like each vertex is counted once independent from its reusage in multiple faces.
  • And also the dependency of vertex count from the UV map is not adressed here i guess ?

[edit]: i think i understand now: A vertex is reused only if position, vertex normal AND UV position match. So your map now indeed answers all questions (sort of...)

Link to comment
Share on other sites

Here is an attempt for a simple explanation and after writing it i think some informal images would help a lot ;-)

Each vertex contains actually 3 values:


  1. The vertex position
  2. A vertex normal
  3. A UVmap position

In principle this information has to be maintained for each triangle corner inependent on whether the vertex is reused in multiple triangles or not. this is so because the vertex can be located at different postions on the UV map for different triangles. Also the vertex nromal depends strongly on how the associated triangle is placed in 3D space.

But sometimes a shared vertex can use the same UV coordinates AND the same vertex normal. in such cases (and only then!) a vertex description can be shared among multiple triangles.

This happens especially in 2 cases:

 

  1. If multiple faces with shared vertices lay exactly in the same plane, then the vertex normals are all identical.
  2. If smoooth shading is enabled, then all vertex normals point into the same direction inependent on how the associated triangles are placed.

One extreme example is a simple cube. In that case we have 12 triangles (2 per side) and that makes up for 36 vertex descriptors. But on each corner we find only 3 different vertex normals (because the faces are positioned in xy-plane, xz-plane and yz-plane and so each vertex normal can only have one of 3 values). Hence we find  8 corners with 3 vertex normals each. That sums up to 3*8 = 24 vertex normals.

Consequently the list of vertices can be reduced by eliminating the dupliate descriptors and we end up with only 24 descriptors instead of 36.

If we enable smooth shading, then the vertex normals of all vertices on a corner point into the same direction. So we end up with exactly 8 face normals and this we will also see only 8 vertex descriptors.

  • Like 1
Link to comment
Share on other sites

Almost, except that there are only 6 different face normals in the smoothed cube, There are 8 vertex normals (each of which is the sum of the three adjoining quad face normals at a vertex). Face normals are not stored (or used by opengl, as far as I know). The faces of a flat shaded triangle just have three identical vertex normals.

I need to check one other thing with Runitai - there do seem to be separate vertex lists for each LOD, but does the 64K limit (necessary for 16 bit indices in triangle lists) apply separately to each, or to the sum of all of them?

I also left out the vertex weighting and the havok private and physics cost  info, but I think I will leave it that way so that it's just for static meshes and vaguely comprehensible data.

 meshassetformatv4.png

Link to comment
Share on other sites

As far as i understand it, you only need the W vector for things like Volumentric textures ..

I read a text about it .. now its really REALLY hard to understand for me

I cant find the link anymore. But i know that at least in maya there is a a whole set of funcions for that.

Link to comment
Share on other sites

After two days of intense reading I think I am finally starting to get it :D Thank you much for that diagram it helped me to understand much better. As I was reading all of these things before it was hard to put it together how it pertained to one individual upload, that made things much more concise. Thank you.

Link to comment
Share on other sites

Volumetric textures are for things like clouds that would vary in all three dimensions rather than two for surface mapped textures.

There are some other obscure uses for the W axis in UVW space.  W is perpendicular to the UV plane.  If you think of the texture map as a piece of paper on a desk, the W axis is a pencil pointing up from the paper.  The W value is used in some graphics engine to give the *rotation* of the texture about the W axis.  If it is a single value, it rotates the texture as a whole.  If it is a mapped value per pixel, it would represent a *distortion* of the texture.  I have not seen that actually used anywhere.

UVW coordinates can represent your model texture coordinates in such a way it can be rotated in three dimensions, changing the mapping as projected onto the UV plane.  This allows interesting, but complicated, changes in real time in a world or game.  For example, you can have one model of a rock, and one texture for it, but by varying the UVW rotation angles randomly, get instances of the rock that look different.  I have not seen this used anywhere either.

Link to comment
Share on other sites

If I understand you correctly in your latter description you would be able to use textures similar to those billboards that are different pictures from different angles? That seems like it would be kinda useful in certain situations, I am surprised it hasn't been used.

 

[edited] reply supposed to be to Daniel :)

Link to comment
Share on other sites

The W coordinate from UVW textures really goes back to the old days of 3D rendering.....

 

In order to speed up the code (and simplify the data structures), the programmers often re-used the 'vertex' structure for holding UV texture info (rather than create a new structure that only held two floating point values.  Since it had a third parameter, it gave them a way to hold an extra bit of data for whatever they might need it for.  And if they kept it at zero, most of the standard vertex functions that might be used (and defined in a 'vertex' object, like distance, etc.) will work on the texture space as well.

 

Later, when volumetric textures and procedural textures were developed, the W parameter became an additional dimension, allowing for  textures which changed based on the W parameter.  This was also used heavily in ray-tracing and other graphics where objects were solid (and lend themselves to procedural texturing well), instead of polygonal.

 

Link to comment
Share on other sites

  • Lindens


Drongle McMahon wrote:

Almost, except that there are only 6 different face normals in the smoothed cube, There are 8 vertex normals (each of which is the sum of the three adjoining quad face normals at a vertex). Face normals are not stored (or used by opengl, as far as I know). The faces of a flat shaded triangle just have three identical vertex normals.

I need to check one other thing with Runitai - there do seem to be separate vertex lists for each LOD, but does the 64K limit (necessary for 16 bit indices in triangle lists) apply separately to each, or to the sum of all of them?

I also left out the vertex weighting and the havok private and physics cost  info, but I think I will leave it that way so that it's just for static meshes and vaguely comprehensible data.

 
meshassetformatv4.png

The 64k limit applies to each submesh separately.

 

Also, vertex weight data is in the LoD block -- the "skin" data block contains a list of joint names and bind matrices to match up to joint indices in the weight data.

Link to comment
Share on other sites

  • Lindens


Drongle McMahon wrote:

I have wondered about the W before, but have no real idea what it does. I did read something about it being used in transformations to give the texture a perspective transformation. I would guess it is ignored, but I really don't know.

Runitai, are you there? Help!

It is ignored -- actually, I think if it shows up in the .dae file, UVs won't parse with our importer.  Anybody got a .dae with 3D texture coordinates to test?

Link to comment
Share on other sites

  • 8 months later...
You are about to reply to a thread that has been inactive for 4398 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...