diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2015-04-06 16:40:12 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2015-04-06 16:40:12 +0300 |
commit | d5f1b9c2223333e03f2e4994171ad9df8c1c4f21 (patch) | |
tree | be6b81d2c439249af96b8b28b5013dcbb735b937 /intern/cycles/blender/blender_session.cpp | |
parent | 74df307ca43df14b759fd9eb6a049a6c5d90dcda (diff) |
Multi-View and Stereo 3D
Official Documentation:
http://www.blender.org/manual/render/workflows/multiview.html
Implemented Features
====================
Builtin Stereo Camera
* Convergence Mode
* Interocular Distance
* Convergence Distance
* Pivot Mode
Viewport
* Cameras
* Plane
* Volume
Compositor
* View Switch Node
* Image Node Multi-View OpenEXR support
Sequencer
* Image/Movie Strips 'Use Multiview'
UV/Image Editor
* Option to see Multi-View images in Stereo-3D or its individual images
* Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images
I/O
* Save/Open Multi-View (OpenEXR, Stereo3D, individual views) images
Scene Render Views
* Ability to have an arbitrary number of views in the scene
Missing Bits
============
First rule of Multi-View bug report: If something is not working as it should *when Views is off* this is a severe bug, do mention this in the report.
Second rule is, if something works *when Views is off* but doesn't (or crashes) when *Views is on*, this is a important bug. Do mention this in the report.
Everything else is likely small todos, and may wait until we are sure none of the above is happening.
Apart from that there are those known issues:
* Compositor Image Node poorly working for Multi-View OpenEXR
(this was working prefectly before the 'Use Multi-View' functionality)
* Selecting camera from Multi-View when looking from camera is problematic
* Animation Playback (ctrl+F11) doesn't support stereo formats
* Wrong filepath when trying to play back animated scene
* Viewport Rendering doesn't support Multi-View
* Overscan Rendering
* Fullscreen display modes need to warn the user
* Object copy should be aware of views suffix
Acknowledgments
===============
* Francesco Siddi for the help with the original feature specs and design
* Brecht Van Lommel for the original review of the code and design early on
* Blender Foundation for the Development Fund to support the project wrap up
Final patch reviewers:
* Antony Riakiotakis (psy-fi)
* Campbell Barton (ideasman42)
* Julian Eisel (Severin)
* Sergey Sharybin (nazgul)
* Thomas Dinged (dingto)
Code contributors of the original branch in github:
* Alexey Akishin
* Gabriel Caraballo
Diffstat (limited to 'intern/cycles/blender/blender_session.cpp')
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 4f428bbea57..17bab0ab525 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -331,9 +331,9 @@ static ShaderEvalType get_shader_type(const string& pass_type) return SHADER_EVAL_BAKE; } -static BL::RenderResult begin_render_result(BL::RenderEngine b_engine, int x, int y, int w, int h, const char *layername) +static BL::RenderResult begin_render_result(BL::RenderEngine b_engine, int x, int y, int w, int h, const char *layername, const char *viewname) { - return b_engine.begin_result(x, y, w, h, layername); + return b_engine.begin_result(x, y, w, h, layername, viewname); } static void end_render_result(BL::RenderEngine b_engine, BL::RenderResult b_rr, bool cancel, bool do_merge_results) @@ -350,7 +350,7 @@ void BlenderSession::do_write_update_render_tile(RenderTile& rtile, bool do_upda int h = params.height; /* get render result */ - BL::RenderResult b_rr = begin_render_result(b_engine, x, y, w, h, b_rlay_name.c_str()); + BL::RenderResult b_rr = begin_render_result(b_engine, x, y, w, h, b_rlay_name.c_str(), b_rview_name.c_str()); /* can happen if the intersected rectangle gives 0 width or height */ if(b_rr.ptr.data == NULL) { @@ -415,13 +415,14 @@ void BlenderSession::render() /* render each layer */ BL::RenderSettings r = b_scene.render(); - BL::RenderSettings::layers_iterator b_iter; + BL::RenderSettings::layers_iterator b_layer_iter; + BL::RenderResult::views_iterator b_view_iter; - for(r.layers.begin(b_iter); b_iter != r.layers.end(); ++b_iter) { - b_rlay_name = b_iter->name(); + for(r.layers.begin(b_layer_iter); b_layer_iter != r.layers.end(); ++b_layer_iter) { + b_rlay_name = b_layer_iter->name(); - /* temporary render result to find needed passes */ - BL::RenderResult b_rr = begin_render_result(b_engine, 0, 0, 1, 1, b_rlay_name.c_str()); + /* temporary render result to find needed passes and views */ + BL::RenderResult b_rr = begin_render_result(b_engine, 0, 0, 1, 1, b_rlay_name.c_str(), NULL); BL::RenderResult::layers_iterator b_single_rlay; b_rr.layers.begin(b_single_rlay); @@ -456,31 +457,41 @@ void BlenderSession::render() } } - /* free result without merging */ - end_render_result(b_engine, b_rr, true, false); - buffer_params.passes = passes; - scene->film->pass_alpha_threshold = b_iter->pass_alpha_threshold(); + scene->film->pass_alpha_threshold = b_layer_iter->pass_alpha_threshold(); scene->film->tag_passes_update(scene, passes); scene->film->tag_update(scene); scene->integrator->tag_update(scene); - /* update scene */ - sync->sync_camera(b_render, b_engine.camera_override(), width, height); - sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state, b_rlay_name.c_str()); + for(b_rr.views.begin(b_view_iter); b_view_iter != b_rr.views.end(); ++b_view_iter) { + b_rview_name = b_view_iter->name(); - /* update number of samples per layer */ - int samples = sync->get_layer_samples(); - bool bound_samples = sync->get_layer_bound_samples(); + /* set the current view */ + b_engine.active_view_set(b_rview_name.c_str()); - if(samples != 0 && (!bound_samples || (samples < session_params.samples))) - session->reset(buffer_params, samples); - else - session->reset(buffer_params, session_params.samples); + /* update scene */ + sync->sync_camera(b_render, b_engine.camera_override(), width, height); + sync->sync_data(b_v3d, b_engine.camera_override(), &python_thread_state, b_rlay_name.c_str()); - /* render */ - session->start(); - session->wait(); + /* update number of samples per layer */ + int samples = sync->get_layer_samples(); + bool bound_samples = sync->get_layer_bound_samples(); + + if(samples != 0 && (!bound_samples || (samples < session_params.samples))) + session->reset(buffer_params, samples); + else + session->reset(buffer_params, session_params.samples); + + /* render */ + session->start(); + session->wait(); + + if(session->progress.get_cancel()) + break; + } + + /* free result without merging */ + end_render_result(b_engine, b_rr, true, false); if(session->progress.get_cancel()) break; @@ -619,10 +630,12 @@ void BlenderSession::do_write_update_render_result(BL::RenderResult b_rr, BL::Re b_pass.rect(&pixels[0]); } } - - /* copy combined pass */ - if(buffers->get_pass_rect(PASS_COMBINED, exposure, rtile.sample, 4, &pixels[0])) - b_rlay.rect(&pixels[0]); + else { + /* copy combined pass */ + BL::RenderPass b_combined_pass(b_rlay.passes.find_by_type(BL::RenderPass::type_COMBINED, b_rview_name.c_str())); + if(buffers->get_pass_rect(PASS_COMBINED, exposure, rtile.sample, 4, &pixels[0])) + b_combined_pass.rect(&pixels[0]); + } /* tag result as updated */ b_engine.update_result(b_rr); @@ -841,6 +854,9 @@ void BlenderSession::update_status_progress() scene += " | " + b_scene.name(); if(b_rlay_name != "") scene += ", " + b_rlay_name; + + if(b_rview_name != "") + scene += ", " + b_rview_name; } else { BLI_timestr(total_time, time_str, sizeof(time_str)); |