I had a post about shadow performance on instanced models with baked animation, and @Evgeni_Popov suggested me to look into Optimizing further and standalone shadow depth wrapper section.
I revisited this topic today and I was able to achieve animated shadows on thin instances with a ShaderMaterial by adding my customized bonesVertex to shadowMapVertex.
Now my problem is: I have custom attributes added to the original PBRCustomMaterial used for the model. How can I pass the attribute used for each instanced model to the custom ShaderMaterial I pass to ShadowDepthWrapper?
Another question is about performance. It is much better than using PBRCustomMaterial itself in ShadowDepthWrapper, but FPS dropped to 40 with 200 animated units. Without shadow, I am able to maintain 600 units without FPS drops, and I believe I can have more units eventually when I replace the testing model with low-poly ones. But shadow seems to be the bottleneck. I am wondering how game like total war can support shadows of thousands units?