Game Development Community

Full screen image issues

by Richard Skala · in iTorque 2D · 07/30/2010 (12:00 am) · 8 replies

I have an artist creating PNG images which, according to these forums, should be in sizes which are powers of two (e.g. 16, 32, 64, 128, etc.). However, for textures that need to take up the entire screen (i.e. 320x480), how do you avoid getting the textures becoming distorted if you're using one that is, say, 128x256?

I read on these forums that using too many images that are NOT powers of two will increase your loading times, and in fact, we've added multiple 320x480 images, and the loading times are now so long that a Distribution build will not even run on an older iPod Touch. (I have Preload OFF for all textures, by the way.)

How do people generally handle full-screen textures while keeping images at powers of two?

Also, is it more efficient to have a 320x480 image or a 512x512 image? (I read that a 320x480 image will automatically be resized to 512x512.)

Please understand that I am not an artist, and I am barely familiar with Photoshop, so I apologize if these questions seem obvious or trivial.

Thanks.

#1
07/30/2010 (12:50 am)
the reason it crashes on older ipod touches is that you fill it with too much memory. a 512x512 is 1.3mb of RAM and the same on VRAM if you don't use PVR. So to answer that: yes it will be resized, non pot sidelengths aren't supported on the iphone prior to OS 3.1.x and devices of 3GS+ and even then only if the corresponding OpenGL ES Extension is used
#2
07/30/2010 (2:35 am)
Thanks for your response. I haven't been using PVR textures at all. What is the recommended PVR compression tool for MacOSX? I found this on the forums (PVRTexTool):

www.imgtec.com/PowerVR/insider/powervr-pvrtextool.asp
#3
07/30/2010 (2:48 am)
Also, I just thought of this regarding full-screen (320x480) images without distortion and keeping it POT:

- Create a 256x256 texture.
- Only use the inner 160x240 for the full-screen image/object (so it essentially has a border around the usable part).
- Create the Torque static sprite and resize it to 512x512.
- The inner image will now essentially be 320x480.

Since the image will be scaled, enabling Smoothing will probably help in this case (I generally try to avoid Smoothing).

Note: My current version of Torque has a bug where objects 512 units or larger cannot be selected or displayed, so I would need to resize the object to 511x511.
#4
07/30/2010 (3:22 am)
on osx you normally use the one that comes with the iphone sdk which is command line.
there are threads here and some docs on it in the sdk :)
#5
07/30/2010 (3:38 am)
RSKull, I use one full screen image per level as a background image. What I do is to create a 512x512 image, and then only use a 480x320 portion of it. I then PVR the 512x512 image, and I extract the 480x320 image using SourceRect. The 480x320 part of the image then retains it's original scaling.

There may be better solutions, but this one seems to work ok on older devices also. I would definitely recommend using PVR because it does shrink the image by a lot, and there is very little loss in image quality if you use 4 BPP.

#6
07/30/2010 (4:39 am)
BTW, if you create a 320x480 image it doesn't get re-scaled to 512x512. The original image will remain the same, but it will get padded out to 512x512 with basically empty space around the edges. So it wastes a bit of memory, but it will retain it's original scaling, and it won't get distorted.
#7
07/30/2010 (7:39 am)
I do exactly the same as Mark. Also don't forget that your background image doesn't need the alpha channel.
#8
08/01/2010 (6:54 am)
Hey Scott, it is me who does the same as you. I followed your advice on how to implement full screen images and I've not had any problems with your solution. It works flawlessly on older devices (1st generation iPods) also.

Actually, I was quite lucky in the sense that I discovered your optimisation thread just as I was beginning my own development. I've bascially followed your suggestions from day 1, and I've not had many issues when it comes to performance. I do most of my development on the PC, but as I've followed your advice with my initial designs I've not had any performance related issues when I've downloaded it to the device. Most of the time the game has worked first time.

I think it would be great if you, are we, or whoever wants to contribute, could develop a resource that describes best practices when it comes to developing an iPhone game. I think if beginners will follow certain rules, they really shouldn't have any drastic preformance issues when they eventually run their game on the device. I didn't have any problems, and I have no prior experience working on games. I just followed what guys like you were saying, and used common sense, and that has worked for me so far.