Domanda

Its a common practice to use Atlases / Spritesheets to reduce connection overheads for web-based games and also, I have read about using sprites with a power of 2, which is useful both for memory as well as mipmapping (not sure if this was for web-based games).

However, does the same principle (of mipmapping) applies to Atlases? Basically, Should my Atlas be of size which is a power of 2 or should it (power of 2 rule) be applicable for the individual images it contain?

È stato utile?

Soluzione

The general answer is that it depends on the engine you are using. Some engines require power-of-two textures for the reasons you stated in your question. And since an atlas is really nothing but a texture, it holds to this rule.

Again, depending on the engine, the various sprites in your atlas may need to also be power-of-two (this is the so-called "grid system" for spritesheets). But I have worked with engines that don't care, as long as the atlas itself is power-of-two.

Web-Based Games

For web-based games in particular, just from personal experience I have never had to worry about power-of-two. I just made my images whatever size they needed to be. This makes sense because:

  1. It's the web :)
  2. Padding images to powers of two increases file size and therefore bandwidth usage (though not by much)

I think (could be wrong though) most JavaScript engines don't care about power-of-two.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top