diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-06 13:49:41 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-02-11 20:18:32 +0300 |
commit | 9efbc8d76fecb008c03f7603227f00540359f216 (patch) | |
tree | c5c8bc2f87fd42c321c1bd7396f511a6ad562a9a /intern/cycles | |
parent | 93592009562f6c5cd18035c4562a11a50ec25dc8 (diff) |
Cycles: backport samples metadata format changes to 2.7.
The render layer name is now always included. Best to keep these consistent,
so that animation denoising and sample merging works the same for both and
tests can be the same. Ref D4311.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 35 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.h | 3 |
2 files changed, 27 insertions, 11 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 43d7ff49a3b..ab08b9e146d 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -379,6 +379,28 @@ static void add_cryptomatte_layer(BL::RenderResult& b_rr, string name, string ma render_add_metadata(b_rr, prefix+"manifest", manifest); } +void BlenderSession::stamp_view_layer_metadata_do(const string& prefix) +{ + BL::RenderResult b_rr = b_engine.get_result(); + /* Configured number of samples for the view layer. */ + b_rr.stamp_data_add_field((prefix + "samples").c_str(), + to_string(session->params.samples).c_str()); + /* Store ranged samples information. */ + if(session->tile_manager.range_num_samples != -1) { + b_rr.stamp_data_add_field( + (prefix + "range_start_sample").c_str(), + to_string(session->tile_manager.range_start_sample).c_str()); + b_rr.stamp_data_add_field( + (prefix + "range_num_samples").c_str(), + to_string(session->tile_manager.range_num_samples).c_str()); + } +} + +void BlenderSession::stamp_view_layer_metadata(const string& view_layer_name) +{ + stamp_view_layer_metadata_do("cycles." + view_layer_name + "."); +} + void BlenderSession::render() { /* set callback to write out render results */ @@ -394,9 +416,6 @@ void BlenderSession::render() BL::RenderSettings::layers_iterator b_layer_iter; BL::RenderResult::views_iterator b_view_iter; - /* We do some special meta attributes when we only have single layer. */ - const bool is_single_layer = (r.layers.length() == 1); - for(r.layers.begin(b_layer_iter); b_layer_iter != r.layers.end(); ++b_layer_iter) { b_rlay_name = b_layer_iter->name(); @@ -491,15 +510,9 @@ void BlenderSession::render() break; } - BL::RenderResult b_full_rr = b_engine.get_result(); - if(is_single_layer) { - string num_aa_samples = string_printf("%d", session->params.samples); - render_add_metadata(b_full_rr, "Cycles Samples", num_aa_samples); - /* TODO(sergey): Report whether we're doing resumable render - * and also start/end sample if so. - */ - } + stamp_view_layer_metadata(b_rlay_name); + BL::RenderResult b_full_rr = b_engine.get_result(); if(scene->film->cryptomatte_passes & CRYPT_OBJECT) { add_cryptomatte_layer(b_full_rr, b_rlay_name+".CryptoObject", scene->object_manager->get_cryptomatte_objects(scene)); diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h index b8a9096b354..2aa3c77c37d 100644 --- a/intern/cycles/blender/blender_session.h +++ b/intern/cycles/blender/blender_session.h @@ -146,6 +146,9 @@ public: static bool print_render_stats; protected: + void stamp_view_layer_metadata(const string& view_layer_name); + void stamp_view_layer_metadata_do(const string& prefix); + void do_write_update_render_result(BL::RenderResult& b_rr, BL::RenderLayer& b_rlay, RenderTile& rtile, |