Skip to content

Commit

Permalink
Tools: use explicit anchor for empty material names
Browse files Browse the repository at this point in the history
and remove meshmagick from solutions. It fails on import, too.
  • Loading branch information
paroj committed May 18, 2024
1 parent 0a090af commit ab3b976
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
32 changes: 15 additions & 17 deletions Docs/src/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,34 +335,32 @@ OgreAssimpConverter [parameters] sourcefile [destination]

# Exporters {#Exporters}

Exporters are plugins to 3D modelling tools which write meshes and skeletal animation to file formats which OGRE can use for realtime rendering. The files the exporters write end in .mesh and .skeleton respectively.
Exporters are plugins to 3D modelling tools which write meshes and skeletal animation to file formats which OGRE can use for realtime rendering. The files the exporters write end in `.mesh` and `.skeleton` respectively.

Each exporter has to be written specifically for the modeller in question, although they all use a common set of facilities provided by Ogre::MeshSerializer and Ogre::SkeletonSerializer. They also normally require you to own the modelling tool.

All the exporters here can be built from the source code, or you can download precompiled versions from the OGRE web site.

## A Note About Modelling / Animation For OGRE

There are a few rules when creating an animated model for OGRE:

- You must have no more than 4 weighted bone assignments per vertex. If you have more, OGRE will eliminate the lowest weighted assignments and re-normalise the other weights. This limit is imposed by hardware blending limitations.
- All vertices must be assigned to at least one bone - assign static vertices to the root bone.
- At the very least each bone must have a keyframe at the beginning and end of the animation.

If you’re creating non-animated meshes, then you do not need to be concerned with the above.

Full documentation for each exporter is provided along with the exporter itself, and there is a [selection of the currently supported modelling tools at OGRECave](https://github.com/OGRECave).

## A Note About empty Material Names
<a name="autotoc_md32"></a> <!-- legacy anchor by tools of Ogre 14.2.5 and earlier -->
## Empty material names {#empty-material-names}

All mesh files are required to have a material name set, otherwise most mesh tools will fail with an exception.
Even if they don't, the exception will happen deep inside the render-loop which is way harder to debug (unless you set the material programmatically).
Even if they don't, the exception will happen deep inside the render-loop which is way harder to debug (unless you set the material programmatically).

To set a material name for the mesh, you have these options:

- Re-export the mesh from your preferred DCC (Digital Content Creator) exporter, making sure that a material has been assigned.
- Re-export the mesh, making sure that a material has been assigned.
- Edit the mesh.xml file to set a material name and reprocess the xml with @c OgreXMLConverter.
- Edit the mesh file with [MeshMagick](https://github.com/OGRECave/meshmagick) to set a material name

## Skeletal animation

There are a few rules when creating an animated model:

- You must have no more than 4 weighted bone assignments per vertex. If you have more, OGRE will eliminate the lowest weighted assignments and re-normalise the other weights. This limit is imposed by hardware blending limitations.
- All vertices must be assigned to at least one bone - assign static vertices to the root bone.
- At the very least each bone must have a keyframe at the beginning and end of the animation.

If you’re creating non-animated meshes, then you do not need to be concerned with the above.

@page Shadows Shadows

Expand Down
2 changes: 1 addition & 1 deletion Tools/MeshUpgrader/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ struct MeshResourceCreator : public MeshSerializerListener
{
if(name->empty()) {
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
"The provided mesh file has an empty material name. See https://ogrecave.github.io/ogre/api/latest/_mesh-_tools.html#autotoc_md32");
"The provided mesh file has an empty material name. See https://ogrecave.github.io/ogre/api/latest/_mesh-_tools.html#empty-material-names");
}
else {
// create material because we do not load any .material files
Expand Down
2 changes: 1 addition & 1 deletion Tools/XMLConverter/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ struct MeshResourceCreator : public MeshSerializerListener
if (name->empty())
{
LogManager::getSingleton().logWarning("one of the SubMeshes is using an empty material name. "
"See https://ogrecave.github.io/ogre/api/latest/_mesh-_tools.html#autotoc_md32");
"See https://ogrecave.github.io/ogre/api/latest/_mesh-_tools.html#empty-material-names");
// here, we explicitly want to allow fixing that
return;
}
Expand Down

0 comments on commit ab3b976

Please sign in to comment.