Fun with cylinders.

Posted by Scott_AW on Oct. 5, 2007, 4:07 a.m.

So I started working on a quick engine for an old game idea with some new flair. I still can't find the original which is a shame.

Anyway it is rather simple, you can download the test here.

All it is really, is a camera placed in a oval shaped cylinder with a two panoramic rendered scenes as a texture.

That texture looks like this little image, scaled down from 1024x1024.

Using pov-ray's panoramic camera function I can capture a curved 180 degree field of view. By rendering the front and then back of the scene, then splicing the two in a image program I create a texture to be bent around a cylinder.

The images are rendered at 512x1024 so they can be combined to create a square texture. Anti-aliasing is also enabled so that no jagged lines are created, or at least they're softer looking.

The cylinder is squished into an oval due to inevitable distortion caused by the camera effect, making the connecting walls look longer even though they are the same.

I know its not perfect, you can tell there is some bending but its pretty good for such simple code.

The room speed is set to 120 and the fps is located in the caption of the window so you can tell how fast its running. I don't plan on making the game engine much more complex aside from some mouse to point detection that I plan on using with either a hidden image map or predefined paths that depend on mouse location and camera direction.

Comments

Myth 17 years, 1 month ago

Very nice, gives me a few good ideas.

And it runs at 100-120 fps (i had a lot of background programs…)

marbs 17 years, 1 month ago

Clever idea. It looked slightly distorted at the top, but other than that, great :]

DesertFox 17 years, 1 month ago

Heh - panoramic stuff is fun.

Scott_AW 17 years, 1 month ago

Hopefully I can find a solution to the distortion, but else-wise its not too much of a problem. Its a pretty simple process so feel free to emulate it, would be great for any Myst styled game. However the textures are about a meg a piece so a finished game would be rather large.