I have lots of agents to do same animation ,so i decide to use vertex animation tech.
i found that i could use compute shader or normal shader with vertex texture to implement it,
so i want to know which is better?
That depends on a lot of factors. Generally, I would say if you want to reuse the mesh during multiple passes, I would use a compute shader, that way you don’t have to redo the work. But if you only want to use it in one pass, a vertex shader has the advantage of not having to write the data unnecessarily once you are done with it, since it just goes straight to the next render stage.
I recently wrote an animation and skinned mesh rendering system for DOTS. I wrote a custom compute skinning shader that was 50% faster than Unity’s Hybrid Renderer implementation due to groupshared caching of skin matrices. I benchmarked this on an AMD GPU which benefits the most from this technique.
Late in development of this system, I added Linear Blend Skinning shader graph node support, which reads skin matrices from a buffer and does skinning in the vertex shader. Turns out computing skin matrices in a compute shader (multiplying localToRoot and bindpose matrices) and then letting the vertex shader take over from there was the fastest approach, no matter how many shadow maps were rendered. I found this to be really surprising.