Commit 871b41c9 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[FIX] always provide a good normal for lighting

parent 9fd9d2aa
...@@ -112,6 +112,8 @@ vec4 blinnPhongIllumination( vec3 ambient, vec3 diffuse, vec3 specular, float sh ...@@ -112,6 +112,8 @@ vec4 blinnPhongIllumination( vec3 ambient, vec3 diffuse, vec3 specular, float sh
vec3 lightColor, vec3 ambientLight, vec3 lightColor, vec3 ambientLight,
vec3 normalDir, vec3 viewDir, vec3 lightDir ) vec3 normalDir, vec3 viewDir, vec3 lightDir )
{ {
normalDir *= sign( dot( normalDir, viewDir ) );
vec3 H = normalize( lightDir + viewDir ); vec3 H = normalize( lightDir + viewDir );
// compute ambient term // compute ambient term
...@@ -150,6 +152,8 @@ float blinnPhongIlluminationIntensity( float ambient, float diffuse, float specu ...@@ -150,6 +152,8 @@ float blinnPhongIlluminationIntensity( float ambient, float diffuse, float specu
float lightIntensity, float ambientIntensity, float lightIntensity, float ambientIntensity,
vec3 normalDir, vec3 viewDir, vec3 lightDir ) vec3 normalDir, vec3 viewDir, vec3 lightDir )
{ {
normalDir *= sign( dot( normalDir, viewDir ) );
vec3 H = normalize( lightDir + viewDir ); vec3 H = normalize( lightDir + viewDir );
// compute ambient term // compute ambient term
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment