GPU SkinnedMesh Instancing

5 comments

Have you ever tried to instantiate thousands of animated skinned meshes in a Unity Scene? Even with GPU Skinning enabled (quite obscure feature in Unity) and baked skinned meshes (thanks to MeshBaker but it does not support many skin animations), the Animation Class on every instance is consuming all your CPU resources.

As there is no way to write 32F in RenderTexture and proceed like DirectX10 technique (see below), I used DirectX11 and ComputeBuffers to bake mesh topology and animations for GPU processing. Then a compute shader is used to iterate through these buffers, calculating and transmitting data to a classic render shader that draws every vertices and triangles of the instantiated mesh according an animation buffer.

There is no shadow handling yet but diffuse and specular lights are working nicely.

Inspired from DirectX10 technique:
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch02.html

QGPU SkinnedMesh Instancing

5 comments

Join the conversation
  • Bret Cowart - September 12, 2014 reply

    Hi Quentin,

    This looks like a great technique. Will you be releasing this in the Unity Asset Store ?

    I have many questions about your technique and would like to contact you (sorry I don’t use LinkedIn).

    Please email me at bcowart.jp@gmail.com so we can get in touch.

  • Neal - September 27, 2014 reply

    I would also be interested in this solution, as we currently have a project that needs ton of skinned instancing. Looks like your solution would do the trick.

  • Gg - September 30, 2014 reply

    This technique has a caveat though;
    I see 3072 peaceful men on screen and no women. If you put just one “skinned” woman into this scene, FPS would drop significantly (since all men would try to do different animations then they normally do, to attract the woman) and if you put 2 women into that scene, all men will start watching the women having a cat fight.
    Those are the problems you will be facing if you continue this.
    You’ve been warned!

    Jokes aside; good luck, looking really good 🙂

    Quentin Lengelé

    Quentin Lengelé - September 30, 2014 reply

    LOL 😀

    Thanks guys for your reply.
    I’m very busy right now. I need to do some refactoring and packaging before putting this on the asset store… like many of my other plugins 🙁 But the agency where I work asked me to finalize the GPU SkinnedMesh Instancing for an internal project. So, in a near futur, I will be able to finalize this. And I hope Unity will give to ability to handle shadows with DrawProcedural method soon…

  • Steve - December 9, 2015 reply

    Hi!
    Nice work here! Any movement on this towards the Asset store? We could use this for our project for crowds. Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *