I’ve been trying to create two windows, each of which shows a unique view of the same scene, with one camera’s heading rotated 90 degrees with respect to the other’s viewpoint, but in the same location.
The behavior I am trying to achieve is a “cockpit effect”, as if I have one screen showing the straight ahead view and a second screen where you can see out the left side of the cockpit. Each screen will get one window.
When I do this, I get some weird and undesirable behavior. The first “straight ahead view” window appears to render correctly, but the second “rotated view” window appears to have a major rendering error, as if it is trying to render two separate scenegraphs simultaneously.
It is also critical that I create/edit a Lens object for each camera, given the particulars of my application.
Please note: There is also a scale node in -Z. My projected image is sent through a projector and in to a physical mirror, so I’m compensating for the view in the code. As far as I can tell, this is NOT relevant to this two-window problem.
Thank you in advance for any help you might provide.
My code thus far:
#Code for creating first window and camera and lens prop = WindowProperties() base.setBackgroundColor(0, 0, 0) #DLP can handle 640,480 prop.setSize(640, 480) prop.setUndecorated(True) prop.setOrigin(0,0) prop.setTitle('Straight ahead view') base.setFrameRateMeter(True) base.win.requestProperties(prop) #update the view #scaling node reqd to correct for models at different scales self.myScaleNode = render.attachNewNode("myScaleNode") self.myScaleNode.setScale(0.1) #FOV setting based on projector capabilities #640/480 = 4/3 #FOV = 27 degrees horizontal, based on measurements of projected image at set distance base.camLens.setAspectRatio(4/3) base.camLens.setFov(27) camNP = cameraLocation.attachNewNode('camNP') #Scale -1 in Z-dir corrects for mirror image of projector camNP.setScale(1,1,-1) self.camNPRef = camNP base.camera = camNP #2nd Camera creation and nodeling altWindow = base.openWindow() prop = WindowProperties() prop.setSize(640,480) prop.setOrigin(640,0) prop.setUndecorated(True) prop.setTitle('Rotated View') altWindow.requestProperties(prop) #2nd camera lens creation and setup displayRegion = altWindow.makeDisplayRegion(0,1,0,1) altCam = Camera('altcam') altCamNP = NodePath(altCam) myLens = PerspectiveLens() myLens.setAspectRatio(4/3) myLens.setFov(27) altCam.setLens(myLens) displayRegion.setCamera(altCamNP) altCamNP.reparentTo(cameraLocation) altCamNP.setH(90)