Question about sub-meshes & sub-entities

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
simedj
Goblin
Posts: 262
Joined: Fri Nov 18, 2011 6:50 pm
x 3

Question about sub-meshes & sub-entities

Post by simedj »

I have a model of a human skeleton consisting of many named parts - one per bone. Currently I have one mesh per bone/part which leads to hundreds of meshes, most of them using the same material.

For performance I believe combining meshes would be better, for render batching, but I would like to keep the parts separate at some level. So I was looking at having one mesh with many sub-meshes, rather than just merging meshes or using static geometry.

But I cannot see anywhere that you can name a sub-mesh or a sub-entity. Is that correct? If I wanted to have this capability - so you can hover the mouse over a bone and be told the name - I would have to write code myself to map the sub-entities to the names I wish to use?
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Question about sub-meshes & sub-entities

Post by Kojack »

Submeshes don't store names directly. Instead, the owning Mesh contains a table of submesh names. You can change them using Mesh::nameSubMesh().

Subentities have no name, you'd use the name of the submesh that matches it (there's a 1 to 1 relationship between submeshes and subentities). If you ask an entity to get a subentity by name, it actually looks up the submesh name and returns the matching subentity.
For performance I believe combining meshes would be better, for render batching, but I would like to keep the parts separate at some level. So I was looking at having one mesh with many sub-meshes, rather than just merging meshes or using static geometry.
Subentities/submeshes are still batches. There will be less transforms (they don't have individual transforms, they share the entity transform) to calculate, but for actual batch count the result will be the same, because each subentity is rendered as a single batch. The idea is that normally subentities/submeshes are used for different materials, or to control render order in objects with transparency.
simedj
Goblin
Posts: 262
Joined: Fri Nov 18, 2011 6:50 pm
x 3

Re: Question about sub-meshes & sub-entities

Post by simedj »

I was sure that submeshes sharing the same material would get combined for rendering... I kind of thought that was one of the main points for using them!

That's a bit disappointing if true, wouldn't it mean the only way to combine multiple meshes into one draw call would be to use static geometry (or merge the meshes in the modeling tool)?

edit: I did mis-remember, from this thread I must have chosen to reemmber what I wanted the answer to be! http://www.ogre3d.org/forums/viewtopic. ... sh#p481595

It sounds then like there aren't that many advantages to sub-entities, if all you gain is the transform?
Looking to find experienced Ogre & shader developers/artists. PM me with a contact email address if interested.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Question about sub-meshes & sub-entities

Post by Kojack »

I kind of thought that was one of the main points for using them!
The main point is to allow multiple materials on one mesh (one submesh per material). If only a single material is used, the exporter should have merged it all into one submesh.
There's also no bounding volume on submeshes, so you can't mouse over a submesh to get it's name. That's a mesh/entity level operation.
Post Reply