   A problem of lighting in shaders
  I have read some tutorials and samples about lighting in VS or HLSL. But all of them use just one light. In a game, the number of lights will change, two in this scene, five in another...,but the lighting shaders must write offline.Any one have idea to deal with this?Thanks.--stephen 
  1. Have a set of premade shaders, and select according to what''s in the scene...2. Have a shader that accepts some maximum number of lights, and program the unused ones as black.3. Create shaders on the fly from pre-compiled pieces of shader.4. A mix of the above.5. Do per pixel lighting with many vs/ps passes like Doom3.6. Require a newer shader version which has loops and branches.7. A mix of the above