How to use GPU Skinning?

Hi all!

I’m using Unity version 6000.0.14f1.

In the project settings (EditProject Settings…) in the Player tab in Other Settings I see the GPU Skinning field. The following values ​​are possible there:

  • CPU
  • GPU
  • GPU (Batched)

By default, the GPU (Batched) value is selected. What does this even mean and how to use it?

In the documentation I read that the model vertices must have one of the following formats:

  • position
  • position, normal
  • position, normal, tangent

How then to output a model with a texture? Apparently I don’t understand the principle of operation. In general, is there some minimal example of how to make it work?

I created a cube. Its vertices have information only about position, normal and tangent. Created armature, bones, created animation for it. Saved in fbx. Placed several such objects on the scene. And they did not unite into one call.

You can do skinning on the CPU, which is slow but offloads the GPU. You can pick GPU, which was the only other option prior to Unity 6, and you can use GPU batched, which batches together the same rigs/Skinned meshes into 1 batch. It doesn’t batch together different meshes afaik.

I didn’t understand anything at all.

In the project settings (EditProject Settings… ) in the Player tab in Other Settings I see the GPU Skinning field. The documentation says:

Marked for deprecation in the future. Use PlayerSettings.meshDeformation instead.

How do I use this?

Here I have a model with a skeleton. I add it to the scene in the amount of 20 pieces. Nothing is grouped into one call. That’s why I’m asking how to use this functionality. The documentation also talks about position, normal and tangent for vertices. How then to texture an object?

Maybe the meshes aren’t set up properly?

Maybe. The documentation says:

Unity uses batching if the following applies:

  • The Graphics API supports batching.
  • You process 3 or more batchable meshes in one frame - this is the number of meshes where batching usually becomes faster than non-batched GPU skinning.

I don’t know how to check “The Graphics API supports batching.” But since my video card supports instancing, it should probably work? I placed different numbers of such objects on the stage: 20 and 200.

It goes on to say:

To make sure a mesh is batchable, check the mesh is compatible with standard non-batched GPU skinning, and that its vertex data layout exactly matches one of the following:

  • position
  • position, normal
  • position, normal, tangent

What exactly does “check the mesh is compatible with standard non-batched GPU skinning” mean? It is displayed on the stage. What exactly should be checked here, where should I go? Here are the properties of my geometry:

I fit the requirement of position, normal and tangent. What’s missing then? And how do I animate an object with a texture then (because there is no color or texture coordinates)?

Which graphics API are you using?

Didn’t change anything. Just created a new project using the “3D (Build-In Render Pipeline)” template. But at the top of the editor window it says DX11.

Maybe try dx12?
And you could see if URP fixes it?

Switched current project to DX12. Cubes did not merge into one Draw Call. Created a new project using the URP template. And there switched to DX12. And there the cubes did not merge into one Draw Call.

How do you measure draw calls btw?
It should not affect rendering. In the frame debugger you can see the GPU skinning draw calls being done, not in another place

Thank you! Now it seems clear. It itself somehow groups calculations, apparently through Compute shaders. But the geometry output is not optimal. Each object requires its own Draw Call. In general, calculations in one place, rendering in another.

This is not what I expected. I used Cocos Creator. And there you can bake skeletal animation into a texture. Then I display hundreds of objects on the screen with animation and they are all drawn in 1 Draw Call (it is unclear if they consist of only one material). There it is all already built into the engine. I thought that this option could do something similar. It turns out not.

The technique you describe is called vertex animation. That is not the same as batched GPU skinning.

You can also use vertex animation in Unity, as it is a lot faster than real-time skinning, but it is way less flexible

Are there any built-in tools to implement it?

I do not think so, but there are many free tools on github