In my game I want to grab an image from a viewport during gameplay. This image is then sent to an external display that’s connected to the PC via a USB cable.
I’m basically rendering to this offscreen viewport normally, and at regular intervals (say 30 Hz) I want to grab an image (by invoking get_texture() on the viewport and then invoking get_image() on the texture. My game itself is typically running at high fps (on high end gsync/freesync systems) and when ever I start grabbing these images I see visible stuttering. Is there any way to grab this image from the GPU without stuttering?
So far my only workaround has been to run a second copy of Godot in the background that renders this offscreen viewport, but that’s not by any means an ideal solution.
I dont think you can work around this one. If you need an image for your setup (and cannot have a simple second window on a secondary screen), I dont think the path of grabbing the viewport texture as an image will yield much result on the issue of performance.
Maybe with a low resolution viewport you could achieve smooth 30 FPS…
Maybe you need to explore more low level stuff…(turning you external display into a device that the rendering server of Godot can directly output to ?)
Could you elaborate on the setup and your goals ?
Certainly, the “normal” screen is rendering a 3D world (for a racing simulation). The screen I need to send this image to is a small display that is attached to the same PC via a USB cable. One example of such a screen is this one from VoCore. The use case is to render a 2D dashboard on it, or use it as a rear view mirror (as examples). To spare you from having to read about these displays, you basically end up sending bitmaps/textures to them in some format, so animating something is literally sending such bitmaps at a specific pace (for these displays 30 fps is more than enough). Is that helpful @francois.delataste ?