- Home /
Shader : issue with vertex positions when multiple models are on the scene
Hi ! I'm currently trying to make a tree growth using a vertex shader. I use the easiest way I've found : I just make vertex scale from 0 to 1.
void vert(inout appdata_full v){
v.vertex.xyz = mul(v.vertex.xyz, _GrowthAmount);
}
It works well when I have only one model on the scene. When I have more than one tree, they grow normally, but they all begin from the center of the map ( position (0, 0, 0) ) and they slide to their position will growing. I know I missed something, but I searched for several hours and I can't find any solution... Can anyone help me ? Thanks :)
Answer by tanoshimi · Jan 29, 2017 at 10:41 AM
That sounds like dynamic batching combining the vertices of your trees into a single mesh centred around the origin. Try adding "DisableBatching" = "True" to the tags at the top of your shader: https://docs.unity3d.com/Manual/SL-SubShaderTags.html
THAN$$anonymous$$ YOU ! I was totally desperate, and your solution worked. You made my day dude, thank you very much o/