Skip to main content
3 of 3
edited tags
Tetrad
  • 30.1k
  • 12
  • 95
  • 143

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.

NotRoyal
  • 191
  • 1
  • 1
  • 3