Custom skinning

Hi, I want to implement a custom skinning method. It requires an extra vertex attribute for each skin vertex (pre-calculated, cached and can be sent to vertex shader). What is the best way to implement this using three js. I found that the vertex shader code which does basic skinning is this. Also can someone please explain where and how USE_SKINNING is set?

What exactly would your custom skinning method do?

It is described in this paper. Basically, for each skin vertex, an optimized center of rotation will be pre-computed and new position of a skin vertex is computed with the help of that CoR.

So basically you want someone to tell you how to implement a new skinning algorithm in three.js?

Yes. I’m new to three js.

Then I applaud your ambition, but you should really start out with something simpler :stuck_out_tongue:

2 Likes

hi dear,has some methods could add shader effects on the FBX,OBJ…models to Improve real performance? I found compass could improve effect,but it’s too vague on the mobile.

I know. But this is part of a project and there is not much time for me to learn all good things about three.js. If you could point me in the right direction, by some effort I’m sure I can do it. :slight_smile:

You can try to use Material.onBeforeCompile() and overwrite the shader chunks for skinning. The following example illustrates the usage of .onBeforeCompile().

https://threejs.org/examples/webgl_materials_modified.html

The relevant shader chunks are skinbase_vertex , skinning_vertex, skinning_pars_vertex and skinnormal_vertex. Since skinning performs vertex blending, it’s exclusively implemented in the vertex shader. There are no shader chunks for the fragment shader.

This define is set when material.skinning is set to true:

3 Likes

Thanks a lot :smile:, I’ll try this out

coooool!!!