- Home /
What Resolution to draw sprites for Mobile game??
Hey everyone,
I'm really confused what resolution to use for some environmental sprites I'm using for a 2D endless runner game for mobile. Currently I'm using 400 ppi for most environmental sprites such as rocks, trees sizes 512x512 and 1024x1024 (etc..). These are only pooled every once in a while. Also currently my character's body part images for a skeletal animation have a resolution of ~ 1000 ppi.
I heard that I need to 72 dpi for my sprites, but isn't that more for pixelated games? I'm trying to have an HD game to play on newer generation phones (Current and previous 4 generations).
I'm just not sure what to use for mobile?
I'm sorry I'm still a beginner so I'm not sure how to optimize for graphics for mobile.
Thanks
Answer by robnw · Jun 13, 2019 at 02:13 AM
Common question, but a convoluted one. :) A single pixel in Unity has no fixed size. If you have a character that is 16p x 16p pixel resolution, she can take up any amount of world space that she wants via Transform scaling. You may ask, "but how many pixels will this take up on-screen?", well, that's where "camera space" comes in. You never have to worry about exact resolution of a screen or display.
All you worry about is how much the player can "see" of the world space, and you do this by scaling the camera viewport. Your camera can render 10000mx10000m in the game (you couldn't even see a 1mx2m character), but that display will still render 1920x1080 resolution. And vice versa, 1mx1m camera viewport is still 1920x1080 on the display. You can only control how much your camera can see, and this changes the "size" of a sprite on camera (in camera space), which in turn changes the exact pixels of the sprite.
And likewise, if you have your 10km camera rendering 1mx2m characters, you can scale those characters up so the camera can see them. You can make your 2m tall character 5kmx10km tall. Now she takes up 1/4th of the screen. In other words, the pixels don't matter. Only the world space and how much of that you camera can see matters.
So, if you need sprite sizes, you say "32x32 characters, bushes should be half that size, and ogres should be twice that size" and be done with it. Because after that, you are simply adjusting the camera and scaling your sprites so that they look good on the camera.
(Unity has a package for nice pixel cameras here, also make sure you choose the right filtering for your sprite images - should be point filtering - otherwise scaling the image up will cause blur)