Page 1 of 1

LuxCore: Save/resume rendering

PostPosted: Wed Feb 08, 2017 5:01 am
by Dade
Introduction

LuxCore now supports save/resume rendering for all rendering engines. A saved rendering consists, at the moment, of 2 files: a film and a rendering state. In combination with the scene and rendering configuration files, they are required to resume the rendering.

Follow the code required to save the rendering in C++:

Code: Select all
// Pause the current rendering
session->Pause();

// Save the film
session->GetFilm().SaveFilm(saveResumeName + ".flm");

// Save the render state
RenderState *renderState = session->GetRenderState();
renderState->Save(saveResumeName + ".rst");
delete renderState;

// Resume the current rendering
session->Resume();


and the code to resume:

Code: Select all
// Load the start film
Film *startFilm = new Film(saveResumeName + ".flm");

// Load the start render state
RenderState *startRenderState = new RenderState(saveResumeName + ".rst");

config = new RenderConfig(Properties(configFileName));

// Use a special RenderSession constructor to resume the rendering
session = new RenderSession(config, startState, startFilm);


The same code is used in LuxCoreUI to demo this feature.

You can find a Python example here: https://bitbucket.org/luxrender/luxrays ... emo.py-450

BiasPath

As you can easily figure out, saving the state of tile rendering is not a trivial task or a small amount of information. LuxCore has to save the status of all tiles including convergence related information like the tile films. As result saving the .rst file can require few seconds and the size can be few dozens of MB.

Next step

Once render configuration and scene serialization will be implemented (required for network rendering), it will possible to save in a single file all the information required to resume the rendering without having external dependencies like .cfg, .scn, .ply, etc.

Re: LuxCore: save/resume rendering

PostPosted: Wed Feb 08, 2017 9:48 pm
by Piita
Ah, fantastic! Thank you, Dade! :)

Re: LuxCore: save/resume rendering

PostPosted: Thu Feb 09, 2017 12:19 am
by tomb
That is indeed awesome :)

Re: LuxCore: save/resume rendering

PostPosted: Thu Feb 09, 2017 2:23 am
by B.Y.O.B.
Dade wrote:Once render configuration and scene serialization will be implemented (required for network rendering), it will possible to save in a single file all the information required to resume the rendering without having external dependencies like .cfg, .scn, .ply, etc.

This sounds like a good plan :)

Re: LuxCore: save/resume rendering

PostPosted: Fri Feb 10, 2017 12:21 am
by neo2068
That's great! Thank you Dade! :D