Ok yeah, if you do want to go nuts:
Use the same vertex shader as above.
This will allow, 2 spotlights, 8 pointlights, ambient lighting, pixelation if wanted, blending and alpha.
If anyone needs example code, give a shout. I'll keep posting shaders as I perfect them, if only to have an online safekeeping
sprite_2spot_8point_pixelate_amb.ps
uniform sampler2D texture0;
varying vec2 uvVarying;
varying vec2 posVarying;
varying vec4 colorVarying;
uniform float pixelate;
uniform vec4 PLightPos1;
uniform vec4 PLightCol1;
uniform vec4 PLightPos2;
uniform vec4 PLightCol2;
uniform vec4 PLightPos3;
uniform vec4 PLightCol3;
uniform vec4 PLightPos4;
uniform vec4 PLightCol4;
uniform vec4 PLightPos5;
uniform vec4 PLightCol5;
uniform vec4 PLightPos6;
uniform vec4 PLightCol6;
uniform vec4 PLightPos7;
uniform vec4 PLightCol7;
uniform vec4 PLightPos8;
uniform vec4 PLightCol8;
uniform vec4 spotLightCol1;
uniform vec4 spotLightDir1;
uniform vec4 spotLightPos1;
uniform vec4 spotLightCol2;
uniform vec4 spotLightDir2;
uniform vec4 spotLightPos2;
uniform float ambient;
vec3 spotColor1;
vec3 spotColor2;
vec4 finalColor;
vec2 spotVector;
vec2 fragVector;
float angle;
float dl;
float f = 1.0;
float d;
float atten;
float cutoff;
void main()
{
// pixelate: set "pixelate" to anything between 0.1 and size of sprite to pixelate
vec2 uv = uvVarying;
if (pixelate > 0.1 ) {
vec2 divs = vec2(pixelate, pixelate);
uv = floor(uvVarying * divs)/ divs;
}
d = distance(PLightPos1.xy, posVarying.xy);
atten = pow(max(0.0, 1.0 - (d / (PLightPos1.z * 2))), f + 1.0);
atten = atten / 200.0;
vec3 color1 = PLightCol1.rgb * atten;
d = distance(PLightPos2.xy, posVarying.xy);
atten = pow(max(0.0, 1.0 - (d / (PLightPos2.z * 2))), f + 1.0);
atten = atten / 200.0;
vec3 color2 = PLightCol2.rgb * atten;
d = distance(PLightPos3.xy, posVarying.xy);
atten = pow(max(0.0, 1.0 - (d / (PLightPos3.z * 2))), f + 1.0);
atten = atten / 200.0;
vec3 color3 = PLightCol3.rgb * atten;
d = distance(PLightPos4.xy, posVarying.xy);
atten = pow(max(0.0, 1.0 - (d / (PLightPos4.z * 2))), f + 1.0);
atten = atten / 200.0;
vec3 color4 = PLightCol4.rgb * atten;
d = distance(PLightPos5.xy, posVarying.xy);
atten = pow(max(0.0, 1.0 - (d / (PLightPos5.z * 2))), f + 1.0);
atten = atten / 200.0;
vec3 color5 = PLightCol5.rgb * atten;
d = distance(PLightPos6.xy, posVarying.xy);
atten = pow(max(0.0, 1.0 - (d / (PLightPos6.z * 2))), f + 1.0);
atten = atten / 200.0;
vec3 color6 = PLightCol6.rgb * atten;
d = distance(PLightPos7.xy, posVarying.xy);
atten = pow(max(0.0, 1.0 - (d / (PLightPos7.z * 2))), f + 1.0);
atten = atten / 200.0;
vec3 color7 = PLightCol7.rgb * atten;
d = distance(PLightPos8.xy, posVarying.xy);
atten = pow(max(0.0, 1.0 - (d / (PLightPos8.z * 2))), f + 1.0);
atten = atten / 200.0;
vec3 color8 = PLightCol8.rgb * atten;
spotVector = normalize(spotLightDir1.xy - spotLightPos1.xy);
fragVector = normalize(posVarying.xy - spotLightPos1.xy);
angle = dot(spotVector, fragVector);
angle = max(angle,0);
float cutoff = radians(58.0 - (spotLightDir1.z * 0.317));
if( angle > cutoff ) {
d = distance(posVarying.xy, spotLightPos1.xy);
float dl = length(spotLightPos1.xy - spotLightDir1.xy);
float radius = length(posVarying.xy - spotLightPos1.xy);
atten = pow(max(0.0, 1.0 - (d / dl)), f + 1.0);
atten = atten / 100;
float falloff = 1.0 - (1.0 - angle) * 1.0/(1.0 - cutoff);
spotColor1 = spotLightCol1.rgb * atten * falloff;
}
else {
spotColor1 = vec3 (0,0,0);
}
spotVector = normalize(spotLightDir2.xy - spotLightPos2.xy);
fragVector = normalize(posVarying.xy - spotLightPos2.xy);
angle = dot(spotVector, fragVector);
angle = max(angle,0);
cutoff = radians(58.0 - (spotLightDir2.z * 0.317));
if( angle > cutoff ) {
d = distance(posVarying.xy, spotLightPos2.xy);
float dl = length(spotLightPos2.xy - spotLightDir2.xy);
float radius = length(posVarying.xy - spotLightPos2.xy);
atten = pow(max(0.0, 1.0 - (d / dl)), f + 1.0);
atten = atten / 100;
float falloff = 1.0 - (1.0 - angle) * 1.0/(1.0 - cutoff);
spotColor2 = spotLightCol2.rgb * atten * falloff;
}
else {
spotColor2 = vec3 (0,0,0);
}
vec4 alpha = texture2D(texture0, uvVarying).aaaa;
alpha = alpha * colorVarying.aaaa;
finalColor = clamp(vec4(color1,1) + vec4(color2,1) + vec4(color3,1) + vec4(color4,0)+ vec4(color5,1)+ vec4(color6,1)+ vec4(color7,1)+ vec4(color8,1)+vec4(spotColor1,1)+vec4(spotColor2,1),ambient,1.0);
gl_FragColor = alpha * texture2D(texture0, uv) * finalColor * colorVarying;
}
My hovercraft is full of eels