360 spherical camera

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Testur

360 spherical camera

Post by Testur »

Is there a way to simply make a camera take in a 360 spherical view of it's surroundings?
ColeZero
Posts: 20
Joined: Wed Jul 27, 2005 2:33 pm

Post by ColeZero »

Testur

Post by Testur »

That post seems to deal with rotating the camera, not changing it's field of view. How do you figure it will help?
Guest

Post by Guest »

Testur

Post by Testur »

A nice example explaining skyboxes and the like, but I didn't see anything pertaining a camera viewing 360 degrees. Was it something I missed?
Nick_Japan
Posts: 98
Joined: Mon Dec 13, 2004 11:47 am
Location: Japan

Post by Nick_Japan »

Have you tried using ICameraSceneNode->setFOV(2*PI)? Only that might only give you 360 degrees horizontally, but it's somewhere to start. Note that it uses radians
Guest

Post by Guest »

Basically not possible. Even a 180 degree view would be distorted.

Both Direct3D and OpenGL (and probably the software renderer) use linear transformations to map 3D coordinates to screen coordinates.
Correct mapping would use the arctangent of the x and z coordinates. The arctangent is roughly linear only when the angle is small enough (less than approx. 65 degrees IIRC).

Also, since triangles are rendered using linear interpolation between screenmapped vertices, anything beyond a 180 degree view is impossible (without clipping, stuff behind the viewer would be rendered in front of the viewer). This linear interpolation also means that if the FIV is too wide, there's distortion near the edges.

In principle it should be possible to render multiple viewports next to each other, each with a different quadrant of the 360 degree view - and by doing so avoiding the distortion and clipping issues, but you might get some jagged edges at the viewport borders, and I'm not sure Irrlicht even gives you the option of rendering into a viewport.
In any case, it requires rendering multiple times.
Guest

Post by Guest »

(Typo correction to prevent confusion: "that if the FOV " etc.)
Testur

Post by Testur »

Basically, more work than it's worth. :)

Thank you for clearing that out.

-W
Guest

Post by Guest »

or use the panorama method as pointed out prior.
T101
Posts: 44
Joined: Thu Jul 29, 2004 4:41 pm

Post by T101 »

Just like Testur, I don't see that as an option.

It describes how to generate the necessary skybox textures to give the impression of a sky-"sphere" instead of a textured cube.

Presumably Testur's goal was to have dynamic 360 degree views, not prerendered skybox textures. Other than rendering in slices there is no fast option for doing that.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Anonymous wrote:Basically not possible. Even a 180 degree view would be distorted.
Yep, that really a pity. It was the first thing I tried out when I did my first steps with OpenGL and D3D. Raycasters are so much cooler. ;)
Testur

Post by Testur »

T101 wrote:Presumably Testur's goal was to have dynamic 360 degree views, not prerendered skybox textures. Other than rendering in slices there is no fast option for doing that.
Actually, my goal was to use the 360 camera as the base to create on-the-fly reflection maps via Render-To-Texture. Thouht it would have been nice to see your character being reflected in objects in the scene. :)

Now if there would be another way to acomplish this I would sure like to know.
T101
Posts: 44
Joined: Thu Jul 29, 2004 4:41 pm

Post by T101 »

I think the standard way to do reflection maps is to render to a cubemap.
You still have to render 6 times to render that cubemap, but it's doable, and you probably don't need to render with as much detail as you need for the final scene. After all, the reflection map will be distorted by the reflective objects.
Testur

Post by Testur »

But that, as in the previous example, would require a whole lot of cameras.
Post Reply