ARKit on different iPhones - sprite-kit

I've been looking for an answer to whether ARKit, specifically ARSCNView, shows the same screen/view/scene size on all devices. I only have an iPhone XS so I am unable to test my ARKit app on other devices.
Currently I am overlaying it with an SKScene from SpriteKit, and in SpriteKit there are 2 different sizes all devices run on.
Through print statements I've been able to find that with the front-facing camera, thus presenting my face on-screen, and overlaying it with an SKScene, that the size of the screen/view/scene/etcetc is 375x812.
Does anyone happen to know if all devices present the same size with ARKit + SpriteKit overlay?

Of course different iPhone models present different resolutions. There's a big difference between iPhone's screen size and viewport size. Look at this table. In some cases viewport size is 1/9 of screen size, sometimes – 1/4. Though, some models have identical screen size and viewport size.
Device
Screen Size
Viewport Size
iPhone 12 Pro Max
1284 x 2778
428 x 926
iPhone X
1125 x 2436
375 x 812
iPhone SE 2
750 x 1334
375 x 667
iPhone 8 Plus
1080 x 1920
414 x 736
iPhone 6s
750 x 1334
375 x 667
For more details, you can read this SO post.
This guide gives you a visual representation.

Related

Compute zoom level based on screen density

I'm experiencing with bing maps in a Xamarin.Forms application targeting Android and iOS.
The same code on 2 devices with different screen size and density shows a very different result:
Android (Moto E4 Plus) 1280 x 720 px / 267 ppp
iOS (iPhone 7 Plus) 1920 x 1080 / 401 ppi
So I'm thinking that I simply need to compute the appropriate zoom level to use when calling map.setView({center: ..., zoom: ... }).
Am I on the right track here? If so how can I compute the zoom level based on the screen density?
Thanks in advance.

Unity Viewport size to Full HD?

at the moment I start with Unity in 2D development for android. Before I develop in Unity i develop with LibGDX where I can the Viewport to a static screen resolution at 1080 * 1920, if the game starts on a smaller device for example 480 * 800 the game still looks pretty good. In Unity when I use a Orthographics Camera and set the width to 1080 and the height to 1920 it looks like a equal long quadrate and not portrait.
How can I use a static Camera which the Viewport is 1080 * 1920 and for other devices unity self charge the resolution for the game?
Sorry for my bad english :(
greetings coco07!
You can't. You're thinking about 2D engines. Unity is a 3D engine with a 2D extension (sort of). You set your camera up (doesn't matter what orthographic size you use), and it gets scaled to the viewport of the device it's running on. the size you set is the size of the viewport, in world units, along the y axis of the device's display. The width is set automatically based on the device's aspect ratio. You can see this by resizing the game window in unity. Doing that causes the visualization of the camera's bounds to change. To create a static camera, you'd have to manually add black borders around the edges (or at least I think you do), OR, better yet, create your game in a manner that runs on all aspects. You should consider aspect ratios between 4:3 and 16:9 for landscape and 3:4 to 9:16 for portrait games. This is specially important since many recent devices use on-screen system buttons (such as the google nexus and Xperia Z series) which means you get an aspect ratio of a little bit less that 16:9 (or a bit more, on tablets). This doesn't sound like much, but if you down-scale a 16:9 image to fit on those devices' screens, it looks ugly as hell.

iPhone display: Are image assets sharper then custom drawing?

The title mostly says it all;
I've got some mockups i am looking at, and as I try to implement them, It seems as though the custom drawing, even with a linewidth of 0.5, is not quite as sharp as the mockup appears when i preview it on my device. Can assets be sharper then what is possible to manually draw using quartz?
Can assets be sharper than what is possible to manually draw using quartz?
No. If that were the case, the iOS graphics system would be spectacularly broken.
Perhaps if you showed your custom drawing code, and an image of what it outputs, we could suggest something. Also, are you working with a "Retina" device?
This is most likely because of the resolution of the screen. The MacBook Pro and iMac without Retina display have approximately 110 pixels per inch and with Retina about 220, whereas the iPhone with Retina has 326 pixels per inch.
When you do coordinates in points and use whole numbers, it is as if the iPhone is 158 pixels per inch (meaning a width of 1 will be 1/158 inches wide) while on your computer it is most likely 110 pixels per inch (which is about 1/110 inches wide). However, since you are using a width of 0.5, a non-retina screen will stay at the same resolution as a width of 1.0 would be, however your device, which is most likely retina, is displaying a line with a width of 0.5 points, which is one pixel.
Because of this, a line with a width of 0.5 points will be 1/326 inches on a Retina device, but will be about 1/110 inches on your computer, which means that the line on the device will be about 3x sharper.

What's the difference between position and positionInPixels

In the past I always see that the property called position and positionInPixels are the same. This time position * 2 == positionInPixels. Who can tell me what's the difference between these 2 properties or when their value will be different?
position is in points and positionInPixels is in pixels. On non-retina device 1 point = 1 pixel. On retina device like iPhone 4/4S and the New iPad, 1 point = 2 pixels.
Per iOS Human Interface Guidelines:
Note: Pixel is the appropriate unit of measurement to use when discussing the size of a device screen or the size of an icon you create in an image-editing application. Point is the appropriate unit of measurement to use when discussing the size of an area that is drawn onscreen.
On a standard-resolution device screen, one point equals one pixel, but other resolutions might dictate a different relationship. On a Retina display, for example, one point equals two pixels.
See "Points Versus Pixels" in View Programming Guide for iOS for a complete discussion of this concept.
position gives you a position in points, whereas positionInPixels gives you the position in pixels. On an iPhone 4, e.g., position can range from (0,0) to (320, 480) (in portrait mode); positionInPixels can range from (0,0) to (640, 960) to reflect the higher resolution its retina display.
Basically, they are different on retina display devices; they are the same on non retina display devices.
Hope this helps...
When you use Retina display your canvas still consists of 320x480 points but each point is composed of 2 pixels. In the standard display each point is one pixel. This is why retina display is more detailed as more pixel data can be used in textures. So position in pixels refers to the position on a specific pixel. (i.e. point 0 can be pixel 0 or pixel 1 in high retina display)

How to draw rullar in iphone sdk?

Hi I want to make rullar in iphone.
Que: How to draw lines through UILabel in scrollView 1 inch. or 1 cm. apart from each other.
I know there are 163 pixels per inch(ppi). in 480-by-320-pixel.
But I am not sure about all version of iPhone .
Does the size of pixels are same for all its model???
Drawing in iOS uses point values rather than pixels; in a retina display there are four pixels (2x2) in a point and in a non-retina display there is one. The screen sizes are the same (with the obvious exception of the iPads). If you draw a line from (0,0) to (0,100) it will be the same length on the screen of the iPhone 4 and iPhone 3GS.