0
\$\begingroup\$

so I have a simple X animation, and at the end (when it looks like a full X), it looks good on one orthographic size, but bad on another. Here's what it looks like when the size is 3:

X 1

Now you can notice, there are a few pixels that look a bit off, but it still looks pretty good. Here's what it is supposed to look like:

X 2

So if you look closely, it is a bit different, and that's the point. However, if you change the orthographic size to.. say 5, you get this horrid thing:

X 3

Why is Unity doing this, and how can I fix this so that it looks how it's supposed to? Also, in this, my X is upscaled x2. Would it fix it just to have it made to the right size, and then upscaled x1 (e.g none)?

\$\endgroup\$
  • \$\begingroup\$ This is related to "pixel-perfect rendering". If you set your orthographic size to 3, you're showing 6 world units vertically. Let's say at this size each texel in your sprite maps to one pixel on your screen. Now you increase your orthographic size to 5, so you're showing 10 world units over the same number of screen pixels. That means each pixel maps to 10/6 = 1.666666 texels of your sprite. We can't really draw ⅔ of a pixel, so somewhere in the pipe we need to round, skipping a row of sprite texels leading to this distortion. More info \$\endgroup\$ – DMGregory May 17 '18 at 17:12
  • \$\begingroup\$ @DMGregory So, would using a .svg file fix this then, since it uses vectors? Also, would this mean that making the image double the size, rather than upscaling on Unity would fix this? \$\endgroup\$ – CyanCoding May 17 '18 at 17:38
  • \$\begingroup\$ Unity doesn't natively render svgs, but there are options for vector-like rendering, such as constructing a mesh in your desired shape or using a signed distance field texture. Want to edit your question to ask for ways to render your X icon in a resolution-independent fashion? Also, can you clarify whether the stairstep pixelated shape of the X is intentional, or if you'd prefer an antialiased edge? \$\endgroup\$ – DMGregory May 17 '18 at 17:52
  • \$\begingroup\$ @DMGregory Thanks for your help! The stairstep pixelated of the X was intentional, and I won't change the question, since I found that having the filter set to bilinear, rather than point actually made it better, though it is more blurry. \$\endgroup\$ – CyanCoding May 17 '18 at 18:12
  • \$\begingroup\$ Feel free to share that as an answer then. :) It's better to post answers that you can mark "Accepted" so the system knows the issue has been solved - it doesn't see solutions you add via edits. \$\endgroup\$ – DMGregory May 17 '18 at 18:27
0
\$\begingroup\$

I found that this actually worked for me when I set the filter to bilinear, rather than point. It is more blurry that way, but that's fine in this instance.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.