fragment shader directional light positioning with camera

Posted by meWantToLearn on Game Development See other posts from Game Development or by meWantToLearn
Published on 2013-11-12T12:36:32Z Indexed on 2013/11/12 16:00 UTC
Read the original article Hit count: 263

Filed under:
|
|
|

Im trying to set up directional lighting in the fragment shader. So the direction of my light moves with the camera position.

      #version 150 core

      uniform sampler2D diffuseTex;     
      uniform vec4 lightColour;
      uniform vec3 lightDirection;

      vec3 LNorm     = normalize(lightDirection);
  vec3 normal    = normalize(IN.normal);
      vec3 calColour = lightColour[i].rgb  * intensity; 
  gl_FragColor   = vec4(diffuse.rbg * calColour, diffuse.a); 

It lights the entire scene.

© Game Development or respective owner

Related posts about opengl

Related posts about glsl