Hi
After I found that in the example at https://www.panda3d.org/manual/index.php/File:DisplayRegion_1.jpg the nodes are distorted (panda3d version 1.9.3), here is my example (based on the above one and on other code snippets I found), with no distortion:
from direct.directbase.DirectStart import *
from pandac.PandaModules import *
from direct.actor.Actor import Actor
base.disableMouse()
def makeNewDr():
dr2 = base.win.makeDisplayRegion(0.1, 0.4, 0.2, 0.6)
dr2.setClearColor(VBase4(0, 0, 0, 1))
dr2.setClearColorActive(True)
dr2.setClearDepthActive(True)
cam2 = render.attachNewNode(Camera('cam2'))
dr2.setCamera(cam2)
return cam2
def makeNewDr3():
dr3 = base.win.makeDisplayRegion(1,1,1,1)
dr3.setClearColor(VBase4(0, 0, 0, 1))
dr3.setClearColorActive(True)
dr3.setClearDepthActive(True)
cam3 = render.attachNewNode(Camera('cam3'))
dr3.setCamera(cam3)
env = loader.loadModel('environment.egg')
env.reparentTo(render)
b = Actor('panda.egg', {'walk' : 'panda-walk.egg'})
b.pose('walk', 0)
b.reparentTo(render)
b.setX(-25)
b.setZ(50)
b.setY(-350)
b.setH(-135)
cam3.setPos(-22.5, -387.3, 58.1999)
return cam3
def splitScreen(cam, cam2):
dr = cam.node().getDisplayRegion(0)
dr2 = cam2.node().getDisplayRegion(0)
dr.setDimensions(0, 0.5, 0, 1)
dr2.setDimensions(0.5, 1, 0, 1)
cam.node().getLens().setAspectRatio(float(dr.getPixelWidth()) / float(dr.getPixelHeight()))
cam2.node().getLens().setAspectRatio(float(dr2.getPixelWidth()) / float(dr2.getPixelHeight()))
cam2 = makeNewDr()
cam3 = makeNewDr3()
cam2.reparentTo(cam3)
cam2.setH(15)
splitScreen(cam3, cam2)
# Disable the default DisplayRegion, which covers the whole screen.
dr = base.camNode.getDisplayRegion(0)
dr.setActive(0) # Or leave it (dr.setActive(1))
run()
Attached the example with the distortion (distorted.1.png), and the example without the distortions (dist.png)