0

I want to take screenshots of rendered scenes without displaying the game itself. The procedure I want to follow is:

createScene();
for(i = 0; i < num_screenshots; i++)
{
    moveCameraRandomly();
    saveScreenshot();
}

Basically, I want to randomly reposition the camera in the scene for each screenshot I take. However, I need to call this as a function, so I don't want to display the game itself (but I'm fine with it running in the background). Ideally, I would like to have two projects, one which creates screenshots and one which creates the game, where the first one calls the second one. Is there a way to do this?

Booley
  • 819
  • 1
  • 9
  • 25

1 Answers1

1

Applications can be started in headless mode.

Application app = new Main();
app.start(JmeContext.Type.Headless);

http://wiki.jmonkeyengine.org/doku.php/jme3:advanced:headless_server

The ScreenshotAppState can take screenshots:

http://wiki.jmonkeyengine.org/doku.php/jme3:advanced:screenshots

Now you need to develop a combination of both, which is automatically taking screenshots. I recommend that you read the source code of ScreenshotAppState. A already did a similar thing and can tell it is possible.

Stephan
  • 4,395
  • 3
  • 26
  • 49
  • Thanks a ton! I got it to work, but instead I used the `JmeContext.Type.OffScreenSurface` since it seems headless does not do any rendering, so screenshots weren't saved. – Booley Jan 15 '16 at 14:08