Hey!

If I understand correctly, light_range is stored in vecLightPos.w, so all above should sum up to something like this ?
Code
float custom_factor = 1;

for(int i = 0; i < 8; i++)
{
	if(vecLightDir[i].w > 0) // spotlight ?
	{
		float3 light_ray = Out.WorldPos - vecLightPos[i].xyz;
		float depth = dot(vecLightDir[i], light_ray);
		
		// saturate clips the value between 0 and 1
		// any negative value will result in 0, and any value above 1 wiil result in 1.
		float depth_factor = saturate(depth / vecLightPos[i].w);
		float radius = length(cross(vecLightDir[i], light_ray));
		float spot_factor = 1.0 - saturate(radius / (vecLightPos[i].w * depth_factor * custom_factor));
	}
}


Greets


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung