#define SCATTERING

float4 vExtInscMultipliers;
float4 vSunColorIntensity;
float4 vBetaRayleigh;
float4 vBetaDashRayleigh;
float4 vBetaMie;
float4 vBetaDashMie;
float4 vBetaRayleighMie;
float4 vOneOverBetaRM;
float4 vHG;
float4 vConstants;
//float3 vFogColor	= float3(0.51f, 0.58f, 0.66f);//old fog color
float3 vFogColor	= float3(0.45f, 0.5f, 0.6f);//new fog color - magenta
float2 FogStartEnd	= float2(0.0f, 5000.0f);//density=100 meters

float4 Scattering(float3 vPos, float3 vEyePos, float3 vLightDir, float4 color)
{
	float3 vEyeVert = vEyePos - vPos; 
	float dist = length(vEyeVert.xyz);

	float fog = (FogStartEnd.y - dist)/(FogStartEnd.y - FogStartEnd.x);
	//fog = min(fog, 1);
        fog=saturate(fog);
	color.rgb = lerp(vFogColor.xyz, color.rgb, fog);
        return color;
}
