Attempting to make ‘Defined/sharp’ 2d pixel game unity can bring headaches.
You have to manually alter and/or make scripts for the camera to just get your game pixel perfect and that’s a 50/50 because unity’s way of rendering is vast. Also if you add and overriding script to the camera you will also have to change the whole way you make art in the future for your game so you can match the settings of the override.
Orrrrrrrr
Simply changing the filter for your sprites…
Now i wish Unity’s point filter would be better suited for 2D pixels but it isn’t
Point vs Bilinear (dont mind the dead black pixels around the one running)
so with unitys point filter mode it preserves the hard edges and make it look beautiful but mishapes pixels in the sprite (like the eyes) and gets worse while character moves or a change in resolution.
This only goes for some artwork, some can run their sprites under their pixel art and nothing will happen but if your’e making your pixel art like this… I don’t think you will be able to use unity’s settings to match your art or even attempt to alter the camera trust me ive tried.
As much as i wish my game will be pixel perfect and clean cut, i dont think there is a fix without totally destroying the perspective view point on the game. Besides, bilinear filter mode doesnt cut down the quality that much. itll save me further headaches in the future.
What are your guys opinion?
bilinear cuts the quality but with point i might deal with further pixel disasters later.
P.S.
As artwork goes, im going for a Super Time Force theme just more defined…
also vote to make Unity more friendly to pixel art!
http://feedback.unity3d.com/suggestions/pixelperfect-2d-mode
You said that “i dont think there is a fix without totally destroying the perspective view point on the game”. Are you using a 3D camera instead of a 2D orthographic camera?
The artifacts that you describe when using point-filtering is due to the fact that your screen resolution and asset resolution don’t match. You’ll have to make sure that each texture pixel gets rendered to an integer amount of screen pixels.
I have created a simple free camera script that adjusts the orthographic camera’s size so that textures get rendered in a pixel-perfect way in every resolution. You can get it for free from the asset store and check out this HTML5 demo.
This isn’t all really unity’s fault per-se. There’s reasons why this stuff happens.
For example, if you are using nearest-neighbor filtering, you need to have one pixel in your texture for every pixel in the sprite, according to the pixel size that it shows on the screen. You can get that perfect 1:1 match. But it also then means that you need to always position your sprite at exact WHOLE INTEGER coordinates. If you try putting it at fractional/floating-point coordinates you are ASKING for the system to actually start the sprite at different coords, which will affect the way the pixels are spread across the image. Also note with Unity’s sprite shader if you use the ‘vertex snap’ option it will attempt to round individual vertex coordinates to the nearest whole integer, BUT it does it individually for each vertex, so depending on floating point errors (which can’t be avoided really, the graphics API’s require floats), you could actually stretch or shrink your sprite by 1 pixel depending on the coordinates, causing a flicker/jiggle. Vertex snapping is a bit ill conceived that way. All vertices should be rounded together. Also note if you try to put your sprite at exact integer coords you will still have trouble because internally the vertex data is still floats and some integers are harder to represent exactly in float format.
When it comes to the bilinear filter, you only get a softening of edges etc when you’re trying to spread the texture pixels (texels) over the edges of a real pixel, ie you are using floating point coords or vertex snap. Bilinear will eradicate the shimmer much better, but still there will be issues due to floating point etc. At best it’s kind of a hack for 2d.
When it comes to other resolutions, this isn’t really Unity’s fault either. It’s just the fact that if you want the same sprite, which is a grid, to be scaled up by some non-multiple amount, ie floating point amount, so that it covers more real pixels, and if you’re using nearest neighbor, then you absolutely are guaranteed that some pixels will be doubled while others will seem to remain single-pixel size. That’s just down to how nearest neighbor works… some columns/rows get doubled if you’re at like 1.5x the resolution. And it different depending on the resolution because that changes the ratio of doubled verses non-doubled columns and rows. If you really want perfect pixels at a whole bunch of resolutions you will have to settle either for making uniqiue graphics for every resolution, or sticking only to resolutions that are exact doubles horizontally and vertically (e.g. 1920x1080 and 960x540), or 2048 vs 1024, or you will have to settle for re-using the same texture data and have it stretch to fit how many pixels there are, which WILL produce some kind of artefacts if you don’t want to use bilinear filtering, even with integer coordinates. It has to. Its how the hardware works. It’s logical. You can stretch one grid over another grid and have whole integer cell sizes and expect there to not have to be an unusual number of extra cells added.
It helps if you’re targeting a given device with a known res e.g. iPad is pretty nice with 1024 or 2048. But changes in phones and PC monitors is complex. Maybe you should make it for AppleTv so that you only have to deal with 1920x1080. Or narrow down what resolutions you will allow people to use on a PC. Either this or you’re going to have to come up with some funky custom shader and realtime updated vertex coordinates that you precisely calculate and prune yourself to always maintain the exact sprite size.
1 Like
Holy cows. We have now necro’d I think every thread on pixel perfection that has ever been posted on these forums!
@Douvantzis should change his handle to ThreadNecromancer. 
3 Likes
Did I miss any thread?
lol
Actually I wanted to change my handle but I don’t think it’s possible.
1 Like
Sorry, it was my turn and I didn’t have any other card to play.

2 Likes
Lol!
Come on! It’s less that a year old!
Seriously, reading all the threads I think that there’s a lot of confusion about how to set-up a 2D project correctly. Even this post does not cover all the details.
2 Likes
Yea, I definitely agree there.
I personally have no problem with necro-ing threads. In fact, I encourage it so that we don’t end up having a thousand threads about the exact same thing. IMO, the entire idea of necro-ing being taboo is asinine & counter-intelligent. Personally, I despise people who act snobby about it.
I just liked the card & the joke 
I appreciate your thorough coverage.
After all, most of these threads are found through google searches that give results of year-old threads with out-dated information. The more there are, the more spam you gotta sift through to find the newest one. And who knows which one will be the result of someone looking for an answer? Best to cover them all at once. Really, a forum should encourage consolidating all threads into an omega-thread based on that subject, maybe via a system of tags & moderation, or simply by moving them when they’re creating.
1 Like
Yeah, actually, I’m with you about necro-ing in general… I’ve just never logged in and seen an entire army of zombie threads at once, is all.
But that card is awesome, and totally made my day!
3 Likes