varying vec2 texcoord;


uniform sampler2D depthtex1;
uniform float frameTimeCounter;
uniform float far;
uniform mat4 gbufferProjectionInverse;
uniform vec3 cameraPosition;

#include "/lib/taa/res_params.glsl"
#include "/lib/uniforms.glsl"

float phaseg(float x, float g) {
    float gg = g * g;
    return (gg * -0.25 + 0.25) * pow(-2.0 * (g * x) + (gg + 1.0), -1.5) / PI;
}
float luma(vec3 color)
{
    return dot(color, vec3(0.299, 0.587, 0.114));
}
#include "/lib/sky_gradient.glsl"

#include "/lib/clouds_bloop.glsl"

void main() {
    /* DRAWBUFFERS:6 */ 
    vec3 viewVector = mapUVToSphere(texcoord.xy);
    vec4 sky = vec4(skyLut2(viewVector, lightPos), 1.0);
    vec3 skyComp = (sky.rgb);
    vec4 cloud = renderClouds(1, viewVector, skyComp.rgb * 0.5);

    gl_FragData[0].rgb = skyComp;
    gl_FragData[0].a = luma(cloud.rgb);



}
