Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

3D Batch Mesh Processing / Materials Problem

This topic is 391 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!