0
\$\begingroup\$

I have seen various implementations of mesh loaders in a few open source game engines. But all of them behave meshes differently. Is there a general definition for a mesh that explains what meshes have, what a submesh is, skeletons etc. I still can not understand the difference between a 3d model and a 3d mesh.

\$\endgroup\$
3
\$\begingroup\$

The reason for this is that there's no difference in general.

  • A most basic model or mesh consists of vertices only. Vertices by itself can use different formats and as such may contain different data, for example they could optionally include color data, texture coordinates, and normal vectors. They might as well include data for animations, e.g. weights for skeleton animation and the like.
  • These can be connected by edges, although edges are typically not stored as such (unless there are some kind of lines to be drawn).
  • Sets of three or more vertices are used to form polygons (or n-gons). What's possible really depends on the actual engine or how it interprets/converts this data if needed. The most simple approach will accept polygons only.
  • It's also possible for a model to include a skeleton with bones, but those might be stored in external files as well (e.g. to be shared between mutliple models).
  • Submeshes are a technique to essentially store more than one mesh in one actual file or model/mesh. For example, a mesh could actually contain two sub meshes: One is visible, while the other is used for simplified collision detection (won't need as many details). Another possible use for this would be a navigation mesh that's not visible but used by bots for orientation.

In the end, there's no "best" approach or complete list. It always depends on your actual needs, which is also the reason for all those games using different formats, implementations or interpretations. For example, if you don't need skeletal animations, don't even worry about implementing skeletal animations. If you don't need submeshes, don't even think about them.

\$\endgroup\$
2
\$\begingroup\$

Might be wrong but here's my idea of what is what.

There are two things here: the general, most basic meaning and the concrete implementation. The most basic meaning should be the same in every game/graphics engine but there's a multitude of possible implementations.

A mesh is a set of vertices that create a shape of a model. They're either ordered in an array or by a set of indices in a specific topology so that a graphics card "knows" how to render them.

But the definition of a vertex is closely connected to the shader (concrete implementation) and may vary hugely. It can be as just the bare vertex position, it can be position, texture coordinate and normal (most common one, I guess) but it can be more complex: position, tex coord, second tex coord, normal, tangent, bitangent, vertex color and some arbitrary parameter that a user made up.

Also, a Mesh class in a game engine may have lots of convenience functionalities to handle/render/update/etc... the mesh as well as some additional data.

A model, in my understanding, is a whole renderable object that consists of a mesh, material (shader), optional animations, bones and other things. Again - the basic meaning is the same but there are multiple possible implementations that hugely depend on the concrete engine and intended usage.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.