Skip to main content
gamedev.net
🔒 Locked

fish eye effect

Started by murderv Dec 13, 2008 at 7:55 PM 6 replies 1.2k views
Original Post
murderv
murderv
i've been wondering. how would it be possible to render a scene seen by a fish? with the wide angle eye effect? anyone have done this without using the high FOV hack ?
Matt Aufderheide
Matt Aufderheide
Depending on how you want it to look, you could do something with the vertex shader in post-projection space, like the dual paraboloid mapping basis.

Alternatively you could render the scene as normal and then grab it to a texture, then render a screen-aligned quad, and then displace the texture using a normal map(the normal map would be like a half-sphere, but the edges wouldn't be visible).

murderv
murderv
hi Matt,

i want it to look like this:
http://www.bodhitree.com/gallery/bookstore/images.large/fisheye.side.room.1970.132.jpg

a fish eye look, with the borders aswell, as the image

i tried the paraboloid mapping i found here: http://www.gamedev.net/reference/articles/article2308.asp


i think i could try it and scale a bit so it can occupy all the screen area, but is that the way to go? i've also found there is problems with low poly. for instance in my application i have particles scrolling side to side and when they are in the center of the screen, the top or the paraboloid they get really distorted.

as for your second option. how do u grab the texture in opengl?
i used FBO, but that makes me render the scene twice, one for texture, one as normal.

so as i want to use this effect alot, will it be worth it? i havent tried this approach. im just asking what could be the pro's and con's.

i can think of some pro's. no distortion. based on the heightmap i build i can make the hemisphere look bigger or smoother based on texture.. and maybe some others i cant think of right now =)

ideas are welcome,

thanks
Matt Aufderheide
Matt Aufderheide
I dont know OpenGl, but there must be some way to get the frame buffer without rendering twice, its commonly done in games using OpenGl like Doom3. Try the OpenGl forums.
murderv
murderv
the only way i can think of is glCopyTexSubImage2D
but for what i read it, most cases its better to just render the scene twice that calling this to get the framebuffer.

i will be checking this out aswell the other option you told me about using a heightmap.

i gave it a try but it didnt look too good.. im not much of a graphician, not even for a simple hemisphere =)
psycoding
psycoding
change tghe vertex projection (3d to 2d) from (x,y) *1/z to
(x,y) *1/(sqrt(x*x+y*y+z*z));

gives pretty good results.
InvalidPointer
InvalidPointer
Quote:
Original post by murderv
i've been wondering.

how would it be possible to render a scene seen by a fish?
with the wide angle eye effect?

anyone have done this without using the high FOV hack ?

The high FOV thing isn't a 'hack,' it's actually what's happening in a camera, etc. The fisheye lens captures light from a greater field of view and focuses it on the film.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
murderv
murderv
thanks for your help.

i tried the 1/sqrt() approach and it works ok. i might need to try with some different scenery and see how it looks compared to the paraboloid approach since they look very similar in my tests..

as for the high fov, i havent got anything working correctly with it, it always looks pinched and doesnt seem to get FOV higher than 120 ?

i was looking for a more realistic approach like real camera's lenses, but i think we have atleast 3 ways here that might work for some effects.

on my test list is to create an array of cylinders and make the camera fly around it and see how this effect works out.. see how it handles the curve look that fish eye lens do, which is why i wanted to try this effect at first.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.