Scale factor in Atlas settings

It will be very useful to have x and y scale factors for images in atlas setting. If you have, for example image like 2000x2500 pixels it will be using 2048x4096 atlas, but if i scale it a little in y size - it can fit to 2048x2048 atlas. The proplem is that if i scale original image - i lose original image size and have to backscale game object to set original size. Another way will be to scale images in atlas and it does not affect to logical image size, but only quality.

Here are examples:


It very useful in any spine models and any backgrounds (huge backs for modern phones)

6 Likes

It will be very useful on pre release stage in Atlas optimization for final game (and You do not have to edit game and art, only choose what atlases and quality you need by changing atlas scale factors)

2 Likes

After the conversation in DM with @dasannikov I think, I understand what he meant and what benefits of this feature. I’ll try to explain.

  1. Would be great to have scale option for atlases when a developer can set X and Y scale for all images inside the atlas. (X and Y separately just because sometimes you wanna compress image only in one measurement, it depend on image)
  2. Editor/bob get this scale and apply it to images and generate atlas with downscaled images.
  3. In runtime (or in scene editor) when we take sprite we calculate size as real_sprite_size_in_texture.x/atlas_scale.x and real_sprite_size_in_texture.y/atlas_scale.y and use this sprite with upscale.

Real life example:

  1. For example, we have background 1200x1200, when we add this background into atlas we have 2048x2048.
  2. We set the atlas scale to x = 0.8 y = 0.8 because we know that this quality good enough for us.
  3. Size of the image recalculates as 1200*0.8 = 960, as result we have 1024x1024 atlas with 960x960 image inside
  4. But in the game, it will be the original sprite size because when the engine takes the size of the sprite it calculates as 960/0.8 = 1200.

What the benefits:

  • Simpler pipeline for resource preparation because you all the time have original resources in your project and downscale them only in the build step.
  • Possibility to build different builds for different resolution: just iterate all atlases and set the scale to scale*0.5 (or another scale) in the pre-build step instead of rescaling everything everywhere.
  • in pair with Resource Property good solution for retina workflow

Open questions:

  • what to do with other types of resources (tilemaps, fonts, something else?)
  • we have some other way to have the same result for GUI (manualsize mode) and in Spine (we take sprite size from the json of animation as I understand), but it seems like this “atlas scale solution” will not conflict with both of those and will work as the addition for the existing systems.

P.S. It is not an announce of the new feature. This is an explanation of the @dasannikov idea.

(I think might be one more possible solution for our internal DEF-2058 issue about retina graphics content workflow)

6 Likes

This sounds great! I’d even go as far as to say that a per-image scale factor in the atlas can be useful for certain pipelines (in case not everything in your atlas needs to be scaled down the same).

2 Likes

Great Idea! And this might have a number of use cases. Take for example, that I buy an asset pack. The artist who created it drew some assets very hi-res, like pickups. As we don’t need pickups of that resolution, we need to scale them down in the editor. And the best place to do it will be to rescale them in the Atlas itself.
Moreover, suppose we want to change scale of some very repetitive sprites. Instead of rescaling them in every game object, we could just change their scale in Atlas and they could be reflected everywhere.
+1 for this feature.

5 Likes

Additionally will be useful to have global scale factor in texture profiles. Just imagine - You can set quality for different atlases for different platform (with full power of texture profiles customization)

For texture profile you can set the max size, so if you want to you can scale the whole texture down by a power of two. Of course you can’t do something like 10% with this.

Yes, but some times 10% of quality lose give double decrease in texture size