barrel distortion without post processing

I can’t find any examples of barrel distortion that create the effect in camera (not by stretching the rendered image like an effect in Photoshop.)

The Fresnel lenses I use for VR have very minimal chromatic distortion. There’s no need to hog the graphics card with image post processing for every stereo render.

I see this does something to the image:


import bge
scene = bge.logic.getCurrentScene()
cam = scene.active_camera
# get projection matrix
camatrix = cam.projection_matrix
#modifying the camera projection matrix by modifying the x and y terms of the 3rd row to obtain a shift of the rendered area 
shiftx = 5
shifty = 5

camatrix[2][0] = 2*shiftx
camatrix[2][1] = 2*shifty
cam.projection_matrix = camatrix

Am I looking at the right thing?

I ended up using a glsl 2d filter