Hello Guest

Author Topic: One pixel high image gets doubled in height  (Read 3641 times)

Ngapi

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
One pixel high image gets doubled in height
« on: October 01, 2014, 05:41:23 pm »
Hey forum,

I've run into an issue with one pixel high images in a sprite collection. When I add a sprite to my scene with this image, the sprite shows up as two pixels high, like it stretched the image to twice its height. It appears this way both in the scene window and the game window.

The sprite collection is set to use point sampling for the filter mode. My tk2dCamera is set to use one pixel per meter.

Here's a sample image that results in the problem (one pixel high, so it's probably hard to see!):


Here's a screenshot of the scene view with the image zoomed way in. The image appears twice as tall as intended:


I can also email a zip of the project if that's useful. Thanks!

- Gabe


Ngapi

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: One pixel high image gets doubled in height
« Reply #1 on: October 01, 2014, 05:47:26 pm »
Sorry, forgot to mention versions of things:

Unity 4.5.1f3 on Mac OS X 10.9.2
2D Toolkit 2.4.0

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: One pixel high image gets doubled in height
« Reply #2 on: October 02, 2014, 11:11:22 am »
Minimum texture size in Unity is 2x2. If you drop a 1x1 in there, it gets resized to 2x2. If you really need a 1x1 for whatever reason, add a 2x2 texture and in the sprite collection editor set the scale for that one sprite to 0.5, 0.5, 0.5. Your sprite in the scene will then be an equivalent of 1x1.

Ngapi

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: One pixel high image gets doubled in height
« Reply #3 on: October 02, 2014, 03:23:31 pm »
Thanks! Always something new to learn.... Sounds then like textures actually have a minimum of 2px in either width or height. Another workaround I found is to make a 2px high texture with one row of pixels transparent, so I get the effect of a 1px high image. (That does leave a little bit of wasted storage I guess.) Thanks again, the quick turnaround on this forum is great,

- Gabe