Hello Guest

Pixel Shader for a 2D Light

  • 3 Replies
  • 10840 Views
Pixel Shader for a 2D Light
« on: August 11, 2009, 02:30:03 »
« Last Edit: August 11, 2009, 02:33:06 by Wolftein »

Re: Pixel Shader for a 2D Light
« Reply #1 on: August 11, 2009, 08:55:16 »
Maybe you mixed up various coordinates spaces.

From the GLSL spec:
"The variable gl_FragCoord is available as an input variable from within fragment shaders and it holds the
window relative coordinates x, y, z, and 1/w values for the fragment."

Are your lightPosition and lightSize in the same space and range?

Also, what's the point of this call?
vec4 attColor = mix( attenuationColor , texColor  ,lightColor);
It calculates (tex + light * int) (1 - light) + tex * light, which is a strange lighting function. For example a white light at full intensity only shows the tex colour. A black light also only shows the tex colour.
« Last Edit: August 11, 2009, 08:58:07 by Ciardhubh »

Re: Pixel Shader for a 2D Light
« Reply #2 on: August 12, 2009, 18:54:09 »

Re: Pixel Shader for a 2D Light
« Reply #3 on: August 12, 2009, 21:39:53 »
« Last Edit: August 12, 2009, 21:46:47 by Ciardhubh »