• Create Account

### #ActualPixelSmasher

Posted 31 March 2013 - 10:19 AM

  frag_normal = normalize(WorldMatrix * vec4(vert_normal, 1.0));


In homogenous coordinates, the last "w" scalar value set to 1.0 means that vert_normal is a point. As it is a mere unpositioned vector, i think using 0.0 should fix your bug.

Moreover, normalizing the interpolation variable frag_normal (set as "smooth out" and "smooth in" by default) will lead to incorrect normal vectors as they won't stay normed during their interpolation across vertices. You should normalize it in the fragment shader.

### #6PixelSmasher

Posted 29 March 2013 - 05:56 PM

  frag_normal = normalize(WorldMatrix * vec4(vert_normal, 1.0));


In homogenous coordinates, the last "w" scalar value set to 1.0 means that vert_normal is a point. As it is a mere unpositioned vector, i think using 0.0 should fix your bug.

Moreover, normalizing the interpolation variable frag_normal (set as "smooth out" and "smooth in" by default) will lead to incorrect normal vectors as they won't stay normed during their interpolation across vertices. You should normalizing it in the fragment shader.

### #5PixelSmasher

Posted 29 March 2013 - 05:55 PM

  frag_normal = normalize(WorldMatrix * vec4(vert_normal, 1.0));


In homogenous coordinates, the last "w" scalar value set to 1.0 means that vert_normal is a point. As it is a mere unpositioned vector, i think using 0.0 should fix your bug.

Moreover, normalizing the interpolation variable frag_normal (set as "smooth out" and "smooth in" by default) will lead to incorrect normal vectors as they won't stay normed during their interpolation. You should normalizing it in the fragment shader.

### #4PixelSmasher

Posted 29 March 2013 - 05:51 PM

  frag_normal = normalize(WorldMatrix * vec4(vert_normal, 1.0));


In homogenous coordinates, the last "w" scalar value set to 1.0 means that vert_normal is a point. As it is a mere unpositioned vector, i think using 0.0 should fix your bug.

### #3PixelSmasher

Posted 29 March 2013 - 05:51 PM

  frag_normal = normalize(WorldMatrix * vec4(vert_normal, 1.0));


In homogenous coordinates, the last "w" scalar value means that vert_normal is a point. As it is a mere unpositioned vector, i think using 0.0 should fix your bug.

### #2PixelSmasher

Posted 29 March 2013 - 05:50 PM

  frag_normal   = normalize(WorldMatrix * vec4(vert_normal, 1.0));