I recently changed my skeletal animation code. Previously I built the skeleton and applied the deformations to the vertices on the CPU, and then transformed the vertices to the correct position and heading using OpenGL.
I decided to instead apply the translation and rotation to the root bone, and skin from there, thinking this would be simpler for collision, as the data would already be in world space.
Now, when the skeleton is moved far from the origin, 5000 units and up, some vertices seem to lag behind the rest. The easiest way to see the problem is to translate the root bone a few thousand units down the x axis. About 50 percent of the vertices look like they’re transformed 4990 units in the x direction, rather than 5000.
Here are two screenshots
This effect is magnified the further from the origin the model is. This happens if my joint matrices are stored as doubles or floats. I haven’t tried moving all my skinning code to floats, though.
Curious as to whether this was an error in my skinning code, Maya exporter, or some precision issue, I applied a translation of 250,000 units in Maya, and the same problem occurred in Maya’s skinning algorithm.
Is this a floating-point precision issue, or a symptom of something related? Has anyone encountered this before?
In my exporter I was discarding per-vertex bone weights with a small value, but not redistributing that weight to the other bones that influenced the vertex. This only manifested itself as a problem once the model was transformed by large values.
The problem still occurs in Maya itself, although it’s not as bad. I’m curious as to what’s going on there.
I’m pretty sure it’s a precision issue, since skinning with only one bone per vertex has removed the artifacts at normal distances (~10000 units.)