I used your example to make a “mkAnaglyph” function, which renders an anaglyph stereo image that is NOT limited to red and blue:
def mkAnaglyph(lr,lg,lb,rr,rg,rb,dist,px,py,pz,lx,ly,lz): # l(rgb)=left eye color
leftBuffer = base.win.makeTextureBuffer('left', 512, 512) # r(rgb)=right eye color
leftBuffer.setClearColor(VBase4(0, 0, 0, 0)) # dist=eye distance
base.makeCamera(leftBuffer) # p(xyz) camera position
rightBuffer = base.win.makeTextureBuffer('right', 512, 512) # l(xyz) camera lookAt
rightBuffer.setClearColor(VBase4(0, 0, 0, 0))
base.makeCamera(rightBuffer)
leftCard = CardMaker('left')
leftCard.setFrame(-1, 1, -1, 1)
leftCard.setColor(lr, lg, lb, 0.5)
leftCardNP = render2d.attachNewNode(leftCard.generate())
leftCardNP.setTransparency(1)
leftCardNP.setTexture(leftBuffer.getTexture())
rightCard = CardMaker('right')
rightCard.setFrame(-1, 1, -1, 1)
rightCard.setColor(rr, rg, rb, 0.5)
rightCardNP = render2d.attachNewNode(rightCard.generate())
rightCardNP.setTransparency(1)
rightCardNP.setTexture(rightBuffer.getTexture())
base.camNode.setActive(0)
base.camList[1].setPos(px-(dist/2), py, pz)
base.camList[1].lookAt(lx, ly, lz)
base.camList[2].setPos(px+(dist/2), py, pz)
base.camList[2].lookAt(lx, ly, lz)
to use this function simply run it, NO need to disable a view or cam:
mkAnaglyph(1,0,0, 0,0,1, 0.2, 0,0,0, 0,20,0)
#red-blue ; eye distance 0.2 ; cam position 0,0,0 ; lookAt 0,20,0
mkAnaglyph(1,0,0, 0,1,1, 0.4, 10,0,0, 0,0,0)
#red-cyan ; eye distance 0.4 ; cam position 10,0,0 ; lookAt 0,0,0
mkAnaglyph(1,1,0, 0,1,1, 0.2, 0,0,0, 0,20,0)
#orange-cyan (my favourite system) ; eye distance 0.2 ; cam position 0,0,0 ; lookAt 0,20,0
I don’t know why, but i like the orange-green system most, i think because it has nearly full color support, because left eye sees red and green and right eye sees green and blue…