Hi,
I’m setting up a simple render pipeline to perform a feedback accumulation and a final shader pass. This is what I have now (-> means “render to”):
- main scene → scene card
- accumulation scene (accumulation card + scene card blended) → accumulation card
- output scene (main scene + accumulation card) → output card
I could do what is done in the output scene into render2d but I need an additional pass for a shader I’m planning to add.
Is this pipeline optimized ? I ask because the last pass to outputBuff slows down the speed by 2, and I’m wondering what does take time in it.
I’ve read in the manual :
When the texture is not in RAM, in what consists the transfer ?
Just some curiosity
# Scene
self.knot = loader.loadModel(MODELS_PATH + 'knot.bam')
self.knot.reparentTo(render)
# Render scene
self.sceneBuff = base.win.makeTextureBuffer('SceneBuffer', 256, 256)
self.sceneBuff.setSort(-1)
self.sceneBuff.setClearColor(Vec4(0,0,0,1))
self.sceneCard = self.sceneBuff.getTextureCard()
self.sceneCam = base.makeCamera(self.sceneBuff, aspectRatio=base.getAspectRatio())
base.cam.node().setActive(False)
base.cam = self.sceneCam
# Accumulation scene
self.accBuff = base.win.makeTextureBuffer('AccumulationBuffer', 256, 256)
self.accBuff.setSort(-2)
self.accBuff.setClearColor(Vec4(0,0,0,1))
self.accBuff.clearDeleteFlag()
self.accCam = base.makeCamera2d(self.accBuff)
self.accScene = NodePath("Accumulation scene")
self.accCam.node().setScene(self.accScene)
self.accCard = self.accBuff.getTextureCard()
self.accOutCard = self.accBuff.getTextureCard()
# Add the 2 cards in the accumulation scene
self.sceneCard.reparentTo(self.accScene)
self.accCard.reparentTo(self.accScene)
self.sceneCard.setY(2)
self.sceneCard.setTransparency(1)
self.accCard.setY(1)
self.accCard.setTransparency(1)
self.accCard.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
# Output buffer
self.outBuff = base.win.makeTextureBuffer('OutBuffer', 800, 600)
self.outBuff.setSort(-3)
self.outBuff.setClearColor(Vec4(0,0,0,1))
self.outScene = NodePath('Output scene')
self.outCam = base.makeCamera2d(self.outBuff)
self.outCam.node().setScene(self.outScene)
self.outCard = self.outBuff.getTextureCard()
self.outCard.reparentTo(render2d)
# Add the result of accumulation to output
self.accOutCard.reparentTo(self.outScene)
self.accOutCard.setTransparency(1)
self.accOutCard.setColor(1,1,1,1)
self.accOutCard.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
Result :