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/imbuf/intern/allocimbuf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/imbuf/intern/allocimbuf.c') diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 7d2f51af65e..75db3fd3c73 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -428,7 +428,8 @@ bool imb_addrectImBuf(ImBuf *ibuf) struct ImBuf *IMB_allocFromBuffer(const unsigned int *rect, const float *rectf, unsigned int w, - unsigned int h) + unsigned int h, + unsigned int channels) { ImBuf *ibuf = NULL; @@ -438,6 +439,7 @@ struct ImBuf *IMB_allocFromBuffer(const unsigned int *rect, ibuf = IMB_allocImBuf(w, h, 32, 0); + ibuf->channels = channels; if (rectf) { ibuf->rect_float = MEM_dupallocN(rectf); ibuf->flags |= IB_rectfloat; -- cgit v1.2.3