Hello Guest

Author Topic: getting actual size from my images  (Read 5216 times)

peterbrinson

  • Newbie
  • *
  • Posts: 9
    • View Profile
getting actual size from my images
« on: May 17, 2013, 06:27:02 pm »
Dear Unikron,

I know you’ve explained this over and over, but I want to review for my understanding.  I want my 2d art to appear in the game as “actual size”.  I’ve chosen 1920x1080 as my ideal resolution. 

- Previously I naively made my levels with an arbitary orthographic size on my camera before I understood how all of this works.  That size value is 22.  I don't want to have to completely resize all my levels based on my mistake.

- (From people who don’t use 2dToolKit) I’ve heard how I should have made my orthographic size 540 (based on a 1080 pixel height) and built my level from there.  But 2dtoolkit is going to save me from fully revamping my level, right?!?

- I’m ready to fix my mess.  With my sprites’ scale set to 1, I would like my textures (tk2dSprites) to show up at their actual size.  I should be able to go in to my Sprite Collections settings and set “Target Size” to 1080 and “Target Ortho Size” to 22?

- Then all my sizing concerns should happen in Photoshop, so that I can have confidence that my textures as exactly as big as I want them to be (for 1920x1080)

Am I understanding this?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: getting actual size from my images
« Reply #1 on: May 17, 2013, 06:42:11 pm »
I think its not immediately obvious that you can use ANY sprite collections size settings, and get it to display correctly at ANY resolution. Everything is relative to one another, and you can adjust one thing to compensate for another. I should write an article about it sometime. The only time scale really matters is when you're using the default physics settings, but even that can be tweaked :)

Maybe after tk2d 2.0 is out.

1. How is your sprite collection set up right now? What is the ortho size (22?) and what is the target height?
2. How is your camera set up? What is the orthographic size?
3. What resolution are you planning on running the game on (1920x1080)?




peterbrinson

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: getting actual size from my images
« Reply #2 on: May 18, 2013, 03:38:58 am »
The main point is that I did some decent level design before I considered the situation and I'd rather not have to scale my world way up.  It would be a pain mostly with my code.

- I have a lot of think lines in the art and I've done some tests at "actual size" (and targeting 1920x1080) and these lines look great compared to my arbitrary settings.
- I'd like to target 1920x1080.  At lower resolutions I think it's reasonable to expect things to look a little "aliased" anyway
- I made a mess, so my current camera is ortho 22
- My sprites are at an X and Y scale of 11. 
- My Sprite Collection setting is - Target Height = 640;  Target Ortho Size = 1 (I'm guessing a default as I just looked into this)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: getting actual size from my images
« Reply #3 on: May 18, 2013, 09:16:12 am »
You don't have to make the world any bigger than it is. My point is, you can change the camera to work any way you like it to.

1. You want this to run at a native resolution of 1920x1080. Scaling down (and looking aliased) is automatic, so no need to worry about that there.
2. The only thing that matters (and remains constant) is the sprite size. With how you have it set up, your sprites are far from pixel perfect, so you'll get a lot of weirdness with lines, etc.
3. Since nothing else can and needs to change, the only thing you really need to care about is the orthographic size of the camera you're using.

Don't change ANY scales anywhere, or any sprite collection settings.
Change the ortho size on your camera to 18.5625. This should give you pixel perfect results.

How you come up with this number -
Normally, the physical size of objects on screen = (2 * targetOrthoSize / targetHeight); But you're scaling it up by 11x.
So...
One unit = .034375
Now rescaling that to fit the new resolution -> v * 1080 / 2 = 18.5625


peterbrinson

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: getting actual size from my images
« Reply #4 on: May 18, 2013, 04:28:55 pm »
I'm certain your math is right, but decreasing the ortho size naturally brings our view much closer to the world.  I like how everything is laid out and looks (except for the pixel issue I'm raising). 

Could I instead scale down my textures (source files) by the same proportion you brought down the camera ortho size? This way we see the same slice of the world but we can get pixel perfect?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: getting actual size from my images
« Reply #5 on: May 18, 2013, 09:38:47 pm »
I've got a feeling we're not exactly talking about the same thing here. If you could email support at unikronsoftware dot com, with an image or two of what you're trying to do - and hopefully that'll make a bit more sense to me, and I might be able to help more precisely.