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:
authorJeroen Bakker <j.bakker@atmind.nl>2019-08-27 09:42:50 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-08-27 09:56:56 +0300
commit66700196074ad168f3322f2766846a0a07f7a00f (patch)
treef3f90a971ad58a78c7618c18e9ac693974c7ee99 /source/blender/draw/engines/workbench/workbench_deferred.c
parentbc51250c1fbfe8309e42a4a0b6257e93939346a7 (diff)
Workbench: Specular Highlighting for MatCaps
With Blender 2.80 we introduced a more flexible matcap system. One change we did was to multiply the matcap with the base color that was shaded. As matcaps contains diffuse and specular lighting in a single texture this lead to rendering artifacts. Artists were complaining that everything looked to metalic. We now support a separate `diffuse` and `specular` pass for matcaps. `shaded_color = diffuse_light * base_color + specular_light` For matcaps to support this feature they need to be multilayer openexr files with 2 renderpasses (named `diffuse` and `specular`). In the future we can change this to first pass/second pass in stead of this naming convention. Reviewed By: fclem, brecht Differential Revision: https://developer.blender.org/D5335
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_deferred.c')
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index add49462de1..c1c9d8b5a96 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -694,16 +694,22 @@ static void workbench_composite_uniforms(WORKBENCH_PrivateData *wpd, DRWShadingG
if (CAVITY_ENABLED(wpd)) {
DRW_shgroup_uniform_texture_ref(grp, "cavityBuffer", &e_data.cavity_buffer_tx);
}
- if (SPECULAR_HIGHLIGHT_ENABLED(wpd) || STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
+ if (workbench_is_specular_highlight_enabled(wpd) || STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
DRW_shgroup_uniform_vec4(grp, "viewvecs[0]", (float *)wpd->viewvecs, 3);
}
- if (SPECULAR_HIGHLIGHT_ENABLED(wpd) || STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
+ if (workbench_is_specular_highlight_enabled(wpd) || STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
}
if (STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)) {
- BKE_studiolight_ensure_flag(wpd->studio_light, STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE);
+ BKE_studiolight_ensure_flag(wpd->studio_light,
+ STUDIOLIGHT_MATCAP_DIFFUSE_GPUTEXTURE |
+ STUDIOLIGHT_MATCAP_SPECULAR_GPUTEXTURE);
DRW_shgroup_uniform_texture(
- grp, "matcapImage", wpd->studio_light->equirect_radiance_gputexture);
+ grp, "matcapDiffuseImage", wpd->studio_light->matcap_diffuse.gputexture);
+ if (workbench_is_specular_highlight_enabled(wpd)) {
+ DRW_shgroup_uniform_texture(
+ grp, "matcapSpecularImage", wpd->studio_light->matcap_specular.gputexture);
+ }
}
}