diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-03 21:18:33 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-08-03 21:18:33 +0300 |
commit | 0951ea2c6d6f013c79fb82337f9e75b64cd32f06 (patch) | |
tree | ab84f22cf68fcd84e7b3d55d8414482696c509cb /intern/opensubdiv | |
parent | c2dc6aa9461046787b605c0c9620e98e1e737384 (diff) |
OpenSubdiv: Support shadeless shading
Diffstat (limited to 'intern/opensubdiv')
-rw-r--r-- | intern/opensubdiv/gpu_shader_opensubd_display.glsl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/intern/opensubdiv/gpu_shader_opensubd_display.glsl b/intern/opensubdiv/gpu_shader_opensubd_display.glsl index fb46971bce8..110898ad917 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); |