Camera distortion

BlitzMax Forums/MiniB3D Module/Camera distortion

jkrankie(Posted 2010) [#1]
Hi,

My game looks stretched vertically when it's run at a wide screen resolution, so i was wondering what i could do about this.

I've had a look through tcamera.bmx to try to see how the viewport setup works, but it's a little confusing. I'm sure it's a case of changing a number!

Anyone know how to do this, or what i have to change in tcamera.bmx, assuming it is tcamera.bmx i need!?

Cheers
Charlie


SLotman(Posted 2010) [#2]
Look at B3D forum, several hints on what to do about that.

You can use CameraViewPort to set a 4:3 resolution, you can use ScaleEntity on a Camera to remove those edge distortions and there's even a function somewhere called "SetCameraFOV" to set the viewing angle.


jkrankie(Posted 2010) [#3]
Cool, scaling the camera will most likely do. I have noticed that Tsprites are not taking into account the scale of the camera though, which could be an issue...

Cheers
Charlie


ima747(Posted 2010) [#4]
My guess would be you want to tweak the FOV. Odd that you would be seeing vertical (or really any distortion in my experience...) in widescreen... How wide out of curiosity (16:9 or eyefinity style crazy ratio?)


jkrankie(Posted 2010) [#5]
It's a catch all sort of thing i'm trying to do, so widescreen ratios can vary. by scaling the camera i've managed to get the right proportions on all the modes my monitor supports.

Cheers
Charlie


ima747(Posted 2010) [#6]
WTG!

Through my various resolution supporting problems I determined that with standard scale/fov/etc. the screen is always 2 units wide at a distance of 2 units, the height however will change dependent on the aspect ratio, which you can calculate by knowing the graphics context width/height etc. It gets really ugly really fast and I don't really understand my own math, but with that I've managed to wrangle unknown ratios in to line... it translates over to iOS and my Android build of MiniB3D as well, regardless of device orientation or screen size etc. This involves however positioning entities based on the screen ratio, rather than adapting the ratio to handle the elements. I imagine your approach is a lot easier to implement in a normal project. Mine is more interested in positioning things relative to the edges/corners of the screen, rather than a good focal point in the center.

If it's somewhat portable I'd love to see your solution, I'm sure it'll be handy to myself or someone else.


jkrankie(Posted 2010) [#7]
WTG? what's that?

Mine isn't terribly portable, and is only for orthographic cameras with strange zoom levels. It's loosely based on this though, if it helps:

http://www.blitzbasic.com/Community/posts.php?topic=86331#978501

Cheers
Charlie


ima747(Posted 2010) [#8]
Way to go

Aaah ortho, haven't played with those in a while :0)

Last edited 2010


nrasool(Posted 2010) [#9]
Hi there

Could you not use the following to help you out: http://www.blitzbasic.com/codearcs/codearcs.php?code=2707

I've used this with MiniB3D