 
 	for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {
 
-		vec3 lightColor = spotLightColor[ i ];
+		IncidentLight directLight = getSpotDirectLight( pointLights[ i ], geometry );
 
-		vec3 lightPosition = spotLightPosition[ i ];
-		vec3 lVector = lightPosition + vViewPosition.xyz;
-		vec3 lightDir = normalize( lVector );
+		BRDF_Lambert( directLight, geometry, diffuse, directReflectedLight );
 
-		float spotEffect = dot( spotLightDirection[ i ], lightDir );
-
-		if ( spotEffect > spotLightAngleCos[ i ] ) {
-
-			spotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );
-
-			// attenuation
-
-			float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );
-
-			attenuation *= spotEffect;
-
-			// diffuse
-
-			float cosineTerm = saturate( dot( normal, lightDir ) );
-
-			totalDiffuseLight += lightColor * attenuation * cosineTerm;
-
-			// specular
-
-    		vec3 brdf = BRDF_GGX( specularColor, roughnessFactor, normal, lightDir, viewDir );
-
-			totalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;
-
-		}
+		BRDF_GGX( directLight, geometry, specularColor, roughnessFactor, directReflectedLight );
 
 	}
 


	for ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {

		vec3 lightColor = directionalLightColor[ i ];

		vec3 lightDir = directionalLightDirection[ i ];

		// diffuse

		float cosineTerm = saturate( dot( normal, lightDir ) );

		totalDiffuseLight += lightColor * cosineTerm;

		// specular

    	vec3 brdf = BRDF_GGX( specularColor, roughnessFactor, normal, lightDir, viewDir );

		totalSpecularLight += brdf * specularStrength * lightColor * cosineTerm;

	}

#endif


// roughness linear remapping

