Hello Guest

Author Topic: Can't seem to render pixels perfectly...  (Read 6153 times)

esdot

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Can't seem to render pixels perfectly...
« on: August 21, 2014, 06:47:26 pm »
We're struggling to make pixel art render correctly....

Here you can see a dither test, in Photoshop, compared to 2dToolkit:


You can see a distinct grid pattern forming on the image due to pixel distortion.

We're using Orthographic camera, with PPM set to 1 on both the camera and the asset. SpriteCollection is set to Point filtering.

No matter what I do, I can't get this Dither to render with perfection :(

esdot

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Can't seem to render pixels perfectly...
« Reply #1 on: August 21, 2014, 08:01:09 pm »
Ok, so after download PixelPerfect from the asset store, and using it's PerfectPixel camera, we can get exactly what we need.
https://www.assetstore.unity3d.com/en/#!/content/14498



Seems to be related to the formula for doing screen scaling. If it doesn't scale by discrete steps, the pixels will get distorted. When you change zoom level, you get the following values for Orthographic Camera Size:
2 = 1.32
3 = .88
4 = .66
5 = .528
etc...


Is there a way to do this with tk2dCamera?
« Last Edit: August 21, 2014, 08:03:34 pm by esdot »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Can't seem to render pixels perfectly...
« Reply #2 on: August 21, 2014, 08:02:59 pm »
Your native resolution isn't the same as preview resolution? Set it to exactly the same numbers, i.e. keep native res = 1024x768, and be sure that the viewport resolution is set to 1024x768 in the game window, AND that you have 1024x768 pixels visible in the game window. I.e. the blue window should be should have a gray border on all sides.

As you can see, the resolution says "704x528" not 1024x768. Your game view is scaled.

esdot

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Can't seem to render pixels perfectly...
« Reply #3 on: August 21, 2014, 08:07:40 pm »
Ya that does fix the issue... but in the real world, the game view will always be scaled, will it not? We need to adjust to devices from 800x400 to 4k monitors, all using Pixel Art...

With PixelPerfect, you can set pixel "zoom level", so we'd simply detect screen size at startup, and assign a zoom level to the camera that will give nice results on that size screen.

With tk2d, I don't see any way to make a dynamic sized camera, that always gives us whole pixels. Overrides seem device specific which is not ideal.


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Can't seem to render pixels perfectly...
« Reply #4 on: August 21, 2014, 08:12:16 pm »
Thats what you use overrides for. Add a wildcard override and set it to pixel perfect for it to be pixel perfect at any resolution.

esdot

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Can't seem to render pixels perfectly...
« Reply #5 on: August 21, 2014, 08:39:21 pm »
Oh I see... It's still not working though.

I had the Dither rendering correctly at 1024x768, and added the Pixel Perfect override.

When I publish the exe, and run at 1080p, it renders like this (zoomed in photoshop)
http://cl.ly/image/1Z2b1q0k1u1K/Image%202014-08-21%20at%201.38.52%20PM.png

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Can't seem to render pixels perfectly...
« Reply #6 on: August 22, 2014, 07:51:56 pm »
Can you post a pic of your overrides panel? Does it render correctly if your published exe is running at 1024x768?