Consider documenting behavior of TexturePacker `resolutionOptions`
gabrielecirulli opened this issue · comments
I'm using AssetPack's pixiTexturePacker
to create a spritesheet. I intentionally exported the original assets from Figma at 10x their actual resolution so that I'd have freedom in scaling them down via AssetPack. However I got stumped when the following config was not working:
export default {
entry: "./raw-assets",
output: "./static/assets",
plugins: {
compressPng: compressPng(),
manifest: pixiManifest(),
pixiTexturePacker: pixiTexturePacker({
resolutionOptions: { resolutions: { "1x": 0.1, "2x": 0.2, "3x": 0.3 } },
}),
},
};
All I would get out of TexturePacker was a spritesheet where all the assets would remain at 10x resolution.
I dove into the code and noticed that I must specify what the "largest resolution" is, so I changed resolutionOptions
as follows and it worked:
resolutionOptions: { resolutions: { original: 1, "1x": 0.1, "2x": 0.2, "3x": 0.3 } },
Please consider documenting the requirement for specifying the base/largest resolution as part of the options. I don't fully understand the need for it, as I had assumed that only specifying resolutions like 0.1
would be enough for TexturePacker to assume that I wanted images to become 0.1 times the original size.
we now have docs that should help with this: https://pixijs.io/assetpack/docs/guide/pipes/texture-packer/