Hi,
I promise I searched for other threads about this and found no answer.
Is using textures with dimensions that are powers of two important? What are the performance and/or quality risks involved in not using power of two textures?
Hi,
I promise I searched for other threads about this and found no answer.
Is using textures with dimensions that are powers of two important? What are the performance and/or quality risks involved in not using power of two textures?
Your images do not need to be power of two. When we convert the image to a texture, we make the texture a power of two for you. This means that a 65 x 129 pixel image will end up being a 128 x 256 texture so its not as memory efficient as a 63 x 127 would be. Is this a big deal? I guess it depends on how many images you’re dealing with.
Rob
No, it is not important your image can be 128 by 128 or 134 by 134, I have not seen any performance effects involved with this.
It can be a performance impact. A 128x128 is 64Kbytes of memory. A 134x134 is 256Kbytes of memory – 4 x as much. Now most mobile devices depending on age, total RAM, how big the OS is will vary the amount of available memory. Most people start reporting issues around the 100mb range (though that would likely be higher on new devices). So to keep the math easy, lets say you have 64 Megabytes of RAM free. It would take 65,536 128x128 images to fill up your memory where you would start seeing performance problems but only 16,384 134x134 images before you hit the same capacity.
Also consider if you’re using @2x and @4x images. Newer devices have more RAM, but they need higher resolution images to do the work. If you’re on a device that’s using @2x images, then you’re image takes up 4X the RAM, but the newer device may not have made 4X the RAM available.
For many games the amount of smaller images on the screen (hero, enemies, bullets, pickups, etc.) at one given time are not going to add up to much. Now make it a tile based game, you’re increasing the number of images to make up the background and game board, so making those PoT makes sense. Backgrounds in particular if you’re layering multiple depths of background will chunk through memory in a hurry. If they are sized close to a PoT value, I’d maybe make them fit if possible.
Thank you. That is very helpful.
Your images do not need to be power of two. When we convert the image to a texture, we make the texture a power of two for you. This means that a 65 x 129 pixel image will end up being a 128 x 256 texture so its not as memory efficient as a 63 x 127 would be. Is this a big deal? I guess it depends on how many images you’re dealing with.
Rob
No, it is not important your image can be 128 by 128 or 134 by 134, I have not seen any performance effects involved with this.
It can be a performance impact. A 128x128 is 64Kbytes of memory. A 134x134 is 256Kbytes of memory – 4 x as much. Now most mobile devices depending on age, total RAM, how big the OS is will vary the amount of available memory. Most people start reporting issues around the 100mb range (though that would likely be higher on new devices). So to keep the math easy, lets say you have 64 Megabytes of RAM free. It would take 65,536 128x128 images to fill up your memory where you would start seeing performance problems but only 16,384 134x134 images before you hit the same capacity.
Also consider if you’re using @2x and @4x images. Newer devices have more RAM, but they need higher resolution images to do the work. If you’re on a device that’s using @2x images, then you’re image takes up 4X the RAM, but the newer device may not have made 4X the RAM available.
For many games the amount of smaller images on the screen (hero, enemies, bullets, pickups, etc.) at one given time are not going to add up to much. Now make it a tile based game, you’re increasing the number of images to make up the background and game board, so making those PoT makes sense. Backgrounds in particular if you’re layering multiple depths of background will chunk through memory in a hurry. If they are sized close to a PoT value, I’d maybe make them fit if possible.
Thank you. That is very helpful.