Writing panda3d to movie file [status in 2022]

Of course! Panda was made for niche use cases!

You can set window-type offscreen in Config.prc or pass “offscreen” to the ShowBase constructor to get it to construct an offscreen buffer instead of an on-screen window. Then what you want to do is easily possible.

If you have to do this every frame, I suggest doing something like this:

tex = Texture()
base.win.addRenderTexture(tex, GraphicsOutput.RTMCopyRam, GraphicsOutput.RTPColor)

That will make Panda automatically copy the window’s contents into a texture every frame and transfer it from the GPU to the CPU, which you can then read out in a task. Check tex.hasRamImage(), if it returns true, write it to disk with write('something.png').

Since writing it to disk can be expensive, what you can do (requires Panda3D 1.10.13) is use copy.deepcopy(tex) to create a copy of the texture in that task, put that copy in a thread-safe queue, and have a separate thread pop textures off that queue to do the write() call.