diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-06 13:49:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-02-06 18:11:51 +0300 |
commit | 8c87af74409a3e6681698ba1bf150dd6155e202f (patch) | |
tree | a9549a2315fed37625e8bd126e91c8855a00147a /intern/cycles | |
parent | e21ae0bb267a54482108ddd4feed99c89241804b (diff) |
Improvements and fixes to Cycles metadata
This is a request by the studio here to make it possible to see how
many samples were used to render a specific shot or a frame. It is a
bit more tricky than simply stamping number of samples from a scene
since rendering is happening in multiple ranges of samples.
This change makes it so Cycles saves configured number of samples for
the specific view layer, and also stores start sample and number of
samples when rendering only a subrange of all samples.
The format used is "cycles.<view_layer_name>.><field>", which allows
to have information about all layers in a multi-layer EXR file.
Ideally we can store simplified "cycles.<field>" if we know that there
is only one render layer in the file, but detecting this is somewhat
tricky since Cycles operates on an evaluated scene which always have
single view layer.
The metadata is shown in the Metadata panels for clip, image and
sequencer spaces.
Example screenshot which shows the metadata:
{F6527727}
Reviewers: brecht
Reviewed By: brecht
Subscribers: fsiddi
Differential Revision: https://developer.blender.org/D4311
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 34 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.h | 3 |
2 files changed, 26 insertions, 11 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 6e6d98b19dd..e8a0e6dce39 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -393,6 +393,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(BL::Depsgraph& b_depsgraph_) { b_depsgraph = b_depsgraph_; @@ -408,9 +430,6 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_) /* render each layer */ BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval(); - /* We do some special meta attributes when we only have single layer. */ - const bool is_single_layer = (b_scene.view_layers.length() == 1); - /* temporary render result to find needed passes and views */ BL::RenderResult b_rr = begin_render_result(b_engine, 0, 0, 1, 1, b_view_layer.name().c_str(), NULL); BL::RenderResult::layers_iterator b_single_rlay; @@ -525,14 +544,7 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_) break; } - if(is_single_layer) { - BL::RenderResult b_rr = b_engine.get_result(); - string num_aa_samples = string_printf("%d", session->params.samples); - b_rr.stamp_data_add_field("Cycles Samples", num_aa_samples.c_str()); - /* TODO(sergey): Report whether we're doing resumable render - * and also start/end sample if so. - */ - } + stamp_view_layer_metadata(b_rlay_name); /* Write cryptomatte metadata. */ if(scene->film->cryptomatte_passes & CRYPT_OBJECT) { diff --git a/intern/cycles/blender/blender_session.h b/intern/cycles/blender/blender_session.h index 96ffc06a3db..9edc4887928 100644 --- a/intern/cycles/blender/blender_session.h +++ b/intern/cycles/blender/blender_session.h @@ -151,6 +151,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, |