Unfortunately, I don’t believe that the FilterManager is currently set up to be able to filter multiple display regions at the same time. You’ll need to add this functionality to FilterManager.
The FisheyeLens is intended to be used with a NonlinearImager, which works by rendering offscreen into a buffer, and then applying that buffer to a distorted mesh. This could perhaps also be an effective way of implementing the required distortion without requiring shaders, by making a Lens derivative that is used with a NonlinearImager - although I personally have no experience with that.
Update: I got basic stereo 3D support working with the Oculus Rift by disabling all filters, enabling side-by-side stereo and using something called the “Oculus Overlay” to do the warping for me. I had to tweak the values in the config file. (Oculus Overlay is windows only unfortunately)
Or you can create two FilterManager objects and hack them to use different display regions:
# Find the display region corresponding to our camera
stereo = None
for region in win.getDisplayRegions():
if region.isStereo() and cam == region.getCamera():
stereo = region
break
fmLeft = FilterManager(win, cam)
fmLeft.region = stereo.getLeftEye()
fmRight = FilterManager(win, cam)
fmRight.region = stereo.getLeftEye()
On second thought, that code won’t work because the first FilterManager replaces the camera, causing the second FilterManager to be unable to determine which region to use. The way to fix this is probably to allow an explicit DisplayRegion to be passed to the FilterManager to be passed instead of a camera and window pair. This is a trivial fix; in FilterManager.py, just add a “region=None” parameter to the init and then replace this code:
region = None
for i in range(win.getNumDisplayRegions()):
dr = win.getDisplayRegion(i)
drcam = dr.getCamera()
if (drcam == cam): region=dr
with something like this:
if region is not None:
win = region.getWindow()
cam = region.getCamera()
else:
for i in range(win.getNumDisplayRegions()):
dr = win.getDisplayRegion(i)
drcam = dr.getCamera()
if (drcam == cam): region=dr
I’ll look into making such a fix permanent. (It would be even better if the FilterManager handled stereo under the hood, but the current design does not make that easy.)