[Bf-blender-cvs] [7b1d7074817] blender2.8: Merge branch 'master' into blender2.8

Brecht Van Lommel noreply at git.blender.org
Wed Nov 8 00:46:37 CET 2017


Commit: 7b1d7074817dac9d0f088e8e7e5b336bae662c36
Author: Brecht Van Lommel
Date:   Wed Nov 8 00:20:59 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB7b1d7074817dac9d0f088e8e7e5b336bae662c36

Merge branch 'master' into blender2.8

===================================================================



===================================================================

diff --cc source/blender/blenkernel/BKE_node.h
index 20516d3dd5e,c364d0ebb1b..7a770006e98
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@@ -797,7 -788,7 +797,8 @@@ struct ShadeResult
  #define SH_NODE_UVALONGSTROKE			191
  #define SH_NODE_TEX_POINTDENSITY		192
  #define SH_NODE_BSDF_PRINCIPLED         193
 +#define SH_NODE_EEVEE_SPECULAR			195
+ #define SH_NODE_BEVEL                   197
  
  /* custom defines options for Material node */
  #define SH_NODE_MAT_DIFF   1
diff --cc source/blender/gpu/shaders/gpu_shader_material.glsl
index 44803f8f7ee,4ac69119a6c..2cf66c78db1
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@@ -4093,56 -3808,23 +4093,61 @@@ void node_bump(float strength, float di
  	result = normalize(strength * result + (1.0 - strength) * N);
  }
  
+ void node_bevel(float radius, vec3 N, out vec3 result)
+ {
+ 	result = N;
+ }
+ 
  /* output */
  
 -void node_output_material(vec4 surface, vec4 volume, float displacement, out vec4 result)
 +void node_output_material(Closure surface, Closure volume, float displacement, out Closure result)
  {
 +#ifdef VOLUMETRICS
 +	result = volume;
 +#else
  	result = surface;
 +#endif
  }
  
 -void node_output_world(vec4 surface, vec4 volume, out vec4 result)
 +uniform float backgroundAlpha;
 +
 +void node_output_world(Closure surface, Closure volume, out Closure result)
  {
 -	result = surface;
 +#ifndef VOLUMETRICS
 +#ifdef EEVEE_ENGINE
 +	result = Closure(surface.radiance, backgroundAlpha, vec4(0.0), vec2(0.0), -1);
 +#else
 +	result = Closure(surface.radiance, backgroundAlpha);
 +#endif
 +#else
 +	result = volume;
 +#endif /* VOLUMETRICS */
 +}
 +
 +#ifndef VOLUMETRICS
 +/* TODO : clean this ifdef mess */
 +/* EEVEE output */
 +#ifdef EEVEE_ENGINE
 +void world_normals_get(out vec3 N)
 +{
 +	N = gl_FrontFacing ? worldNormal : -worldNormal;
 +}
 +
 +void node_eevee_specular(
 +        vec4 diffuse, vec4 specular, float roughness, vec4 emissive, float transp, vec3 normal,
 +        float clearcoat, float clearcoat_roughness, vec3 clearcoat_normal,
 +        float occlusion, float ssr_id, out Closure result)
 +{
 +	vec3 ssr_spec;
 +
 +	vec3 L = eevee_surface_lit(normal, diffuse.rgb, specular.rgb, roughness, occlusion, int(ssr_id), ssr_spec);
 +	vec3 vN = normalize(mat3(ViewMatrix) * normal);
 +	result = Closure(L + emissive.rgb, 1.0 - transp, vec4(ssr_spec, roughness), normal_encode(vN, viewCameraVec), int(ssr_id));
  }
  
 +#endif /* EEVEE_ENGINE */
 +#endif /* VOLUMETRICS */
 +
  /* ********************** matcap style render ******************** */
  
  void material_preview_matcap(vec4 color, sampler2D ima, vec4 N, vec4 mask, out vec4 result)
diff --cc source/blender/nodes/shader/nodes/node_shader_bevel.c
index 00000000000,e2e4da21ef3..dd9bc91e2d1
mode 000000,100644..100644
--- a/source/blender/nodes/shader/nodes/node_shader_bevel.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bevel.c
@@@ -1,0 -1,70 +1,70 @@@
+ /*
+  * ***** BEGIN GPL LICENSE BLOCK *****
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  *
+  * This program is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  *
+  * You should have received a copy of the GNU General Public License
+  * along with this program; if not, write to the Free Software Foundation,
+  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+  *
+  * The Original Code is Copyright (C) 2005 Blender Foundation.
+  * All rights reserved.
+  *
+  * The Original Code is: all of this file.
+  *
+  * Contributor(s): none yet.
+  *
+  * ***** END GPL LICENSE BLOCK *****
+  */
+ 
+ #include "../node_shader_util.h"
+ 
+ /* **************** OUTPUT ******************** */
+ 
+ static bNodeSocketTemplate sh_node_bevel_in[] = {
+ 	{	SOCK_FLOAT, 0, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
+ 	{	SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
+ 	{	-1, 0, ""	}
+ };
+ 
+ static bNodeSocketTemplate sh_node_bevel_out[] = {
+ 	{	SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ 	{	-1, 0, ""	}
+ };
+ 
+ static void node_shader_init_bevel(bNodeTree *UNUSED(ntree), bNode *node)
+ {
+ 	node->custom1 = 4; /* samples */
+ }
+ 
 -static int gpu_shader_bevel(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
++static int gpu_shader_bevel(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+ {
+ 	if (!in[1].link) {
+ 		GPU_link(mat, "direction_transform_m4v3", GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &in[1].link);
+ 	}
+ 
 -	return GPU_stack_link(mat, "node_bevel", in, out);
++	return GPU_stack_link(mat, node, "node_bevel", in, out);
+ }
+ 
+ /* node type definition */
+ void register_node_type_sh_bevel(void)
+ {
+ 	static bNodeType ntype;
+ 
+ 	sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT, 0);
+ 	node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ 	node_type_socket_templates(&ntype, sh_node_bevel_in, sh_node_bevel_out);
+ 	node_type_init(&ntype, node_shader_init_bevel);
+ 	node_type_storage(&ntype, "", NULL, NULL);
+ 	node_type_gpu(&ntype, gpu_shader_bevel);
+ 
+ 	nodeRegisterType(&ntype);
+ }



More information about the Bf-blender-cvs mailing list