I've messed with this shader several times. There are many things that can be optimized.

1) The vec_light[] array needs to start with 0, not 1. But you already caught that

2) You only need one Out.View in the vertex shader. Matt used multiple wiew texcoords, but they all return the same values.

3) Your Ambience is incorrectlt implemented. Change the ambient value to a simple float (instead of float4), and multiply the color by the ambient factor. [ex: 0.1 * color + 0.2 * Ambient becomes color.rgb * Ambient

4) While I did not have success, the way the lighting is calculated, and the attenuation could be optimized to run faster (use less math)...


xXxGuitar511
- Programmer