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_forward.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_forward.c')
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 4c1fce550e8..824c6e7bd76 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -186,11 +186,17 @@ WORKBENCH_MaterialData *workbench_forward_get_or_create_material_data(WORKBENCH_
DRW_shgroup_uniform_vec4(grp, "viewvecs[0]", (float *)wpd->viewvecs, 3);
workbench_material_copy(material, &material_template);
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);
+ }
}
- if (SPECULAR_HIGHLIGHT_ENABLED(wpd) || MATCAP_ENABLED(wpd)) {
+ if (workbench_is_specular_highlight_enabled(wpd) || MATCAP_ENABLED(wpd)) {
DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
}
if (SHADOW_ENABLED(wpd)) {
@@ -528,11 +534,17 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
float hair_alpha = XRAY_ALPHA(wpd) * 0.33f;
DRW_shgroup_uniform_float_copy(shgrp, "alpha", hair_alpha);
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(
- shgrp, "matcapImage", wpd->studio_light->equirect_radiance_gputexture);
+ shgrp, "matcapDiffuseImage", wpd->studio_light->matcap_diffuse.gputexture);
+ if (workbench_is_specular_highlight_enabled(wpd)) {
+ DRW_shgroup_uniform_texture(
+ shgrp, "matcapSpecularImage", wpd->studio_light->matcap_specular.gputexture);
+ }
}
- if (SPECULAR_HIGHLIGHT_ENABLED(wpd) || MATCAP_ENABLED(wpd)) {
+ if (workbench_is_specular_highlight_enabled(wpd) || MATCAP_ENABLED(wpd)) {
DRW_shgroup_uniform_vec2(shgrp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
}