Advertisement

Batch Mesh Processing / Materials Problem

Started by August 30, 2017 07:27 AM
3 comments, last by AthosVG 7 years, 5 months ago

When I batch some static meshes into a large one (collapse them into one large chunk), the mesh material information per frame is lost. My batch manager is primitive, I just push each mesh into a pool and collapse them into a chunk, then I also store the materials and textures into an array, but the mesh materials don't look right at all...

How can I solve this problem?

Thanks

Jack

3 hours ago, lucky6969b said:

When I batch some static meshes into a large one (collapse them into one large chunk), the mesh material information per frame is lost. My batch manager is primitive, I just push each mesh into a pool and collapse them into a chunk, then I also store the materials and textures into an array, but the mesh materials don't look right at all...

It's not clear what you are describing.  Are you saying that you combine all the meshes into a single large mesh and then render it?

Advertisement

I just concatenate all meshes (ID3DXMesh) and pass them to a function that produces one single mesh that encompasses the individual single meshes... (one large one)

Oh, as I think back, I think it's not logical to do this move. Because it is logically not possible to identify each mesh's material this way.

I'll think about the other ways.

Usually you only limit this optimisation to a scenario where the material is equal, else you have exactly this problem. The best you can usually do if you want to batch render these in a collapsed mesh fashion is to use texture atlases. Packing more information into the vertices can work if you really want to achieve this for some of the uniform parameters, such as an array of colors of which the correct one is picked by using the index stored in the vertex, but then you still need the same set of shaders etc.

Perhaps it's worth describing what you're looking to get out of it, because even if it were possible to merge them into a single mesh and have multiple materials for that combined mesh, it could still not really reduce the amount of draw calls (which is what the combining of static meshes is often used for)

This topic is closed to new replies.

Advertisement