Hello Guest

Author Topic: How do camera overrides scale?  (Read 4420 times)

TimB

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
How do camera overrides scale?
« on: February 01, 2014, 03:34:09 am »
I know there are tons of posts on supporting multiple resolutions and aspect rations, but there is one thing I don't think I am quite getting.  We are setting up our game in 960x640 and we want to support 960x640, 1136x640 and 2048x1536.  We are going to use 2x assets for the lower devices and 4x for the 2048x1536.  We are using the default override of "Fit Visible". 

On 960x640 it's pixel perfect, on 1136x640 it's pixel perfect, on 2048x1536 it zooms in (or something) so the 960 wide fits the screen with extra space on the top and bottom.  Will 4x assets be pixel perfect with that override, or do we need to adjust the assets to compensate for how the camera is zooming in?

Hope that makes sense.  Thanks for any information.

Siddharth3322

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: How do camera overrides scale?
« Reply #1 on: February 01, 2014, 05:56:15 am »
I want help in same thing. We already discuss the same thing in following post if you grab information and help you then help me. Because at present I can't able to achieve my target.
http://2dtoolkit.com/forum/index.php/topic,3508.0.html

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How do camera overrides scale?
« Reply #2 on: February 01, 2014, 02:49:32 pm »
I know there are tons of posts on supporting multiple resolutions and aspect rations, but there is one thing I don't think I am quite getting.  We are setting up our game in 960x640 and we want to support 960x640, 1136x640 and 2048x1536.  We are going to use 2x assets for the lower devices and 4x for the 2048x1536.  We are using the default override of "Fit Visible". 

On 960x640 it's pixel perfect, on 1136x640 it's pixel perfect, on 2048x1536 it zooms in (or something) so the 960 wide fits the screen with extra space on the top and bottom.  Will 4x assets be pixel perfect with that override, or do we need to adjust the assets to compensate for how the camera is zooming in?

Hope that makes sense.  Thanks for any information.

Those are 2 separate aspect ratios. What do you want to do? If you want it to display pixel perfect at all aspects, try Closest Multiple of Two. That tries to fill the screen. It might be better to start at 1024x768 as the native resolution. on 960x640 it will just clip a little bit. You can also add match by resolution for the overrides if you have a finite number of them, that way you can explicitly scale as you need.

TimB

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: How do camera overrides scale?
« Reply #3 on: February 01, 2014, 05:47:39 pm »
Yes I am trying to display pixel perfect in all aspects ratios.  So, if I use either Closest Multiple of Two, or Fit Visible, that is still not going to give me pixel perfect at 2048x1536 with my 4x assets correct? 

I guess what I'm asking is, since the camera is scaling what is the best way to get my assets pixel perfect at 2048x1536?  How do I know what size assets I need to make so they are pixel perfect at 2048x1536?  Once I figure that out, can I just set them as my 4x assets even though they will not be 4x assests?  I hope I'm making sense.  Thanks

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How do camera overrides scale?
« Reply #4 on: February 03, 2014, 11:45:32 am »
This is what happens.

Native resolution 960x640 -> 1024x768 @ closest power of two, the camera just displays more. This means that if your source image is 1024x768, it will actually fill the screen, with a little being cropped off when displaying at 960x640.

Native resolution 960x640 -> 2048x768 @ closest power of two, the camera scales down by 2x. This means that your 1024x768 image from before would fill the screen. If you had a 2048x1536 2x / 4x variant then that will be the correct size too.

1x and 2x assets are meant to be correct multiples of one another, and if they are they will just work. If you can don't care about clipping that occurs at 960x640, then that is your problem solved.


If you really want to deal with incorrect multiples I suggest adding an additional "platforms" as you see fit. Eg. you can add a 1.2x platform for 1024x768, and a 2.4x platform for 2048x1536 to get everything to scale to the correct sizes. tk2dSystem.assetPlatforms is where this gets defined. This isn't officially supported as its really easy to shoot yourself in the foot, but it does work. What tk2d will try to do is make the images the same size (vertically), you can then use fit vertical on the camera to get everything to work and be pixel perfect. i.e. your 1x, 2x, 1.5x, etc all will be the same size vertically.