Skip to content

Commit

Permalink
Compositor: Remove Two Pass option
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sergeyvfx authored and Sergey Sharybin committed May 8, 2024
1 parent 5df1ee4 commit 6db8091
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 89 deletions.
1 change: 0 additions & 1 deletion scripts/modules/rna_manual_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,6 @@
("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"),
Expand Down
1 change: 0 additions & 1 deletion scripts/startup/bl_ui/space_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,6 @@ def draw(self, context):

col = layout.column()
col.active = not use_realtime
col.prop(tree, "use_two_pass")
col.prop(tree, "use_viewer_border")

col = layout.column()
Expand Down
2 changes: 1 addition & 1 deletion source/blender/blenkernel/BKE_blender_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions source/blender/blenloader/intern/versioning_400.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion source/blender/compositor/intern/COM_CompositorContext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ CompositorContext::CompositorContext()
scene_ = nullptr;
rd_ = nullptr;
quality_ = eCompositorQuality::High;
fast_calculation_ = false;
bnodetree_ = nullptr;
}

Expand Down
14 changes: 0 additions & 14 deletions source/blender/compositor/intern/COM_CompositorContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ class CompositorContext {
*/
bNodeInstanceHash *previews_;

/**
* \brief Skip slow nodes
*/
bool fast_calculation_;

/**
* \brief active rendering view name
*/
Expand Down Expand Up @@ -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.
Expand Down
17 changes: 0 additions & 17 deletions source/blender/compositor/intern/COM_Converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions source/blender/compositor/intern/COM_Converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions source/blender/compositor/intern/COM_ExecutionSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion source/blender/compositor/intern/COM_ExecutionSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions source/blender/compositor/intern/COM_NodeGraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
28 changes: 2 additions & 26 deletions source/blender/compositor/intern/COM_compositor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion source/blender/makesdna/DNA_node_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
/**
Expand Down
7 changes: 0 additions & 7 deletions source/blender/makesrna/intern/rna_nodetree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 6db8091

Please sign in to comment.