Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2018-11-26 18:49:56 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2018-11-26 19:31:18 +0300
commitc0816cd03b42399e75a285d5e5dd1319e5054f17 (patch)
tree563c3c6a3025cc5a81f6a99cfc3306ff99898922 /source/blender/makesrna/intern/rna_space.c
parent9238b7308a3f0b2716237b36dbe9fe16ce4e041c (diff)
Workbench: Add Curvature overlay for better visibility of surface detail for e.g. sculpting
The approach is fairly simple, just apply an edge detection filter to the view normal and scale the brightness based on that. The overlay is disabled at object boundaries to avoid dark lines around objects. Generally, this implementation follows the proposal of @monio at https://blender.community/c/rightclickselect/J9bbbc. The changes are: - Dynamic filter radius (on high-DPI displays, a radius of two is used) - Options to reduce the strength of both ridges and valleys - Tweaked function for the strength reduction (the original method actually had a local maximum, resulting in a brighter line inside valleys) - Multiplication for blending instead of overlay, which doesn't work reliably with scene-referred intensities - Renamed to point out the distinction between it and the SSAO-based cavity overlay Reviewers: jbakker Reviewed By: jbakker Subscribers: billreynish, manitwo, linko, monio Differential Revision: https://developer.blender.org/D3617
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r--source/blender/makesrna/intern/rna_space.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index b28e0951877..de9cd0ef235 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2396,6 +2396,13 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
};
static const float default_background_color[] = {0.05f, 0.05f, 0.05f};
+ static const EnumPropertyItem cavity_type_items[] = {
+ {V3D_SHADING_CAVITY_SSAO, "WORLD", 0, "World", "Cavity shading computed in world space, useful for larger-scale occlusion"},
+ {V3D_SHADING_CAVITY_CURVATURE, "SCREEN", 0, "Screen", "Curvature-based shading, useful for making fine details more visible"},
+ {V3D_SHADING_CAVITY_BOTH, "BOTH", 0, "Both", "Use both effects simultaneously"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
/* Note these settings are used for both 3D viewport and the OpenGL render
* engine in the scene, so can't assume to always be part of a screen. */
@@ -2436,10 +2443,31 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Cavity", "Show Cavity");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "cavity_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, cavity_type_items);
+ RNA_def_property_ui_text(prop, "Cavity Type", "Way to draw the cavity shading");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "curvature_ridge_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "curvature_ridge_factor");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Curvature Ridge", "Factor for the curvature ridges");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "curvature_valley_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "curvature_valley_factor");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Curvature Valley", "Factor for the curvature valleys");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
prop = RNA_def_property(srna, "cavity_ridge_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "cavity_ridge_factor");
RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Ridge", "Factor for the ridges");
+ RNA_def_property_ui_text(prop, "Cavity Ridge", "Factor for the cavity ridges");
RNA_def_property_range(prop, 0.0f, 250.0f);
RNA_def_property_ui_range(prop, 0.00f, 2.5f, 1, 3);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -2448,7 +2476,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
prop = RNA_def_property(srna, "cavity_valley_factor", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "cavity_valley_factor");
RNA_def_property_float_default(prop, 1.0);
- RNA_def_property_ui_text(prop, "Valley", "Factor for the valleys");
+ RNA_def_property_ui_text(prop, "Cavity Valley", "Factor for the cavity valleys");
RNA_def_property_range(prop, 0.0f, 250.0f);
RNA_def_property_ui_range(prop, 0.00f, 2.5f, 1, 3);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);