Archived

This topic is now archived and is closed to further replies.

camera lens effects in opengl

This topic is 5502 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, this is sort of a cross-post from the General Programming forum, but it kinda didn''t get any answers there - maybe people here can say a little bit more on the subject... Anyway - I''d like to look into creating camera lens effects (fisheye, bugeye, etc.) you can occasionally come across in games. If I remember correctly, Dungeon Keeper had a fancy, cool-looking lens effect if you possessed the Fly. I''ve searched the web quite throughly now and I''ve come up with a couple of dry tutes on the subject, but I''d like to have something to look at and mess around with instead of just the theory. I''m looking for source code, or sample projects and such. There''s a "but", however - nVidia, for instance, has a fisheye lens sample using vertex shaders which are not supported on my Jurassic video card, so I''d like to find something that wouldn''t be using extensions at all (or very basic ones at most)... Thanks in advance, Crispy

Share this post


Link to post
Share on other sites
The most simple, yet not so bad effect is simply increasing the fov (field of view) of your projection matrix.
An human eye normally has ~60 degrees fov, and if you set something muh bigger you can have weird views.
And note that you can set different, non-orthogonal, field of views for X and Y and get even better effects.
That''s what is used for Aliens'' view in Alien vs Predator game.

Share this post


Link to post
Share on other sites
Thanks for the replies.

quote:
Original post by ReKleSS
Well, I don''t actually have anything constructive to say, because I''m not good with this... but yes, Dungeon Keeper did use a FOV effect for the fly''s view.


Are you sure about that? I mean it did look quite complex back then... nVidia does have a demo of the fisheye lens effect using vertex shaders - I don''t think it''s half as complex to achieve as the fly effect (nevertheless it''s done through extensions rather than simple view distortion)... Then again - I''m just guessing.

I have been messing around with fow, though, and I must admit it does allow you to create some fancy effects... Maybe with more experimenting I''ll come across something weird enough for my project

Crispy

Share this post


Link to post
Share on other sites
quote:
Original post by vincoof
An human eye normally has ~60 degrees fov,

correct. but I think with both eyes the human fov gets to something like 90 degrees... don''t remmember exactly thou



-----------------------------

DaHeR.RailgunMaster

Share this post


Link to post
Share on other sites
quote:
Original post by daher
correct. but I think with both eyes the human fov gets to something like 90 degrees... don''t remmember exactly thou


but rember that the ability to actualy see something clearly does not come anywhere close to 90 degrees.


PS: your best bet for a "fly" effect in OpenGL is to use the rendered scene as a texture and texture map it onto each face of a low-poly half-sphere over the camera.

Do not meddle in the affairs of moderators, for they are subtle and quick to anger.


ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Go FAQ yourself ]

Share this post


Link to post
Share on other sites
quote:
Original post by daher
[quote]Original post by vincoof
An human eye normally has ~60 degrees fov,

correct. but I think with both eyes the human fov gets to something like 90 degrees... don''t remmember exactly thou



-----------------------------

DaHeR.RailgunMaster


I think you''d have to look into the stereo effect if you really want to have the correct illusion of perspective, although you can never beat the real thing... Besides - a 90 degree fov would result in twice the bandwidth use than the normally used 45 degree fov - something to keep in mind when you''re go for speed - not that it matters too much on today''s hardware, even with quadruple AA enabled...

Crispy

Share this post


Link to post
Share on other sites
quote:
Original post by Andrew Russell
PS: your best bet for a "fly" effect in OpenGL is to use the rendered scene as a texture and texture map it onto each face of a low-poly half-sphere over the camera.



Thanks!! - the first really constructive reply. Gonna try it out.

quote:
Original post by Andrew Russell
but rember that the ability to actualy see something clearly does not come anywhere close to 90 degrees.



And besides - if you push the fov too much (make it too wide or too steep), you''ll end up with double distortion - the distortion from the projection onto the monitor screen (as it''s generally flat or near-flat), and the distortion your own eyes add to it - imagine squeezing these 90 degrees into mere ~30 that the screen occupies of your actual field of vision... A ~45 degree fov, is therefore least distorted (and thus most realistic), unless you really want to mess up the picture (which I''m trying to do currently), or unless you have a VR helmet that can do some fancy adjustments to actually put you inside the scene...

Crispy

Share this post


Link to post
Share on other sites