[osg-users] How to simulate camera distortion ?

Björn Blissing bjorn.blissing at vti.se
Fri Dec 8 05:35:13 PST 2017


Hi Jishen,

I did the opposite, i.e. corrected the optical distortion from a captured image. This was done by applying the captured camera image to a plane and then using a fragment shader to rectify the image.

https://github.com/bjornblissing/osgueye/blob/master/src/camerarectification.frag

You could do the opposite, i.e. render your scene to a texture then apply a fragment shader to distort your image according to your camera parameters.

Note that you will have to calculate the correct field of view of the camera you wish to simulate and apply this FoV to your osg::Camera before rendering to the texture.

Cheers,
Björn

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72555#72555







More information about the osg-users mailing list