[Bf-blender-cvs] [0951ea2] master: OpenSubdiv: Support shadeless shading

Sergey Sharybin noreply at git.blender.org
Mon Aug 3 20:21:44 CEST 2015


Commit: 0951ea2c6d6f013c79fb82337f9e75b64cd32f06
Author: Sergey Sharybin
Date:   Mon Aug 3 20:18:33 2015 +0200
Branches: master
https://developer.blender.org/rB0951ea2c6d6f013c79fb82337f9e75b64cd32f06

OpenSubdiv: Support shadeless shading

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

M	intern/opensubdiv/gpu_shader_opensubd_display.glsl

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

diff --git a/intern/opensubdiv/gpu_shader_opensubd_display.glsl b/intern/opensubdiv/gpu_shader_opensubd_display.glsl
index fb46971..110898a 100644
--- a/intern/opensubdiv/gpu_shader_opensubd_display.glsl
+++ b/intern/opensubdiv/gpu_shader_opensubd_display.glsl
@@ -246,15 +246,13 @@ void main()
 			float diffuse_bsdf = max(dot(N, light_direction), 0.0);
 			L_diffuse += light_diffuse * diffuse_bsdf;
 
+			/* Specular light. */
 			vec4 Plight = lightSource[i].position;
 			vec3 l = (Plight.w == 0.0)
 				? normalize(Plight.xyz) : normalize(Plight.xyz -
 				                                    inpt.v.position.xyz);
-
-			/* Specular light. */
 			vec3 light_specular = lightSource[i].specular.rgb;
 			vec3 H = normalize(l + vec3(0,0,1));
-
 			float specular_bsdf = pow(max(dot(N, H), 0.0),
 			                          shininess);
 			L_specular += light_specular * specular_bsdf;
@@ -325,7 +323,9 @@ void main()
 
 	/* Sum lighting. */
 	vec3 L = /*gl_FrontLightModelProduct.sceneColor.rgb +*/ L_diffuse;
-	L += L_specular * specular.rgb;
+	if (shininess != 0.0f) {
+		L += L_specular * specular.rgb;
+	}
 
 	/* Write out fragment color. */
 	gl_FragColor = vec4(L, alpha);




More information about the Bf-blender-cvs mailing list