I’m using a normalized local X vertex position to detect if a vertex is on the right (1) or left (-1) of the mesh, but the problem is during animations the vertexes are swapping ‘sides’ and it’s messing up my shader.
For example during an IK head turn (to the right) the left cheek crosses from negative local position X to positive during the head turn.
Does anyone know of a solution to this?
You could store the original vertex position (or just the ‘side’ information) into buffers you don’t need, eg. uv2, color and use that instead of skinned vertex position;
To do that, you could duplicate / modify the mesh on runtime (once, in Start or somewhere) or do it offline in the editor (I haven’t tried this, but I think you can modify the MeshImporter to do custom stuff to meshes created from files on import)