- Home /
Dynamic Batching and vertex shader animation
I Use a vertex shader that manipulates the object to create a animation. The system is depended on the models local coordinates to work properly. Unity batches all the instances of this model together and the animation fails.
Is there a way to: a. Disable Dynamic batching on a per shader basis. b. Get the object root location as a uv coordinate within a batched group ?
Old question, but still relevant : Any reason why Unity will not allow material to be explicitly excluded from dynamic batching? (when they are already doing it implicitly...)
It seem so simple, so I'm really curious as to why they decided not to provide a solution.
Answer by Jeizar · Apr 27, 2015 at 11:16 AM
There is a solution described here, that work at least for dynamic objects : http://docs.unity3d.com/Manual/SL-SubShaderTags.html
DisableBatching tag
Some shaders (mostly ones that do object-space vertex deformations) do not work when Draw Call Batching is used. DisableBatching tag can be used to incidate that. There are three possible values: “True” (always disables batching for this shader), “False” (does not disable batching; this is default) and “LODFading” (disable batching when LOD fading is active).
This worked beautifully for me, and was the solution to my problem.
The correct URL is http://docs.unity3d.com/$$anonymous$$anual/SL-SubShaderTags.html
Answer by Jessy · Feb 29, 2012 at 05:06 PM
A. No.
B. Unity won't provide it, but you can come up with your own solution. Obviously, the more vertex attributes you need, the uglier the solution will have to be.
Your answer
![](https://koobas.hobune.stream/wayback/20220613064621im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Dynamic batching and object local vertex position 0 Answers
How do I set up custom shader options without killing batching? 0 Answers
Dissable Batching in Shader 0 Answers
Does dynamic batching and vertex shader work together? 1 Answer
Mobile performance of splat map shader with distance blending 0 Answers