Commit be48b57c by Sebastian Eichelbaum

[FIX #203] proper lighting for teem glyphs works again. Main-Problem was not…

[FIX #203] proper lighting for teem glyphs works again. Main-Problem was  not multiplying the normal with gl_NormalMatrix
parent 85ae660c
......@@ -22,40 +22,13 @@
//
//---------------------------------------------------------------------------
#include "WGEColorMaps.glsl"
#include "WGELighting-fragment.glsl"
#include "WGEShadingTools.glsl"
// The ray's starting point in texture space
varying vec3 v_rayStart;
// The ray direction in texture space
varying vec3 v_ray;
// the Surface normal at this point
varying vec3 v_normal;
// The light source in local coordinates
varying vec3 v_lightSource;
void main()
{
vec4 col;
float light = blinnPhongIlluminationIntensity(
0.1, // material ambient
0.75, // material diffuse
1.3, // material specular
10.0, // shinines
1.0, // light diffuse
0.75, // light ambient
normalize( v_normal ), // normal
normalize( v_ray ), // view direction
normalize( v_lightSource ) // light source position
);
col = light * gl_Color;
col.a = 1.0;
gl_FragColor = col;
float light = blinnPhongIlluminationIntensity( normalize( v_normal ) );
gl_FragColor = vec4( gl_Color.xyz * light, gl_Color.a );
}
......@@ -22,37 +22,15 @@
//
//---------------------------------------------------------------------------
#include "WGELighting-vertex.glsl"
#include "WGETransformationTools.glsl"
// The ray's starting point in texture space
varying vec3 v_rayStart;
// The ray direction in texture space
varying vec3 v_ray;
#version 120
// the Surface normal at this point
varying vec3 v_normal;
// The light source in local coordinates
varying vec3 v_lightSource;
void main()
{
prepareLight();
v_normal = gl_Normal;
v_normal = gl_NormalMatrix * gl_Normal;
// transform the ray direction to texture space, which equals object space
// Therefore use two points, as we transform a vector
vec4 camLookAt = vec4( 0.0, 0.0, -1.0, 1.0 );
vec4 camPos = vec4( 0.0, 0.0, 0.0, 1.0 );
v_ray = worldToLocal( camLookAt, camPos ).xyz;
// also get the coordinates of the light
vec4 lpos = gl_LightSource[0].position;
lpos = vec4( 0.0, 0.0, 1000.0, 1.0 );
v_lightSource = worldToLocal( lpos ).xyz;
gl_FrontColor = gl_Color;
gl_Position = ftransform();
}
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