From 66700196074ad168f3322f2766846a0a07f7a00f Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Tue, 27 Aug 2019 08:42:50 +0200 Subject: 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 --- source/blender/gpu/intern/gpu_draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index be3655648f5..859b1e4a10d 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -348,7 +348,7 @@ static void gpu_texture_update_scaled( } /* Scale pixels. */ - ImBuf *ibuf = IMB_allocFromBuffer((uint *)rect, rect_float, w, h); + ImBuf *ibuf = IMB_allocFromBuffer((uint *)rect, rect_float, w, h, 4); IMB_scaleImBuf(ibuf, sub_w, sub_h); if (ibuf->rect_float) { @@ -648,13 +648,13 @@ void GPU_create_gl_tex(uint *bind, recth = smaller_power_of_2_limit(recth); if (frect) { - ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy); + ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy, 4); IMB_scaleImBuf(ibuf, rectw, recth); frect = ibuf->rect_float; } else { - ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy); + ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy, 4); IMB_scaleImBuf(ibuf, rectw, recth); rect = ibuf->rect; -- cgit v1.2.3