Unity-Technologies / Animation-Instancing

This technique is designed to instance Characters(SkinnedMeshRender).
Other
1.65k stars 301 forks source link

Wrong size of baking texture was created #117

Open bbccyy opened 2 years ago

bbccyy commented 2 years ago

The problem code locates right at method "PrepareBoneTexture" in script file "AnimationGenerator.cs". According to the code, one can not generate any texture with the size equal to variant "textureWidth" which describes the size of last texture (which is miss-estimated as well).

for (int i = 0; i != count; ++i)
{   //如果有多张纹理,既count > 1,理论上最后一张纹理的size使用textureWidth标记的值(一般会小于1024)
    //the problem code lies below,correct code in condition statements should be: count > 1 && i < count -1 ? ...
    int width = count > 1 && i < count ? stardardTextureSize[stardardTextureSize.Length - 1] : textureWidth;
    bakedBoneTexture[i] = new Texture2D(width, width, format, false);
    bakedBoneTexture[i].filterMode = FilterMode.Point;
}