3
$\begingroup$

I've tried to follow this tutorial to create a simple bouncing ball in Game Engine.

When I run the animation pressing P ("run" being different than "play" that we can find in Internal or Cycles rendering engines, and not related to a timeline), the animation plays fine.

But I can't seem to find any documentation anywhere as to whether or not I can export this as a video file, like I would with the "Animation" button from the Rendering panel in the other engines.

On this old page there's a script that seems obsolete, and people on the discussion board just seem to end up going with a screen capture tool, which is a limited solution in terms of resolution. Also a script is a little too far advanced for me at the moment with my knowledge of Blender.

So, can a Game Engine scene be rendered out in PNGs like in other engines?

$\endgroup$

1 Answer 1

4
$\begingroup$

There is no checkbox called "Dump framebuffer to disk", so you will have to use a script for this.

The core idea from that old forum thread is good, call bge.render.makeScreenshot() every frame with different filenames.

In the Text Editor, make a script file with a name like "screenshooter.py". That script will handle a frame counter, will make a filename based on that frame counter, and will give that filename to makeScreenshot().

from bge import render

counter = 0

def shoot():
    global counter

    filename = "bge_rendered/frame_" + str(counter).zfill(8) + ".png"
    print("Saving to " + filename)
    render.makeScreenshot(filename)

    counter += 1

In the Logic Editor make:

  • an Always sensor, with "Activate TRUE level triggering".
  • a Python controller, set to Module execution method, executing "screenshooter.shoot".
  • the two connected together.

In the render settings, disable "Use Frame Rate" to disable frame-skipping, otherwise there will be a lot of duplicated frames and jumps in the animation.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .