What Pixels/Units ratio should I use?

Im starting to work on a 2d game and i’m wondering what Pixels/Units ratio should I use?
Right now im thinking about using 1 unit / 1 pixel.
For me this is way easier because I dont need to do all the unit to pixel math every time I want to move something etc.

My real questions are:
-Does having more units/pixel decrease Fps? Or it doesn’t affect the render at all?
-Is there any advantages in having for example 100 pixels/unit? (my game doesnt work on any ‘‘tiles’’ sistem so I dont need it for that.)
-My game window size right now is 1920/1080 and Im drawing all the textures for this size, is this okay?

You should try to make sprites be 1 unit in size, in general (naturally this will vary if you have some sprites that are bigger than other sprites). Mostly because of physics (which ideally likes things to be 1 unit), but also because of floating point limitations, where the farther away from the origin you get, the less precision there is. So use whatever pixels to units ratio that makes your sprites be approximately 1 unit big. Not sure why you’d need any pixel math for moving things. Since Unity is a 3D engine, it doesn’t use pixels, it uses units. If you’re hard-coding for 1920x1080, don’t. Your game should work with all resolutions and all aspect ratios.

–Eric

2 Likes

What I really want is pixel perfection (It looks so sharp and nice) This is kinda how I want it to look like http://i.imgur.com/Q3zi38T.png except instead of the current size 1920 x 1080

I was aiming for 1920 x 1080 because that is the largest curent size for pc (except 4k)
and evrything else can be downscaled and still look ok.

Is there any option to have pixel perfection and to work with all resolutions at the same time?
I know I could probably make textures just larger and then downscale them a bit but most of the sprites that im expecting to
use are really big (like the one you see in the screenshot) so I dont really see that as an option.

As you say, you can downscale where needed, so you don’t actually need pixel perfect. Downscaling is normal and looks fine. The entire iPhone 6+ screen is downscaled (2208 x 1242 internally to 1920x1080 for display) and nobody notices. Your screenshot shows art that works especially well with downscaling. 4K and 5K monitors are starting to become more common, and 8K monitors exist (not cheap though). But it’s likely that scaling up will work OK too.

–Eric

1 Like

So I should just make the art bigger all from the beggining and then downscale it?
Wouldnt that take like a LOT of extra memory for the game to run? For example if I make my textures 1.5x bigger thats 2.25 times the memory.

I think aiming for 1920x1080 as the standard is still reasonable at this point. Yes, using larger textures will use more memory. That’s probably why graphics cards these days typically have several GB of VRAM. It might be a good idea, though, to make the textures at a 4K resolution, and scale them down in the Unity import settings. Then you can make a new HD version of the game later, if warranted, and all you have to do is re-import the textures at a higher res. I’ve done something similar myself and it worked out well.

–Eric

1 Like

Thanks for clearing this for me! I guess I will start working on the game now.

-Stef

I know I go on about this a lot, but make sure you adjust the settings for the aspect ratio when you scale the graphics down. Producing source art at a higher resolution and then scaling it down dynamically for different resolutions is a viable approach to the problem. If you’re looking to keep everything looking consistent, you will want to adjust your scaling based on the exact aspect ratio of the targeted display. Scaling it without taking that factor into consideration would result in your output being stretched.

You can just let Unity scale it; in most cases (where you’re not concerned about every single individual pixel) this is fine. It won’t be stretched with different aspect ratios, but what will happen is that there will be more or less stuff visible off to the sides of the camera. What to do about this depends on the game. In some cases it doesn’t affect gameplay so all you have to do is make sure that the camera is displaying what you intend (make sure that backgrounds and so on are wide enough…2:1 monitors do exist…). In some cases you might have to letterbox/pillarbox to force an aspect ratio, but I’d recommend trying to avoid that if possible.

–Eric

Only warning I would give is don’t try to downscale line art. Line art should be built at the resolution you want to use it at. Otherwise lines disappear in the downscaling. Learned that the hard way. It looks really bad when lines are popping in and out as you move your sprite. There are probably artist tricks to avoid this.

Line art downscales just as well as anything else as long as it’s made with the minimum resolution in mind. If you’re making something at 4096 but you know you’ll need to display it at 1024 then you need to draw it keeping in mind that anything thinner than 4px will get filtered out to some degree by the scaling process, just like any other detail smaller than the display resolution would be.

1 Like

Yeah, in my first game I had line art made at 4096 then downscaled it to 32. Imagine the results in your head.

Since then my artist and I have improved our communication and workflow significantly.

1 Like

You could try manually resizing the textures as you load them into memory. I haven’t tried working with mobile devices though so I don’t know how much this would impact load times.

http://docs.unity3d.com/ScriptReference/Texture2D.Resize.html

Keep in mind Texture2D.Resize only resizes the texture; it doesn’t scale any contents, or indeed retain them at all. “After resizing, texture pixels will be undefined.” — The Docs

–Eric

That’s what I get for not paying close enough attention to the wording. On the bright side I just found the code snippet you put on the wiki for scaling the contents of a texture.

http://wiki.unity3d.com/index.php/TextureScale