Sign in to follow this  

Mesh Batching Options

This topic is 3461 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

Hi, I am attempting to improve the batch performance of some simulation I am working on. Currently, I'm working with scenes that has relatively simple meshes, but often have several varying textures. Imagine a building scene, with lots of simple buildings but often widely different textures. Some of the buildings may have multiple textures as well. At the moment, the meshes are broken up into sub-meshes, with one texture per sub-mesh. I render each sub-mesh individually. With lots of buildings, or even a good number of complex buildings (20+ textures on each building), the performance gets quite horrible even on recent hardware. I'm trying to improve performance by drawing several buildings at a time. However, its often difficult to find several that all have the same texture. The only real option I could think of is to use texture atlases. I'm limited to SM2+ hardware, so I can't use those wonderful texture arrays or anything like that. On SM2/3 hardware, I can't think of any other technique that would achieve what I am trying to do other than texture atlases. I thought texture atlases were a bit of a dated technique, but I'm not really up to date with batching techniques. Are there any other options for rendering batches of geometry with varying textures? Or am I limited to texture atlases? If I do decide to go with atlases, I know about the drawbacks with texture wrapping and such. Thanks for any other suggestions or confirmations that texture atlases would be the best option. [Edited by - wyrzy on June 23, 2008 7:40:54 PM]

Share this post


Link to post
Share on other sites
Why would atlases be an outdated technique ? The underlying HW has still same architecture. It still needs to bind a texture and textures all DIP`s primitives with it.

You can however use this weakness as your strength if you`re worried about batches. Bind several textures to stages 0-15, use relevant texcoords and inside a shader decide which vertex should be textured with either of the textures.

Share this post


Link to post
Share on other sites
Quote:
Original post by VladRBind several textures to stages 0-15, use relevant texcoords and inside a shader decide which vertex should be textured with either of the textures.


I'm not sure if I follow. Are you suggesting I decide in the vertex shader which texture to sample in the pixel shader. I didn't think that was possible (unless using SM4 texture arrays which I can't use). How would I go about doing that? If I decided in the pixel shader, it would force 16 lookups on SM2 cards which would likely kill the performance.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zipster
Instead of rendering each sub-mesh individually, batch all the sub-meshes that have the same texture/shader. That removes the number of buildings from the equation.


I was thinking of doing that exclusively, but I have to work with user created content (ie, content I have no control over), and there is little guarantee several sub-meshes will be visible that have the same texture (all objects will generally have the same shader). Also, perhaps my buildings description was a bit vague - the user can create their scene of whatever they choose, we just import it. Some of our test scenes at the moment were composed of buildings with various textures though since that was not performance friendly at the moment.

I could just impose the constraint that your performance is going to drop significantly is you decide to have different textures on meshes that are the same. I don't know how well the customers would like that though.

At the moment, I'm leaning towards implementing the texture atlases for meshes that wouldn't batch well otherwise, and use Zipster's idea in the scenarios where I have a decent number of smaller meshes that all of the same texture. I was holding off on implementing the texture atlas approach since its likely going to be a pain to get working with proper wrapping, mip-mapping, and such. I have a good idea how to go about it, its just going to likely take some time to get working correctly.

Share this post


Link to post
Share on other sites

This topic is 3461 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this