Programmatically generated skinned mesh not lit while animating

I have created a 2D skinned mesh programmatically (xy plane), setting all the normals of each vertex to point toward the camera (0, 0, -1.0f). There are three point light sources in front of my skinned meshes in the scene. At rest, this skinned mesh behaves properly with light sources.

Mesh at rest, before calling play on the walking animation:

alt text

When I try to animate, however, the normals seem to be messed up, though I’m not changing them at all once the mesh is created. Here is the walking animation:

alt text

You can see that only the helmet, hand, shield and sword vertices are being lit. The other body vertices somehow do not seem to have their normals working.

The standing animation is even worse in that it doesn’t show any light at all:

alt text

I’m not changing the normals, all that is happening is that the skinned mesh is animating. If i don’t play any animations, the light works fine, but obviously this isn’t a good solution.

I’ve tried different shaders, including:

Diffuse
VertexLit
Transparent/Diffuse
Transparent/VertexLit
Particles/VertexLit Blended
Mobile/Particles/VertexLit Blended

The example images are using Mobile/Particles/VertexLit Blended

Running on Unity 3.5.0f5

Anyone encountered this before?

1 Answer

1

Solved!

I was only adding the x and y scale animation curves to my bones, so it was defaulting the z scale curve to zeros, thus making the normals zero as well. Adding in a bogus z scale animation curve filled with ones fixed it.