MCPcopy Create free account
hub / github.com/LuxCoreRender/LuxCore / BatchRendering

Function BatchRendering

samples/luxcoreconsole/luxcoreconsole.cpp:45–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45static void BatchRendering(RenderConfig *config, RenderState *startState, Film *startFilm) {
46 RenderSession *session = RenderSession::Create(config, startState, startFilm);
47
48 const unsigned int haltTime = config->GetProperty("batch.halttime").Get<unsigned int>();
49 const unsigned int haltSpp = config->GetProperty("batch.haltspp").Get<unsigned int>();
50
51 // Start the rendering
52 session->Start();
53
54 const Properties &stats = session->GetStats();
55 while (!session->HasDone()) {
56 boost::this_thread::sleep(boost::posix_time::millisec(1000));
57 session->UpdateStats();
58
59 const double elapsedTime = stats.Get("stats.renderengine.time").Get<double>();
60 const unsigned int pass = stats.Get("stats.renderengine.pass").Get<unsigned int>();
61 // Convergence test is update inside UpdateFilm()
62 const float convergence = stats.Get("stats.renderengine.convergence").Get<float>();
63
64 // Print some information about the rendering progress
65 LC_LOG(boost::str(boost::format("[Elapsed time: %3d/%dsec][Samples %4d/%d][Convergence %f%%][Avg. samples/sec % 3.2fM on %.1fK tris]") %
66 int(elapsedTime) % int(haltTime) % pass % haltSpp % (100.f * convergence) %
67 (stats.Get("stats.renderengine.total.samplesec").Get<double>() / 1000000.0) %
68 (stats.Get("stats.dataset.trianglecount").Get<double>() / 1000.0)));
69 }
70
71 // Stop the rendering
72 session->Stop();
73
74 const string renderEngine = config->GetProperty("renderengine.type").Get<string>();
75 if (renderEngine != "FILESAVER") {
76 // Save the rendered image
77 session->GetFilm().SaveOutputs();
78 }
79
80 delete session;
81}
82
83int main(int argc, char *argv[]) {
84 // This is required to run AMD GPU profiler

Callers 1

mainFunction · 0.70

Calls 14

formatFunction · 0.85
Get<unsigned int>Method · 0.80
GetStatsMethod · 0.80
Get<double>Method · 0.80
GetMethod · 0.80
Get<float>Method · 0.80
Get<string>Method · 0.80
SaveOutputsMethod · 0.80
strFunction · 0.50
GetPropertyMethod · 0.45
StartMethod · 0.45
HasDoneMethod · 0.45

Tested by

no test coverage detected