diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2018-11-26 18:49:56 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2018-11-26 19:31:18 +0300 |
commit | c0816cd03b42399e75a285d5e5dd1319e5054f17 (patch) | |
tree | 563c3c6a3025cc5a81f6a99cfc3306ff99898922 /source/blender/draw/engines/workbench/workbench_deferred.c | |
parent | 9238b7308a3f0b2716237b36dbe9fe16ce4e041c (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/draw/engines/workbench/workbench_deferred.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_deferred.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index 66dcfdd66d0..ce14ee66ab2 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -104,6 +104,7 @@ extern char datatoc_workbench_cavity_lib_glsl[]; extern char datatoc_workbench_common_lib_glsl[]; extern char datatoc_workbench_data_lib_glsl[]; extern char datatoc_workbench_object_outline_lib_glsl[]; +extern char datatoc_workbench_curvature_lib_glsl[]; extern char datatoc_workbench_world_light_lib_glsl[]; extern char datatoc_gpu_shader_depth_only_frag_glsl[]; @@ -124,6 +125,9 @@ static char *workbench_build_composite_frag(WORKBENCH_PrivateData *wpd) if (wpd->shading.flag & V3D_SHADING_OBJECT_OUTLINE) { BLI_dynstr_append(ds, datatoc_workbench_object_outline_lib_glsl); } + if (CURVATURE_ENABLED(wpd)) { + BLI_dynstr_append(ds, datatoc_workbench_curvature_lib_glsl); + } BLI_dynstr_append(ds, datatoc_workbench_deferred_composite_frag_glsl); @@ -499,7 +503,7 @@ static void workbench_composite_uniforms(WORKBENCH_PrivateData *wpd, DRWShadingG if (NORMAL_VIEWPORT_COMP_PASS_ENABLED(wpd)) { DRW_shgroup_uniform_texture_ref(grp, "normalBuffer", &e_data.normal_buffer_tx); } - if (CAVITY_ENABLED(wpd)) { + if (SSAO_ENABLED(wpd)) { DRW_shgroup_uniform_texture_ref(grp, "cavityBuffer", &e_data.cavity_buffer_tx); } if (SPECULAR_HIGHLIGHT_ENABLED(wpd) || MATCAP_ENABLED(wpd)) { @@ -903,7 +907,7 @@ void workbench_deferred_draw_scene(WORKBENCH_Data *vedata) DRW_draw_pass(psl->ghost_resolve_pass); } - if (CAVITY_ENABLED(wpd)) { + if (SSAO_ENABLED(wpd)) { GPU_framebuffer_bind(fbl->cavity_fb); DRW_draw_pass(psl->cavity_pass); } |