robin.fischer

At the moment most of my Animations with FFD and Skinned Meshes are working. But some of them show weird Images on some Frames. I narrowed it down to Meshes that use Sprites as Path which where Trimmed by 2DToolkit (spine-csharp). I saw the Calculation of the UVs in the MeshAttachment:
if (RegionRotate) {
for (int i = 0, n = uvs.Length; i < n; i += 2) {
uvs[i] = u + regionUVs[i + 1] * width;
uvs[i + 1] = v + height - regionUVs[i] * height;
}
} else {
for (int i = 0, n = uvs.Length; i < n; i += 2) {
uvs[i] = u + regionUVs[i] * width;
uvs[i + 1] = v + regionUVs[i + 1] * height;
}
}
And the RegionOffsets and RegionWidth/Height is not taken into account. Is this just missing and will be done soon, or was it forgotten? :) If I disable Trimming it works, but my Atlases are very big.
robin.fischer
  • Posts: 9

Nate

Trimming doesn't work with meshes. Trimming normal works because you can't see the blank pixels, so not drawing them is fine. With meshes, you may have vertices in the blank pixels. The vertices have UVs, so need to be mapped to a part of the image. If you trimmed the blank pixels, your vertices could pick up neighboring images in the atlas.

The best we could do would be to make the trimming know about the vertices, so it only trims pixels outside the mesh. This is more complex though, and even then wouldn't help you if using TK2D to do the trimming, which doesn't know about Spine meshes.
User avatar
Nate

Nate
  • Posts: 11809

robin.fischer

It is true what you say. On our Project we have a 8 pixel Maximum distance from a Vertex to the Pixel Edge. If I apply that 8 pixel Maximum as Padding for the Atlases I should be fine. Or am I forgetting something? :)
robin.fischer
  • Posts: 9

Nate

It should work. You may need to adjust the UVs, give it a try. With meshes it's generally easier to trim the images before pulling them into Spine. If this makes you have to position them in setup mode, try the Photoshop script that comes with Spine.
User avatar
Nate

Nate
  • Posts: 11809


Return to Runtimes