- Home /
Question by
Bibzball · Apr 20, 2017 at 04:23 PM ·
shaderbatchingvertex color
Dynamic Batching is breaking vertex color ?
Hey there,
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 :
struct v2f
{
fixed4 color : COLOR;
fixed4 pos : SV_POSITION;
fixed2 uv : TEXCOORD0;
};
v2f vert(appdata_full v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.texcoord;
o.color = v.color;
return o;
}
fixed4 frag(v2f i) : COLOR
{
return i.color;
}
Anyone knows what could be happening ?
Thanks !
Comment
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!