Paper2D and Orthographic Width

I have been tinkering around trying to figure out how to get pixel perfect graphics using Paper2D. I’m pretty sure that my issue is that I just need to properly set the ortho width of the camera I am just not sure how to calculate it. Lets say that I had an image that was 1,136×640 (the resolution of the iPhone 5) and that I wanted to display it on a screen that size. How would you go about configuring the camera to display it pixel perfect?

Lets say that I wanted to take that same image and display it on a screen that was 1920x1080 (the screen resolution of the Nexus 5). What is the best way to do that? I understand at this point there would be scaling involved and that would be ok.

tl;dr
What is the best way to go about configuring an orthographic camera for different screen resolutions?

I would like to know this as well.

As far as I know, the Ortho Width property of the camera basically sets the width of the visible scene in unreal units. You need to convert that into pixels. I’m not sure if there is a global conversion value you can use or access somehow. There is a default Pixels Per Unit value in the Paper2D project settings, but that’s just a default value that is set to your newly created sprites. So maybe you’ll just have to decide on a value for your game and hard code that in your camera setup code. E.g. for an iPhone game in portrait mode and a conversion value of 1.28 you would have (640 pixels) / (1.28 pixels/unit) = 500 units of Ortho Width.

I’m not sure about the best workflow for supporting different resolutions either and I hope someone with more experience can answer that for us. Thanks!

AFAIK the resolution is always the native one. Except if you indicate otherwise via profile settings. You can not change this on runtime in mobile (again, from what I know). And I even requested this but it went through the cracks …

This is the only way supported in mobile:

What I’m doing is aiming at an aspect ratio target. So if someone plays in other resolution they will see letterboxes … ugly but enough for me.

I don’t think OP is trying to change the actual render resolution. I certainly am not trying to do that. The native resolution is fine. The problem is with the conversion between pixels and unreal units. This is not a problem in 3D because your texels will almost never actually be the exact size of a screen pixel. There is always some scaling and skewing going on. But in a 2D game it’s desirable to have pixel perfect mapping between texels and pixels to get a sharp result, i.e. a sprite that is 64x64 pixels should actually be rendered onto 64x64 pixels on screen. The question is how to set up your camera and game to achieve this.

Then, if you know your native resolution, just set the ortowidth to match (portrait / landscape) and set unit pixels = 1.0

AFAIK. the camera units are unreal units so if it match the native resolution and unit pixels are 1.0 you should see pixel perfect results.