From 01ef7fd9738e4ac9d0c2fac539599ff1d8b16750 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 15 Sep 2013 20:57:24 +0200 Subject: [PATCH] The specular calculation is probably faster this way. --HG-- branch : gsoc2013-dfighter --- .../src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/nel/src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp b/code/nel/src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp index 5cf965ef1..4ddf4bfcc 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_glsl_shader_generator.cpp @@ -437,8 +437,10 @@ namespace NL3D ss << "{" << std::endl; ss << "vec3 normal3 = vnormal.xyz / vnormal.w;" << std::endl; ss << "normal3 = normalMatrix * normal3;" << std::endl; - ss << "vec3 reflection = reflect( normalize( -light" << num << "Dir ), normal3 );" << std::endl; - ss << "float angle = dot( normal3, reflection );" << std::endl; + //ss << "vec3 reflection = reflect( normalize( -light" << num << "Dir ), normal3 );" << std::endl; + ss << "vec3 halfVector = normalize( light" << num << "Dir + normal3 );" << std::endl; + //ss << "float angle = dot( normal3, reflection );" << std::endl; + ss << "float angle = dot( normal3, halfVector );" << std::endl; ss << "angle = max( 0.0, angle );" << std::endl; ss << "float si = pow( angle, 128.0 );" << std::endl; ss << "return si;" << std::endl;