Compositor: Remove Two Pass option

There are few issues with the logic and implementation of this option:

- While the first pass is faster in the terms of a wall-clock time, it
  is often not giving usable results to artists, as the final look of
  the result is so much different from what it is expected to be.

- It is not supported by the GPU compositor.

- It is based on some static rules based on the node type, rather than
  on the apparent computational complexity.

The performance settings are planned to be moved to the RenderData, and
it is unideal to carry on such limited functionality to more places. There
are better approaches to quickly provide approximated results, which we can
look into later.

Pull Request: https://projects.blender.org/blender/blender/pulls/121558
This commit is contained in:
Sergey Sharybin 2024-05-08 14:34:11 +02:00 committed by Sergey Sharybin
parent 5df1ee46bc
commit 6db8091f45
15 changed files with 14 additions and 89 deletions

@ -983,7 +983,6 @@ url_manual_mapping = (
("bpy.types.clothsettings.vertex_group_mass*", "physics/cloth/settings/shape.html#bpy-types-clothsettings-vertex-group-mass"),
("bpy.types.compositornodeconvertcolorspace*", "compositing/types/color/convert_colorspace.html#bpy-types-compositornodeconvertcolorspace"),
("bpy.types.compositornodetree.edit_quality*", "compositing/sidebar.html#bpy-types-compositornodetree-edit-quality"),
("bpy.types.compositornodetree.use_two_pass*", "compositing/sidebar.html#bpy-types-compositornodetree-use-two-pass"),
("bpy.types.cyclescurverendersettings.shape*", "render/cycles/render_settings/hair.html#bpy-types-cyclescurverendersettings-shape"),
("bpy.types.cycleslightsettings.cast_shadow*", "render/cycles/light_settings.html#bpy-types-cycleslightsettings-cast-shadow"),
("bpy.types.cycleslightsettings.max_bounces*", "render/cycles/light_settings.html#bpy-types-cycleslightsettings-max-bounces"),

@ -837,7 +837,6 @@ class NODE_PT_quality(bpy.types.Panel):
col = layout.column()
col.active = not use_realtime
col.prop(tree, "use_two_pass")
col.prop(tree, "use_viewer_border")
col = layout.column()

@ -29,7 +29,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 29
#define BLENDER_FILE_SUBVERSION 30
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

@ -3405,6 +3405,14 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 30)) {
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
if (scene->nodetree) {
scene->nodetree->flag &= ~NTREE_UNUSED_2;
}
}
}
/**
* Always bump subversion in BKE_blender_version.h when adding versioning
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.

@ -11,7 +11,6 @@ CompositorContext::CompositorContext()
scene_ = nullptr;
rd_ = nullptr;
quality_ = eCompositorQuality::High;
fast_calculation_ = false;
bnodetree_ = nullptr;
}

@ -59,11 +59,6 @@ class CompositorContext {
*/
bNodeInstanceHash *previews_;
/**
* \brief Skip slow nodes
*/
bool fast_calculation_;
/**
* \brief active rendering view name
*/
@ -213,15 +208,6 @@ class CompositorContext {
view_name_ = view_name;
}
void set_fast_calculation(bool fast_calculation)
{
fast_calculation_ = fast_calculation;
}
bool is_fast_calculation() const
{
return fast_calculation_;
}
/**
* \brief Get the render percentage as a factor.
* The compositor uses a factor i.o. a percentage.

@ -110,23 +110,6 @@
namespace blender::compositor {
bool COM_bnode_is_fast_node(const bNode &b_node)
{
return !ELEM(b_node.type,
CMP_NODE_BLUR,
CMP_NODE_VECBLUR,
CMP_NODE_BILATERALBLUR,
CMP_NODE_DEFOCUS,
CMP_NODE_BOKEHBLUR,
CMP_NODE_GLARE,
CMP_NODE_DBLUR,
CMP_NODE_MOVIEDISTORTION,
CMP_NODE_LENSDIST,
CMP_NODE_DOUBLEEDGEMASK,
CMP_NODE_DILATEERODE,
CMP_NODE_DENOISE);
}
Node *COM_convert_bnode(bNode *b_node)
{
Node *node = nullptr;

@ -30,13 +30,6 @@ class NodeOperationBuilder;
*/
Node *COM_convert_bnode(bNode *b_node);
/**
* \brief True if the node is considered 'fast'.
*
* Slow nodes will be skipped if fast execution is required.
*/
bool COM_bnode_is_fast_node(const bNode &b_node);
/**
* \brief This function will add a date-type conversion rule when the to-socket does not support
* the from-socket actual data type.

@ -21,7 +21,6 @@ ExecutionSystem::ExecutionSystem(RenderData *rd,
Scene *scene,
bNodeTree *editingtree,
bool rendering,
bool fastcalculation,
const char *view_name,
realtime_compositor::RenderContext *render_context,
ProfilerData &profiler_data)
@ -33,7 +32,6 @@ ExecutionSystem::ExecutionSystem(RenderData *rd,
context_.set_scene(scene);
context_.set_bnodetree(editingtree);
context_.set_preview_hash(editingtree->previews);
context_.set_fast_calculation(fastcalculation);
/* initialize the CompositorContext */
if (rendering) {
context_.set_quality((eCompositorQuality)editingtree->render_quality);

@ -136,7 +136,6 @@ class ExecutionSystem {
Scene *scene,
bNodeTree *editingtree,
bool rendering,
bool fastcalculation,
const char *view_name,
realtime_compositor::RenderContext *render_context,
ProfilerData &profiler_data);

@ -28,10 +28,8 @@ FullFrameExecutionModel::FullFrameExecutionModel(CompositorContext &context,
num_operations_finished_(0)
{
priorities_.append(eCompositorPriority::High);
if (!context.is_fast_calculation()) {
priorities_.append(eCompositorPriority::Medium);
priorities_.append(eCompositorPriority::Low);
}
priorities_.append(eCompositorPriority::Medium);
priorities_.append(eCompositorPriority::Low);
}
void FullFrameExecutionModel::execute(ExecutionSystem &exec_system)

@ -110,12 +110,6 @@ void NodeGraph::add_bNode(const CompositorContext &context,
return;
}
/* replace slow nodes with proxies for fast execution */
if (context.is_fast_calculation() && !COM_bnode_is_fast_node(*b_node)) {
add_proxies_skip(b_ntree, b_node, key, is_active_group);
return;
}
/* special node types */
if (ELEM(b_node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) {
add_proxies_group(context, b_node, key);

@ -91,32 +91,8 @@ void COM_execute(Render *render,
/* Execute. */
const bool is_rendering = render_context != nullptr;
const bool twopass = (node_tree->flag & NTREE_TWO_PASS) && !is_rendering;
if (twopass) {
blender::compositor::ExecutionSystem fast_pass(render_data,
scene,
node_tree,
is_rendering,
true,
view_name,
render_context,
profiler_data);
fast_pass.execute();
if (node_tree->runtime->test_break(node_tree->runtime->tbh)) {
BLI_mutex_unlock(&g_compositor.mutex);
return;
}
}
blender::compositor::ExecutionSystem system(render_data,
scene,
node_tree,
is_rendering,
false,
view_name,
render_context,
profiler_data);
blender::compositor::ExecutionSystem system(
render_data, scene, node_tree, is_rendering, view_name, render_context, profiler_data);
system.execute();
}

@ -841,7 +841,7 @@ enum {
/** For animation editors. */
NTREE_DS_EXPAND = 1 << 0,
/** Two pass. */
NTREE_TWO_PASS = 1 << 2,
NTREE_UNUSED_2 = 1 << 2, /* cleared */
/** Use a border for viewer nodes. */
NTREE_VIEWER_BORDER = 1 << 4,
/**

@ -10527,13 +10527,6 @@ static void rna_def_composite_nodetree(BlenderRNA *brna)
RNA_def_property_enum_items(prop, node_quality_items);
RNA_def_property_ui_text(prop, "Edit Quality", "Quality when editing");
prop = RNA_def_property(srna, "use_two_pass", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", NTREE_TWO_PASS);
RNA_def_property_ui_text(prop,
"Two Pass",
"Use two pass execution during editing: first calculate fast nodes, "
"second pass calculate all nodes");
prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", NTREE_VIEWER_BORDER);
RNA_def_property_ui_text(