CPU Skinning fallback

I took a very small dive into the library in order to understand what happens under the hood when I use skeletons and skinned meshes.

Am I correct to assume that only GPU skinning is supported (via matrix palettes and bone textures)?

Afaik, some older phones have a max of 256 or even 128 vertex uniforms. Doing the math here, that’s about 59 bones or 27 bones on these devices.

There’s also a code path for using a bone texture, but it requires OEM_FLOAT_TEXTURE, which is also not available on some older phones (~60% support).

If using >59 or >27 bones with no float texture support, both of these code paths fail. Is there a fallback for CPU skinning?

I can’t seem to find references in the code or any discussions about this anywhere

Sources:
Max vertex uniforms stats
Float textures stats

Not that I’m aware of, but it is easy enough to copy the skinning code from the shader and re-implement in JavaScript. I’m not sure that these old mobile devices will have fast enough CPUs to be worth it though.

3 Likes

One alternative is using a RGBA texture to store floats, im not sure what you mean with CPU skinning, but if you mean transforming vertices on CPU that would be beyond too heavy.

2 Likes

The reason I ask this is because Unity seems to only support CPU skinning for WebGL, and they claim here that it is faster than their GPU skinning.

I’m not sure how their benchmarks compare with ThreeJS though. Perhaps they’re doing much more stuff on top of their GPU skinning which makes it a lot less efficient? Or perhaps their CPU skinning uses web workers to speed up the process?

P.S. there’s also a cool benchmark here where someone built a custom GPU skinning framework that seems to perform less efficiently than Unity’s CPU skinning, therefore validating Unity’s claims.