Hello Guest

Author Topic: Right size for images  (Read 4669 times)

happy123

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
Right size for images
« on: August 10, 2013, 10:07:02 am »
I am a bit confused on how to set the right image size to import into sprite collection.  I am trying to test with Iphone5  with dimensions 640 x 1136 tall in the editor.  When I got to photoshop and create a png background image 640 x 1136 and import it to the collection, it says the image is too big for the atlas. 

I have tried shrinking the image size to a much smaller size as well.  When I enter play mode in the editor, the image is larger than the preset Iphone5 screen.  I have force resolution preset on the tk2dcamera.  Is there any resources that can give me a good overview how to properly incorporate images with 2dtoolkit for multiple mobile dimensions?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Right size for images
« Reply #1 on: August 10, 2013, 10:29:15 am »
It says the image is too big for the default atlas size (1024x1024).
Increase it to 2048x2048, or use dicing on the texture.

Check out the tk2dCamera tutorial on http://unikronsoftware.com/2dtoolkit/doc/2.10/ for more detail on how you'd deal with multiple resolutions. I don't think you're on tk2d 2.1 either, if you had to force resolution - tk2d 2.1 automatically detects the resolution if you pick a specific resolution in the game window.

happy123

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Right size for images
« Reply #2 on: August 12, 2013, 09:48:55 am »
I am actually on 2.1.   I upgrade from 2.0 just last week.  When I uncheck force resolution, it seems I have to change the preview window selection at least once for it to detect, but when I press play, it automatically goes into force resolution.. Sometime previews at 480x320, sometimes at 320x480.  My preview resolution is 960x640. 

« Last Edit: August 12, 2013, 10:09:32 am by happy123 »

gary-unikronsoftware

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 74
    • View Profile
Re: Right size for images
« Reply #3 on: August 12, 2013, 09:55:30 am »
Hi,

Is your preview (Game) window in 'Free Aspect'?  If so, use the drop-down box to change the resolution of the window and the camera should pick it up.

happy123

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Right size for images
« Reply #4 on: August 12, 2013, 01:15:33 pm »
Hi, it was set to Iphone 5 Tall 9:16.  It seems if I set it to Iphone4 tall, it picks up since there are specified pixels.  However, I am still confused on how to find the right image size for tk2dCamera.. 

For example, now the Native Resolution is 960 x 640 with Preview Resolution of 640x960.  In photoshop, I created a test background with a solid color of size 640x960.  The image resolution is set at 300 pixels per cm.  On the tk2dCamara, the resolution per meter is 1.  It seems like as I set the image resolution higher, the image is smaller when I add it to the game using sprite collection. 

Update: I set the camera and sprite collection to 1 pixel per meter with images scale at Vector3.one.  The preview window looks correct, but when I press the play button, the images are zoomed in (i.e. the become a lot bigger). 

Solved.  Screen scales have to be Vector3.one also...
« Last Edit: August 12, 2013, 01:27:21 pm by happy123 »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Right size for images
« Reply #5 on: August 12, 2013, 01:36:38 pm »
Image resolution in photoshop (300pixels per cm, or whatever) makes absolutely no difference to anything. We're just dealing with pixels here, so that field has no relevance to anything at all.

Try this.
1. Create a background image with size 960x640
2. Create a tk2dCamera, native resolution = 960x640, pixels per meter = anything you like, lets choose 20 for now.
3. Create a sprite collection, set pixels per meter to same as above, so 20. Add your sprite and commit.

In the game window, set the resolution to 960x640 (pick the appropriate iPhone resolution).
Create the sprite from the collection above. It should fill the screen fully.

You don't need to mess with scales, etc. As long as your values are consistent everything will be pixel perfect.