- Home /
Pixel Perfect Camera Component 128 ppu pixel is too zoomed in for builds
I'm making a 2D shooter like Enter the Gungeon, except I'm going full 2D. My camera is set to orthographic, and I have a lot of game sprites that are already drawn at 128 ppu. The trouble that I am facing is that I really like the level of detail that 128 ppu offers, and I want to make the camera pixel-perfect to make the game look crisp, but when I build the game the camera's orthographic size is SUPER zoomed in.
I am aware that there is an equation to calculate the orthographic size that the camera must adhere too > Orthographic Size = Desired Height / (2 * pixels per unit) which results in this behavior, but I would really like to have a way to have the field of view pulled back so the player can see more of his environment and still preserve the pixel-perfect camera or at least just keep it looking "nice". Are there any ways to do this or cleanly scale down all of my art to 64? I've had a lot of art already drawn, and I really don't want to redo it for a lower ppu.
Some details:
All of my sprites are 128 ppu
I attached the pixel-perfect camera component to the camera and set the ppu to 128.
I have tried multiple reference resolutions without success and eventually just left it at 1920x1080 for the time being because I don't know what the ideal resolution should be. I want to keep a 16:9 ratio.
I have tried switching to perspective and zooming out, but that makes it pixel imperfect and causes the sprites to look grainy
I have tried to set the game scale at runtime (which funnily enough makes it look GREAT in the editor mode, preserving pixel quality but expanding the player's field of view), but I think that API is inaccessible
I have tried https://github.com/glowurms/Pixel-Perfect-Camera-With-Zoom-Controls using this, but the zoom functionality only zooms down, it doesn't let you pull the camera back
have tried to resize my sprites in a png format to 64 ppu and set the pixel-perfect to 64 > this has given me the best results but still, there is a loss of quality
My final idea is to convert my sprites to svgs, resize them that way so they "don't" lose quality hopefully, and then convert them back to PNGs, I have no idea if this will work but it's kind of my last hope.
Anyway, any insights or ideas would be greatly appreciated. I don't know anything about pixel art or any tricks so please, anything you've got I'm all ears.
I've attached a comparison to show how zoomed in the camera is in a build (Left), versus the unity editor window which has the game scale set to lower than 1x (Right)
Answer by masta_kamzi · Sep 18, 2020 at 11:20 AM
Hi there! Can you share an example scene with at least one sprite (can be a placeholder but with the same settings) on it? It would be very helpful to this cause.