- Home /
Do tiled materials prevent dynamic batching?
I'm creating some geometry on the fly in my scene and I'm using 1 material containing a spritesheet of 5 textures. I assign the same material to all my geometry with the difference that some geometry uses one of the 5 textures (using offsets) and that texture is also tiled a N amount of times depending on the geometry. I have dynamic batching active but for some reason I get 200+ draw calls with only 30 objects created on the fly.
I was wondering if the problem is the fact that, even though all objects share the same material, tiling it and offsetting part of it on the different faces of the object creates a clone of the material in the background, thus raising the number of draw calls.
Any idea? Thanks.
Answer by Kiloblargh · Jan 28, 2014 at 04:49 PM
Yes. If the texture offset / scale of a material changes, it is no longer the same material. There's no getting around that. What you can do is make a small fixed number of materials with different texture offsets already set, assign one of them using sharedMaterial, and change how the geometry is generated to fit.
Answer by Nub3h · Jan 29, 2014 at 01:43 PM
ok, thanks for the answer. One more thing though...if I apply the same material to different dynamically created objects with different UV values for their meshes, should the dynamic batching still work as well? I don't modify the material in any way, I only apply it to objects that have different UV values that will tile and stretch the applied material.
Thanks
Your answer
Follow this Question
Related Questions
Draw call increased on duplicated object. But not on others 0 Answers
Draw Calls are Getting More 0 Answers
How do you know if your materials are shared (in the context of reducing draw calls)? 1 Answer
More Objects and less draw calls? Or Fewer Objects and more draw calls? 1 Answer
Multiple Shaders vs. Single Texture - Please help me overthink this. 2 Answers