Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/134500491097939968
edited tags
Link
Tetrad
  • 30.1k
  • 12
  • 95
  • 143
deleted 2 characters in body; edited title
Source Link
user1430
user1430

Multiple point light sources Is there a way to use an arbitrary number of lights in a fragment shader?

Is there a way to pass an arbitrary number of light locations (and colors) for the fragment shader, and loop over them in the shader? 

If not, then how are multiple lights supposed to be simulated, for? For example with respect to diffuse directional lighting, for which you can't just pass a sum of the light weights for the shader.

Multiple point light sources in shader

Is there a way to pass an arbitrary number of light locations (and colors) for the fragment shader, and loop them in the shader? If not, then how are multiple lights supposed to be simulated, for example with respect to diffuse directional lighting, for which you can't just pass a sum of the light weights for the shader.

Is there a way to use an arbitrary number of lights in a fragment shader?

Is there a way to pass an arbitrary number of light locations (and colors) for the fragment shader, and loop over them in the shader? 

If not, then how are multiple lights supposed to be simulated? For example with respect to diffuse directional lighting, you can't just pass a sum of the light weights for the shader.

Source Link
NotRoyal
  • 191
  • 1
  • 1
  • 3

Multiple point light sources in shader

Is there a way to pass an arbitrary number of light locations (and colors) for the fragment shader, and loop them in the shader? If not, then how are multiple lights supposed to be simulated, for example with respect to diffuse directional lighting, for which you can't just pass a sum of the light weights for the shader.