uniform samplerCube texture;
uniform sampler2D noise_texture;
uniform vec4 lightpos;
varying vec3 direction;
varying vec3 place;


void main()
{

    float airlight = 0.0;
    vec3 jea = place;
    //vec3 real_dir = normalize(direction-place) * 100.0/300.0;//(length(direction-place)/100.0);
    for(int i=0;i<299;i++)
    {
        jea += direction;
        float diist = length(jea-lightpos.xyz);
        if(textureCube(texture, normalize(jea-lightpos.xyz)).x*1000.0>diist)
        {
            airlight += (1.7)/(diist*diist);
        }

    }

	gl_FragData[0] = gl_Color;// * shadow * texture2D(texturee,gl_TexCoord[0]);
	gl_FragData[1] = airlight*lightpos.w;
	gl_FragData[2] = vec4(gl_FragCoord.z, 0.0, 0.0, 1.0);
}
