I have a very simple vertex coloring shader (pasted at the end of the post).
Works great when I have a single instance of a mesh in my scene. However, as soon as dynamic batching comes into play, my vertex coloring seems to be broken :
If I explicitly "DisableBatching" = "True" in my shader tags, everything's fine.
Here's the shader :
fixed4 color : COLOR;
fixed4 pos : SV_POSITION;
fixed2 uv : TEXCOORD0;
v2f vert(appdata_full v)
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.texcoord;
o.color = v.color;
fixed4 frag(v2f i) : COLOR
Anyone knows what could be happening ?
Answering my own question as it might help someone else.
I did not need UVs in the shader so I simply removed them from my vertex shader structure and it magically solved the issue. Not sure why it happened, so if anyone has an explanation I'd still be happy to hear it. Cheers!
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
3 People are following this question.
Transparent shader breaks static batching?
Shader render queue and effects on batching?
Changes to Mesh Vertex Colors Reset on Build
Change specific vertex colours in a shader
How do I set up custom shader options without killing batching?