View Full Version : Fisheye Projection With an Offset

07-31-2008, 10:42 AM

I am working on a dynamic(ie like fisheye quake, not just a program where I give it 6 static images) fisheye renderer to be used for dome projection. As of now I got the fisheye projection working by using cubemapping.

The issue is that I need to offset the fisheye warping so that when projected into the dome it looks straight from the persons sitting position (as of now it looks straight only when viewed from the perspective of the projector). I have searched long and hard on google and found only this by paul bourke:


I have no idea how he achieved this though. Does anyone have any idea how I could go about offseting my fisheye to achieve sucha distortion?

08-01-2008, 07:25 AM
Just a brainstorming idea, but what about simply:
1. Render scene with 180 degree FOV to FBO.
2. Render some rather simple geometry (see pbourke) with this FBO as texture, and you can tweak texturing and coordinates however you want. It could probably even be done fully within a vertex program.

Using this approach, I really see no need for cubemapping.

Again, it's just a brainstorming idea - I don't know if it could produce a satisfactory result with enough speed.

08-01-2008, 11:21 AM
tamlin, I am surprised you advise doing 180 fov : this is not possible with planar projection.
If you only need a half sphere, you can go with only 5 views instead of 6.

08-01-2008, 11:27 AM
thankyou tamlin, but yes it isn't possible... hence the cube mapping... if anyone comes up with any interesting ideas I would appreciate it.

So far the only thing I could think of is setting the matrixmode to GL_TEXTURE, and using gltranslatef to "simulate" a warping as it is moved across the sphere... but.... while looking "ok" it doesn't seem to achieve the desired affect.

08-01-2008, 12:11 PM
It seems there are more details here, in the section "Offaxis fisheye projection", way down this page :

To implement this in opengl, with fine tuning of distorsions, either you render a tesselated disk with appropriate texture coordinates, either a single full screen quad with an appropriate fragment shader.
The first solution needs quite higly tesselated geometry to work.
The second solution is pixel perfect, but may need more shader processing power, especially if you have high resolution.

And here is some actual code for the off axis formula :
http://news.povray.org/povray.newusers/t...=280553&toff=50 (http://news.povray.org/povray.newusers/thread/%3Cweb.47c36e57f422800a676ba3ea0@news.povray.org%3 E/?ttop=280553&toff=50)

08-02-2008, 12:35 AM
ZbuffeR: /me slaps forehead. I'm also surprised I wrote that. :)

Another (again brainstorming) idea (not helping with the offset problem, but it still could be interesting), would perhaps just 3 views suffice? What if using just three views that intersect eachother - like looking inside a three-sided pyramid?

If possible, pro's would be that one could use a single stencil for all three views that masks the not-used areas outside the "pyramid", and the obvious 5->3 views reduction. A con could be that it might require higher tesselation and some reasonably hairy math to get the result looking ok.