Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / cylindrical camera

Author
Message
Mr Tank
23
Years of Service
User Offline
Joined: 25th Nov 2002
Location: United Kingdom
Posted: 27th Jul 2006 03:23 Edited at: 28th Jul 2006 04:40
Edited 28 July: new version to download

I made a kind of cylindrical camera by sticking ordinary cameras together. Works quite nicely.

I thought this would be cool for a game played primarily on a horizontal plane- like a rotate and thrust thing, tank game etc. You can change the horizontal fov so it goes up to very large numbers. I capped it to 500 degrees. 180 degrees you can't do with an ordinary perspective camera, and approaching this you get nasty stretching at the edges. With the cylindrical camera you don't. You can go up to 360 degrees and beyond.



In latest version i have tried to make the equations generalised
and have provided comments so that you can change the parameters easily, like number of cameras, display mode, letterboxing etc, and hopefully be able to stick it into a game.

I think it would be interesting in a first person shooter. A person has a perhipheral field of vision of over 180 degrees horizontally, and you don't normally get this in games, but you can do it with this. However, a person cannot look DIRECTLY at something 90 degrees to the side without turning their head, but you can with this. Try "peeking" around the corner of a box, or going through the line- you can check to the side without moving the mouse.

Obviously the more cameras, the less "bumpy" stuff looks (straight lines instead of looking like curved lines look like kinked lines). 10 seems like enough cameras below 180 degrees or so. I figure too many cameras might make it run slow. I haven't experienced significant slowdown, but then my test scene is quite uncomplicated.

I attach a zip with the exe and the source and media. It's 1.9 megs.

Mouselook and mouseclick to move. Arrows to change the angular range. Other parameters can be changed at the start of the prog without too much difficulty i hope.

I'd like to have a spherical camera too, and you can't really do that practically this way. Hope someone finds this useful/interesting.


You'll be able to click on this someday.
RUCCUS
21
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 27th Jul 2006 05:07
Thats really cool, almost like a fish-eye lense effect. Good job!


Projects: Online CTF Game | Newcommer's Guide to FPS's
Mr Tank
23
Years of Service
User Offline
Joined: 25th Nov 2002
Location: United Kingdom
Posted: 27th Jul 2006 06:01
Thanks dude.
BTW i have since edited and you can change the field of view, and the full screen width is now used.
Number of cameras is still fixed, but i will play with this another day.


You'll be able to click on this someday.
JerBil
22
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 27th Jul 2006 07:03
Nice. I got full screen by adding another camera. That is c=0 to 10.

-JerBil

Ad Astra Per Asper
Mr Tank
23
Years of Service
User Offline
Joined: 25th Nov 2002
Location: United Kingdom
Posted: 28th Jul 2006 04:43
Well done. I'm glad someone was able to make sufficient sense of my code to improve on it.

BTW I have updated in post 1. Code is tidier and you can change stuff relatively easily now.


You'll be able to click on this someday.
Essence
23
Years of Service
User Offline
Joined: 12th Oct 2002
Location: The Netherlands
Posted: 10th Aug 2006 13:31
You should use this to make HDRI maps for 3dsmax or something XD

Login to post a reply

Server time is: 2026-06-11 09:56:11
Your offset time is: 2026-06-11 09:56:11