Overscan Cropping Maths
KevinCross
London, UKMember Posts: 1,894
Is there a formula to work out how much a scene is cropped with overscan based on the height and width of the device please? The screenshots in the cookbook are pretty poor and hard to follow. I think I'm really interested in seeing how much of the overscan is off screen.
I'm trying to position an actor at the top of the screen on an iPhone 4S (320x480), iPhone 5 (320x568), and a Kindle Fire HD (800x1280). With overscan on I have to offset the actor by the following on each device when in Landscape:
iPhone 4S = Device.Screen.Height - 10
iPhone 5 = Device.Screen.Height - 30
Kindle Fire HD = Device.Screen.Height - 45
For the life of me I can't see a pattern in order to be able to calculate the offset based on the width and/or height of the device.
At the moment my scene is iPad Landscape size, and the camera resizes to the device screen size. And the actor re-positions itself from the top of the device screen size, not the scene size.
I could roll with the 3 numbers and manually put them in based on the those screen sizes if I can choose to only release it on those 3 devices but I don't know what options there are on the Amazon app store yet, and whether it's possible to only release it on the Kindle Fire HD. Ideally I wouldn't want to restrict myself that much.
I'm trying to position an actor at the top of the screen on an iPhone 4S (320x480), iPhone 5 (320x568), and a Kindle Fire HD (800x1280). With overscan on I have to offset the actor by the following on each device when in Landscape:
iPhone 4S = Device.Screen.Height - 10
iPhone 5 = Device.Screen.Height - 30
Kindle Fire HD = Device.Screen.Height - 45
For the life of me I can't see a pattern in order to be able to calculate the offset based on the width and/or height of the device.
At the moment my scene is iPad Landscape size, and the camera resizes to the device screen size. And the actor re-positions itself from the top of the device screen size, not the scene size.
I could roll with the 3 numbers and manually put them in based on the those screen sizes if I can choose to only release it on those 3 devices but I don't know what options there are on the Amazon app store yet, and whether it's possible to only release it on the Kindle Fire HD. Ideally I wouldn't want to restrict myself that much.
Best Answer
-
tenrdrmer Posts: 9,934It's not based on width and height. It's based on aspect ratios. For example. If your using an iPhone legacy project as the base it's not going to crop anything from any device that is also a 3:2 aspect regardless if its a smaller screen or 4 times larger tablet screen.
And to answer your question no there is no good formula I have seen to calculate for each aspect ratio. You just have to sit down and work out ever aspect ratio you want to support. Your main ones are 16:9 16:10 4:3 and 3:2
But there are also some others that are common enough you should also probably consider.
Also keep in mind GS is working on a stretch to fit option that will just strech which ever direction is short out to fill the whole screen. It gives minor distortion but in most cases I have found it works great and totally worth the time you save in these complex systems you have to build.
Answers
iPhone 4S = Device.Screen.Height - 15
iPhone 5 = Device.Screen.Height - 40
Kindle Fire HD = Device.Screen.Height - 65
iPhone 4 Landscape : scene.Camera.Origin.X = -45 & scene.Camera.size.Width = game.Screen.Size.Width +90
iPhone 5 Landscape : No change
iPad Landscape : scene.Camera.Origin.X = -170 & scene.Camera.size.Width = game.Screen.Size.Width +340
Nook Color Landscape : scene.Camera.Origin.X = -20 & scene.Camera.size.Width = game.Screen.Size.Width +40
Kindle Fire HD Landscape : scene.Camera.Origin.X = -70 & scene.Camera.size.Width = game.Screen.Size.Width +140
I'm too tired now to see if there's a pattern with the origin.x offset and the size of the screen but I will have another look at a later date.
In the mean time this should give me what I need to position actors in place (possibly with percentages) so that they're not cut off in any of those devices with overscan.
EDIT: I'm also hoping that the way I'm doing it now I can position and scale the actors with percentages and without leaving it to GameSalad to stretch and distort them. iPhone 4 to iPhone 5 is a bit of a stretch.