Merge branch 'master' into blender2.8
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 7 Nov 2017 23:20:59 +0000 (00:20 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 7 Nov 2017 23:20:59 +0000 (00:20 +0100)
17 files changed:
1  2 
intern/cycles/blender/blender_shader.cpp
intern/cycles/device/device.h
intern/cycles/device/device_cuda.cpp
release/scripts/startup/nodeitems_builtins.py
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/node.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_node/drawnode.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/makesrna/intern/rna_nodetree.c
source/blender/nodes/CMakeLists.txt
source/blender/nodes/NOD_shader.h
source/blender/nodes/NOD_static_types.h
source/blender/nodes/shader/nodes/node_shader_bevel.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/source/pipeline.c

Simple merge
Simple merge
index 20516d3dd5e9460abefe22281b2dd13187a83f4d,c364d0ebb1b0502d40d8fc73b04a7f854cab0152..7a770006e98c766942a7ebb7c0cc5e1f44ee6d9a
@@@ -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
index 44803f8f7eebeac2da86fd5d66b09a9c70a8ad76,4ac69119a6cd08aec4975482584765a2cd6034f1..2cf66c78db18495bd47fcf37e2a222bed600f578
@@@ -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)
Simple merge
Simple merge
index 0000000000000000000000000000000000000000,e2e4da21ef3f979e7df2351c0435d9f08935b745..dd9bc91e2d19c1e6c022f73ffeb8bc8424e1c933
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,70 +1,70 @@@
 -static int gpu_shader_bevel(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
+ /*
+  * ***** 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 */
+ }
 -      return GPU_stack_link(mat, "node_bevel", in, 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, "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);
+ }