2048 on iphone 4

I’ve been reading on the forum that newer devices can load a 2048 texture, but I can’t seem to get it to work.

The following code snipet gathers the resolution of the screen and if it’s the resolution of an iphone 4 it sets a material’s texture to use a 2048 texture. In the event of a lower screen res, use a 1024 version.

if (Screen.width * Screen.height == 614400)
{
   someMaterial.SetTexture("_MainTex", ((Texture) Resources.Load("Tex2048")));
}
else
{
   someMaterial.SetTexture("_MainTex", ((Texture) Resources.Load("Tex1024")));
}

When I run this I get a down-res version of the 2048 texture in the editor and a pure white texture on my iPhone 4. Shouldn’t the iPhone 4 be able to use this texture?

sounds like you didn’t configure the import settings correctly cause unity iphone 3 supports it (on Unity iPhone 1.7 you can not get anything higher than 1024)

Using Unity3 and the texture import setting is set to use a 2048.

to be sure, I would recommend to override it there.

generally also check quality settings which in U3 iOS apply as well as docs

I normally opt to not kill my fillrate ie I don’t use 2048 that regularly

I get a lores version in the editor too (on osx, on windows I get the right version), but I do get the 2048 on iPad and iPod Touch 4g… Didn’t have to do anything special to get it to work, so this information is probably not that useful to you…

Actually it is quite useful. I now know:

  1. that it is indeed possible (I still had some doubt)

  2. that the editor does not reflect what will be shown on iPhone4, so I should spend my time testing it on the iPhone4, not trying to get it to work in the editor and assuming that’s how it will look with the retina display.

I have looked into every texture quality setting I can find and they all seem like they should support 2048.

  • The individual texture is now set to override 2048 for iphone
  • Quality Settings has the Texture Quality setting set to full res
  • In Player Settings, Target Resolution is set to HD
  • Random shot in the dark, switching between armv6 and armv6+armv7 does not fix the problem

and graphics emulation is set to the es 2.0 one right not mbxlite? :wink:
naturally with screen resolution of 960x640 if you want to test 4th gen look

the armv6+armv7 isn’t required.

Since you’re checking the screen width/height to determine whether to load your hi res texture, the reason its not working in the editor is probably because you’re not maximizing the viewport and setting it to 960x640 inside Unity. (the viewport itself has to actually be 960x640 on screen or that script will fail).

Nope, I’ve got the window popped out and sized properly. I use this check on a dozen other components and they are all properly functioning at 960x480. The only one not working is the texture at 2048.

leaves the emulation that runs on mbxlite where 2048 will likely not work as pre 3GS does not support such texture sizes either

yeah but that should only affect the editor, not the device, right?

Thats at least what I assume

Tried every type of graphics emulation. All of them show the texture at half res in the editor and white on the device.

Tried the emulation settings as well. It worked for me - but it wasn’t immediate for some reason. At first it wasn’t working, did some other stuff, and then it worked.

Interesting. I found the problem and I think it’s a bug. A 2048x2048 texture shows up properly in the game but a 2048x1024 shows up white. I have many other non-square power of two textures and they all work fine but for some reason it freaks out with a 2048x1024.

was the texture marked as compressed?

RGBA 16 bit. I squared it, used compressed and it worked. I then went back to rectangular RGBA 16 bit and now it’s working O.o

sounds like a very strange import error. But at least, its working :slight_smile: