Hello Guest

Author Topic: Sprite Collection - Difference between explicit size and pixels per meter  (Read 4534 times)

LaserDinosaur

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
Hi

I was building out a button using the sliced sprite component. I noticed though that the edges of the button are quite blurry.

I compared my sprite collection to the one in the tk2d UI demos and noticed that it's sprite collection is using Explicit size instead of pixels per meter. If I flip the UI demo over to pixels per meter (matching the pixels per meter of my camera) it has the same blurring effect.

Explicit:
https://dl.dropboxusercontent.com/u/20830426/tk2dExplicit.png

Pixels Per Meter:
https://dl.dropboxusercontent.com/u/20830426/tk2dPixelPer.png


For now I'm just using two separate sprite collections so it's not a huge deal, but I'm curious what the difference between the two are.

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Just 2 different ways of defining how to fit data into the screen. Explicit describes something like this - (eg. ortho size of 1 at resolution 1024x768) whereas pixels per meter says 100 pixels in your sprite maps to 1 unity unit / meter.

LaserDinosaur

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
So if I understand correctly, explicit is saying render 1:1 with the source file at a fixed resolution, where as pixels-per-meter says render it out using the given scale of 100/1? Would rendering with a pixel-per-meter of 1 have the same effect as setting the explicit size?

Am I at all correct ;D? Is there any situations where one would be better over the other?

Cheers!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
If you use a normal unity orthographic camera, where orthographic size is 10 - creating a sprite collection with explicit ortho size 10, height of 768 will give you sprites which are pixel perfect at that resolution.

If you create a tk2dCamera with 100 pixels per meter, then creating a sprite collection with 100 pixels per meter will create sprites which are pixel perfect at the native resolution of the tk2dCamera.

One nice thing of using pixels per meter, is at 100 ppm, moving objects in pixel increments is easy - just make sure the number is perfectly divisible by 100 and you're good to go. Eg. 1 pixel increment is 0.01 units. Its not the case with an ortho camera.