 
 	//Fresnel term (Schlick's approximation)
 	//Formula:
-	//	lerp( 1, (1 - V*H)^5, F0 )
+	//	lerp( (1 - V*H)^5, 1, F0 )
 	@insertpiece( FresnelType ) fresnel = F0 + pow( 1.0f - VdotH, 5.0f ) * (1.0f - F0);
 
 @property( envprobe_map )	vec3 Rs = ( envColour * fresnel * R * G  ) / (4.0f * NdotV * NdotL);@end
 @property( !envprobe_map )	@insertpiece( FresnelType ) Rs = ( fresnel * R * G  ) / (4.0f * NdotV * NdotL);@end
 
-	return max(0.0f, NdotL) * (kS[lightIdx] * lightSpecular[lightIdx] * Rs @insertpiece( MulSpecularMapValue ) +
-							   kD[lightIdx] * lightDiffuse[lightIdx] @insertpiece( MulDiffuseMapValue ));
+	return NdotL * (kS * lightSpecular[lightIdx] * Rs @insertpiece( MulSpecularMapValue ) +
+				   kD * lightDiffuse[lightIdx] @insertpiece( MulDiffuseMapValue ));
 }
 
 @property( hlms_num_shadow_maps )@piece( DarkenWithShadow ) * getShadow( texShadowMap[@value(CurrentShadowMap)], psPosL@value(CurrentShadowMap), invShadowMapSize[@counter(CurrentShadowMap)] )@end @end


vec3 cookTorrance( int lightIdx, vec3 viewDir, float NdotV )
{
	vec3 lightDir = (psPos - lightPosition[lightIdx].xyz) * lightPosition[lightIdx].w;

	vec3 halfWay= normalize( lightDir + viewDir );
	float NdotL = dot( nNormal, lightDir );
	float NdotH = dot( nNormal, halfWay );
	float VdotH = dot( viewDir, halfWay );

@property( diffuse_map )	vec4 diffuseCol = texture( texDiffuseMap, psUv0 );@end
@property( specular_map )

@property( hlms_lights_point || hlms_lights_spot )
	float fDistance	= length( psPos );
	float sqDistance= fDistance * fDistance;
	vec3 viewDir	= -psPos * (1.0f / fDistance);@end
	float NdotV		= clamp( dot( nNormal, viewDir ), 0.0f, 1.0f );

	vec3 finalColour = vec3(0);
@property( hlms_lights_directional )
