The 2D Pixel Perfect package contains the Pixel Perfect Camera component which ensures your pixel art remains crisp and clear at different resolutions, and stable in motion.
It is a single component that makes all the calculations needed to scale the viewport with resolution changes, removing the hassle from the user. The user can adjust the definition of the pixel art rendered within the camera viewport through the component settings, as well preview any changes immediately in Game view by using the Run in Edit Mode feature.
Please let us know about your experience with the features.
What worked as expected?
What didn’t?
What workflows did we support correctly and what did we miss?
Feel free to reply to this post or create a new post to discuss your experience.
I bought an asset for this but happy for it to be in the default package. Excited for retro advances. And on that note, when will auto tile sets finally arrive?
This is absolutely incredible! I REALLY enjoy the features here so far! I am immensely happy with it. I am grateful to you guys from the bottom of my heart.
One thing that kinda breaks stuff for me is that the component always returns bilinearly-smoothed image and doesn’t alow us to choose the filtering setting. An option to have the bilinear filtering removed and have it in point mode would be very useful.
What also might be useful is bilinear filtering as it was handled in Sonic Mania. Sonic Mania natively renders in 424x240. If you have a 1280x720 monitor and have Smoothing filter enabled, then the framebuffer would upscale from 424x240 to 1272x720 and only then perform the bilinear filtering. This ensures that even on high-resolutions the picture won’t get too blurry from bilinear filtering.
Also one thing to note: UI rendering needs some workarounds. When rendering in pixel-perfect mode without stretching UI will cut off from that camera. Using overlay is not really an option for me here since it won’t be low-res after that.
Haven’t had time to download and test this yet, but if this only truly supports bilinear output, then I really can’t say I’d use it, since the entire point of most pixel-art styles is to be crisp and clear, not blurry.
There’s the reason behing that. I dug into it and I can see that bilinear filtering only enables if you use stratching to fill in the black bars. By modifying the code you can easily overwrite settings and get point-sampling, e.g. without bilinear filtering.
However, there is a catch. If you stretch your image this way then you’ll get bad pixel placement, e.g. some pixels will be longer than needed on your screen. It may be distracting and it’s especially noticable on resolutions closer to the original rendertexture That’s why the guys enabled the bilinear filtering since it fixes this problem. From here on out you must decide yourself how to handle it, modifying the script is very easy.
Hey, thanks a lot for this, I was working on that very purpose for a month and you heard my prayers Nice to know that there’s a team working on the 2D aspect of Unity as we’re talking
Using this asset for a game I’m currently making, I had just one feedback.
UI scaling : having a way to scale the UI to match the screen resolution would be a next step; I understand it’s an enormous work. Working on it :'D
Other than that it looks very promising, can’t wait to try it with different type of pixel art and games !
Do you mean explicit control over the zoom level of the camera? Currently the zoom level is calculated automatically from your screen resolution and reference resolution.
That’s exactly the reason why we enable bilinear filtering only when you want to fill up the entire screen. If we don’t you will lose pixel perfectness when you screen resolution is not a multiple of the reference resolution.
Hm, nothing special really. It’s set up as a Screen-Space canvas and is being targeted at the game camera. I use “Scale with screen size” option, the values are set to the desired low-res resolution.
Currently you have to manually edit your project manifest to get the package, but later you’ll be able to do this through the Package Manager UI in the editor. We probably won’t make it available automatically for fresh editor installs as it’s not needed for every project.
So the reason of UI being cut is the Canvas Scaler doesn’t take viewport into account when doing canvas scaling, while the Pixel Perfect Camera will modify the VP to crop the frame. Attached is a modified version of Canvas Scaler that should fix the issue for you. Try replacing the built-in Canvas Scaler with this one and let me know if it works for your setup. I also talked to the UI team to let them consider making this viewport-aware scaler a built-in functionality.