Hello Guest

Author Topic: iPhone 5 texture best practices  (Read 10467 times)

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
iPhone 5 texture best practices
« on: November 13, 2012, 06:59:44 pm »
Hello everybody,

I was wondering if anyone has any tips in regards to the handling of iPhone 5 textures.

To be less vague - up until now, I have developed assuming 1024x768 resolution, and then I was planning on doing some cropping on iPhone - so my textures would remain pixel perfect.

The introduction of the iPhone 5 with the 1136 pixel wide screen changes everything.
Now, as far as I understand, I have two options:

1. Either fit to scale ("fit width") - which will enlarge my 1024 pixel textures a little (I am not sure what is the quality loss here), or
2. Redo my "native" game textures to use 1136 wide, and then crop on iPad and iPhone 4.

As if this isn't enough of a headache, using 1136 as a texture size (e.g. for background) would mean that I have to use an atlas size of 2048x2048, and then I am not sure how it will all work on devices that limit texture size to 1024.

Any insights are appreciated.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iPhone 5 texture best practices
« Reply #1 on: November 13, 2012, 09:44:23 pm »
I feel as though 2 would be better, unless your game is made entirely out of loads and loads of custom backgrounds.

The atlas size isn't an issue really, if you use the platform specific sprite collections (I'll look into that issue you were having later tonight), then use a 1/2 res one for 3GS. Also, don't forget you can use dicing to help make textures smaller, especially backgrounds.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: iPhone 5 texture best practices
« Reply #2 on: November 13, 2012, 10:04:40 pm »
I was afraid of that...

I do not have many backgrounds that will require work, but all my code assumes >1024 is outside of the screen + I have a delicate parallax controller that took me a long time to make it work smoothly on that 1024 wide resolution.

I will have to change a lot of stuff for this to be dynamic based on screen size.

So what you are basically saying is that in all my 2x atlases, I can do one of two things:
1. Allow 2048 atlas size or
2. Continue using 1024 atlas, and split my backgrounds to two, either manually or with dicing.

And in any case, the 1x atlas will automatically be half the size, so it will max at 1024.

Right?

I never used dicing, so am not sure what it can do really, but I am sure I can follow the docs on that.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iPhone 5 texture best practices
« Reply #3 on: November 13, 2012, 10:33:14 pm »
Dicing is quite non-intrusive. It splits your texture up into small bits, and reconstructs it automatically. Well worth a try.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: iPhone 5 texture best practices
« Reply #4 on: November 20, 2012, 12:18:12 pm »
Dicing is awesome!

Such an easy to use feature, and lets me stuff all the bigger textures into smaller atlases. This is my favorite feature of the week.

Small question - will I have any issues with showing a diced texture scaled up (exactly x2)? I mean, will there be noticeable pixel bleeding when my 1024x768 pixel texture be shown on iPad 3 (I am not using platform specific 4x files)

So far, I noticed that in the editor, there is pixel bleeding when I zoom in and out, when in point sampling. In bilinear sampling, it looks perfect as if it is a single texture (this was counter intuitive for me, I expected the opposite).

Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iPhone 5 texture best practices
« Reply #5 on: November 20, 2012, 01:12:22 pm »
when scaling down you are most certainly going to get artefacts. both with point and bilinear.
It should be fine more or less when scaling up...

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: iPhone 5 texture best practices
« Reply #6 on: November 20, 2012, 01:19:01 pm »
Oh.... so what can be done about it?
Should I not use dicing at all with textures that are supposed to scale?

All my textures are expected to scale both up and down...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iPhone 5 texture best practices
« Reply #7 on: November 20, 2012, 01:27:45 pm »
Not a great deal for scaling down. Well scaling down any textures without mips will shimmer loads anyway, this isn't going to make it look a LOT worse.

What kind of artefacts are you getting? Drop me an email with pics. Might be able to recommend something.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: iPhone 5 texture best practices
« Reply #8 on: November 20, 2012, 01:37:38 pm »
Thats the thing - right now I am not getting ANY artifacts.
But before I commit to such approach, I would like to know its limitations.

So far, on my desktop and in the editor, I see no artifacts at all scale levels.
I will try it on the device, and write back if I have artifacts that I cannot eliminate.


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iPhone 5 texture best practices
« Reply #9 on: November 20, 2012, 01:46:21 pm »
Oh right. That's fine then :)

The artefacts you'll get with this aren't much worse than what you'd get scaling a texture without mips down anyway. If you're happy with it normally without mips, then this isn't going to look much worse (you might not even notice anything at all).

If you had mips, that's another story altogether, it WILL look pretty crap along the seams.

Edit: Shouldn't look any different on device, either.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: iPhone 5 texture best practices
« Reply #10 on: November 20, 2012, 01:52:43 pm »
That is so cool then! :)
Thanks.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: iPhone 5 texture best practices
« Reply #11 on: November 23, 2012, 12:23:55 pm »
@unikron - should I worry about performance of a diced sprite?

I found this FAQ post but it does not cover it.

My specific use is just a couple of background images that I prefer to use diced. These only move slowly across the scene, and no color change or scaling is done to them at runtime.

I am dicing to 64x64 cubes - should it have any noticeable impact on performance? Or can I dice with no worries?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iPhone 5 texture best practices
« Reply #12 on: November 23, 2012, 12:42:52 pm »
If you're not animating them and you don't have thousands of them, there isn't much to worry about.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: iPhone 5 texture best practices
« Reply #13 on: November 23, 2012, 12:55:23 pm »
Thats great, thank you.

This dicing feature saves the day for me - makes everything much more compact with what seems to be almost zero negative effects.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iPhone 5 texture best practices
« Reply #14 on: November 23, 2012, 01:22:50 pm »
Yup. I don't promote it enough.