[Bf-blender-cvs] [93e0e716f38] blender2.8: Merge branch 'master' into blender2.8

Brecht Van Lommel noreply at git.blender.org
Sat Mar 10 19:33:05 CET 2018


Commit: 93e0e716f38175dca570a9d4b497e183650f03a4
Author: Brecht Van Lommel
Date:   Sat Mar 10 19:01:01 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB93e0e716f38175dca570a9d4b497e183650f03a4

Merge branch 'master' into blender2.8

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



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

diff --cc intern/cycles/blender/addon/version_update.py
index f1dc5a6e15e,292f0a1fa90..2689fa63ca8
--- a/intern/cycles/blender/addon/version_update.py
+++ b/intern/cycles/blender/addon/version_update.py
@@@ -377,3 -427,7 +428,8 @@@ def do_versions(self)
                  cmat.displacement_method = 'BUMP'
  
          foreach_cycles_node(displacement_principled_nodes)
+ 
 -    if bpy.data.version <= (2, 79, 3):
++    if bpy.data.version <= (2, 79, 3) or \
++       (bpy.data.version >= (2, 80, 0) and bpy.data.version <= (2, 80, 4)):
+         # Switch to squared roughness convention
+         square_roughness_nodes_insert()
diff --cc source/blender/blenkernel/BKE_blender_version.h
index ceb466ebdcd,b5d906b2968..901f9e6d3ac
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@@ -27,8 -27,8 +27,8 @@@
  /* these lines are grep'd, watch out for our not-so-awesome regex
   * and keep comment above the defines.
   * Use STRINGIFY() rather than defining with quotes */
 -#define BLENDER_VERSION         279
 -#define BLENDER_SUBVERSION      4
 +#define BLENDER_VERSION         280
- #define BLENDER_SUBVERSION      4
++#define BLENDER_SUBVERSION      5
  /* Several breakages with 270, e.g. constraint deg vs rad */
  #define BLENDER_MINVERSION      270
  #define BLENDER_MINSUBVERSION   6
