Exporting off-screen buffer via Unix Pipe

I have a silly question.

If I wanted to do post-processing of a Panda rendered frame in a different application, can I create an off-screen buffer in Panda that is exposed to a different process?

To use Unix concepts, have Panda running at normal FPS. Each frame is rendered according to Panda’s regular pipeline. Instead of writing to screen, it writes to a file or off-screen buffer.

That buffer is then sent to another process which does it’s thing.
Does that sound reasonable?

There is also the issue of user input. As sometimes the user input will be directed to the Panda process, other times it will be directed to other programs.

I found a write to file function. If that file was a Unix Pipe, the other application could read it. I am not sure what the performance issues are, but it might work in theory.

Any thoughts?

JK61

Regarding input, I found:
https://www.panda3d.org/reference/1.8.0/python/panda3d.core.GraphicsWindowInputDevice.php
which seems to generate input events. Am I interpreting this correctly?

Meaning, could I turn off the GraphicsWindow from reading the keyboard or mouse, but send keyboard and mouse events via Sockets into the graphics pipeline?

JK61

You can look at BlenderPanda as an example of sending the graphics output from Panda3D to an external program (Blender in this case) over a TCP socket. This is done in processor_app.py by rendering to a texture and then grabbing the image data with Texture.get_ram_image_as().

As for input, I’m still trying to figure that one out.

If you’re OK with poking into the source, you could modify some source/build files to compile SubprocessWindow, which is designed to render into shared memory.

Really? Interesting … let me do some more digging.

Thanks!!

Have you considered using an anonymous mmap instead?

That’d be a much more efficient solution.

That’s what SubprocessWindow uses, I believe.

I think it is reasonable. Just keep doing it.