2D Toolkit Forum
2D Toolkit => Support => Topic started by: LilBitStudio on January 06, 2014, 06:16:30 pm
-
When creating a cloned sprite with custom meshes, it appears that sprite atlasing and mesh generation doesn't compensate for clones.
It appears the first sprite's bounding box is used for sprite atlasing only ... causing cloned sprites to be clipped that fall outside of the first sprites bounding box (or adjacent atlas content to bleed into it).
Below is a simple example illustrating the problem. We do this in cases where we need to force the atlas to pack irregular shapes tighter as well as layer alpha and non-alpha meshes of the same sprite for performance.
Thanks - Scott
Example:
Sprite / Cloned Sprite
https://www.dropbox.com/s/8qoupecw4524lh0/Screenshot%202014-01-06%2013.13.46.JPG
https://www.dropbox.com/s/z13f21e3s1txpnp/Screenshot%202014-01-06%2013.14.07.JPG
Result in Atlas
https://www.dropbox.com/s/8oqdl7lh758mlkz/Screenshot%202014-01-06%2013.14.38.JPG
-
Irregular shape packing isn't supported at the moment, and isn't in the roadmap either. However, you can manage this yourself by packing the texture the way you want, then disabling trimming in tk2d. The duplicates should be identified as such and only one copy of the texture will be in the atlas.
-
Perfect, thanks.
Disabling trimming on the sprites (and its clones) fixes the problem.
We're fine without the irregular packing (we can do that as needed), just that the trimming doesn't compensate for the custom meshes across clones. Thanks again - Scott