diff --cc source/blender/gpu/shaders/gpu_shader_material.glsl
index bf0e3ca4d96,a0ca719e207..d3bc1f0ef8e
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@@ -2682,37 -2583,24 +2682,37 @@@ void node_bsdf_diffuse(vec4 color, floa
  		L += light_diffuse * bsdf;
  	}
  
 -	result = vec4(L * color.rgb, 1.0);
 +	result = Closure(L * color.rgb, 1.0);
 +#endif
  }
  
 -void node_bsdf_glossy(vec4 color, float roughness, vec3 N, out vec4 result)
 +void node_bsdf_glossy(vec4 color, float roughness, vec3 N, float ssr_id, out Closure result)
  {
 +#ifdef EEVEE_ENGINE
 +	vec3 out_spec, ssr_spec;
- 	roughness = sqrt(roughness);
 +	eevee_closure_glossy(N, vec3(1.0), int(ssr_id), roughness, 1.0, out_spec, ssr_spec);
 +	vec3 vN = normalize(mat3(ViewMatrix) * N);
 +	result = CLOSURE_DEFAULT;
 +	result.radiance = out_spec * color.rgb;
 +	result.ssr_data = vec4(ssr_spec * color.rgb, roughness);
 +	result.ssr_normal = normal_encode(vN, viewCameraVec);
 +	result.ssr_id = int(ssr_id);
 +#else
  	/* ambient light */
  	vec3 L = vec3(0.2);
  
 +	direction_transform_m4v3(N, ViewMatrix, N);
 +
  	/* directional lights */
  	for (int i = 0; i < NUM_LIGHTS; i++) {
 -		vec3 light_position = gl_LightSource[i].position.xyz;
 -		vec3 H = gl_LightSource[i].halfVector.xyz;
 -		vec3 light_diffuse = gl_LightSource[i].diffuse.rgb;
 -		vec3 light_specular = gl_LightSource[i].specular.rgb;
 +		vec3 light_position = glLightSource[i].position.xyz;
 +		vec3 H = glLightSource[i].halfVector.xyz;
 +		vec3 light_diffuse = glLightSource[i].diffuse.rgb;
 +		vec3 light_specular = glLightSource[i].specular.rgb;
  
  		/* we mix in some diffuse so low roughness still shows up */
- 		float bsdf = 0.5 * pow(max(dot(N, H), 0.0), 1.0 / roughness);
+ 		float r2 = roughness * roughness;
+ 		float bsdf = 0.5 * pow(max(dot(N, H), 0.0), 1.0 / r2);
  		bsdf += 0.5 * max(dot(N, light_position), 0.0);
  		L += light_specular * bsdf;
  	}
@@@ -2728,28 -2615,12 +2728,27 @@@ void node_bsdf_anisotropic
  	node_bsdf_diffuse(color, 0.0, N, result);
  }
  
 -void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 N, out vec4 result)
 -{
 +void node_bsdf_glass(vec4 color, float roughness, float ior, vec3 N, float ssr_id, out Closure result)
 +{
 +#ifdef EEVEE_ENGINE
 +	vec3 out_spec, out_refr, ssr_spec;
- 	roughness = sqrt(roughness);
 +	vec3 refr_color = (refractionDepth > 0.0) ? color.rgb * color.rgb : color.rgb; /* Simulate 2 transmission event */
 +	eevee_closure_glass(N, vec3(1.0), int(ssr_id), roughness, 1.0, ior, out_spec, out_refr, ssr_spec);
 +	out_refr *= refr_color;
 +	out_spec *= color.rgb;
 +	float fresnel = F_eta(ior, dot(N, cameraVec));
 +	vec3 vN = normalize(mat3(ViewMatrix) * N);
 +	result = CLOSURE_DEFAULT;
 +	result.radiance = mix(out_refr, out_spec, fresnel);
 +	result.ssr_data = vec4(ssr_spec * color.rgb * fresnel, roughness);
 +	result.ssr_normal = normal_encode(vN, viewCameraVec);
 +	result.ssr_id = int(ssr_id);
 +#else
  	node_bsdf_diffuse(color, 0.0, N, result);
 +#endif
  }
  
 -void node_bsdf_toon(vec4 color, float size, float tsmooth, vec3 N, out vec4 result)
 +void node_bsdf_toon(vec4 color, float size, float tsmooth, vec3 N, out Closure result)
  {
  	node_bsdf_diffuse(color, 0.0, N, result);
  }
@@@ -2941,62 -2764,26 +2940,61 @@@ void node_bsdf_velvet(vec4 color, floa
  }
  
  void node_subsurface_scattering(
 -        vec4 color, float scale, vec3 radius, float sharpen, float texture_blur, vec3 N,
 -        out vec4 result)
 -{
 +        vec4 color, float scale, vec3 radius, float sharpen, float texture_blur, vec3 N, float sss_id,
 +        out Closure result)
 +{
 +#if defined(EEVEE_ENGINE) && defined(USE_SSS)
 +	vec3 out_diff, out_trans;
 +	vec3 vN = normalize(mat3(ViewMatrix) * N);
 +	result = CLOSURE_DEFAULT;
 +	result.ssr_data = vec4(0.0);
 +	result.ssr_normal = normal_encode(vN, viewCameraVec);
 +	result.ssr_id = -1;
 +	result.sss_data.a = scale;
 +	eevee_closure_subsurface(N, color.rgb, 1.0, scale, out_diff, out_trans);
 +	result.sss_data.rgb = out_diff + out_trans;
 +#ifdef USE_SSS_ALBEDO
 +	/* Not perfect for texture_blur not exaclty equal to 0.0 or 1.0. */
 +	result.sss_albedo.rgb = mix(color.rgb, vec3(1.0), texture_blur);
 +	result.sss_data.rgb *= mix(vec3(1.0), color.rgb, texture_blur);
 +#else
 +	result.sss_data.rgb *= color.rgb;
 +#endif
 +#else
  	node_bsdf_diffuse(color, 0.0, N, result);
 +#endif
  }
  
 -void node_bsdf_hair(vec4 color, float offset, float roughnessu, float roughnessv, vec3 tangent, out vec4 result)
 +void node_bsdf_refraction(vec4 color, float roughness, float ior, vec3 N, out Closure result)
  {
 -	result = color;
 +#ifdef EEVEE_ENGINE
 +	vec3 out_refr;
 +	color.rgb *= (refractionDepth > 0.0) ? color.rgb : vec3(1.0); /* Simulate 2 absorption event. */
- 	roughness = sqrt(roughness);
 +	eevee_closure_refraction(N, roughness, ior, out_refr);
 +	vec3 vN = normalize(mat3(ViewMatrix) * N);
 +	result = CLOSURE_DEFAULT;
 +	result.ssr_normal = normal_encode(vN, viewCameraVec);
 +	result.radiance = out_refr * color.rgb;
 +	result.ssr_id = REFRACT_CLOSURE_FLAG;
 +#else
 +	node_bsdf_diffuse(color, 0.0, N, result);
 +#endif /* EEVEE_ENGINE */
  }
  
 -void node_bsdf_refraction(vec4 color, float roughness, float ior, vec3 N, out vec4 result)
 +/* Unsupported for now */
 +#ifndef EEVEE_ENGINE
 +void node_bsdf_hair(vec4 color, float offset, float roughnessu, float roughnessv, vec3 tangent, out Closure result)
  {
 -	node_bsdf_diffuse(color, 0.0, N, result);
 +	result = Closure(color.rgb, color.a);
  }
  
 -void node_ambient_occlusion(vec4 color, out vec4 result)
 +void node_ambient_occlusion(vec4 color, out Closure result)
  {
 -	result = color;
 +	result = Closure(color.rgb, color.a);
  }
 +#endif /* EEVEE_ENGINE */
 +
 +#endif /* VOLUMETRICS */
  
  /* emission */



More information about the Bf-blender-cvs mailing list