

#include "/lib/taa/res_params.glsl"
varying vec4 color;
varying float NdotL;
uniform vec3 atmosphereUp;
uniform float far;
uniform float near;
flat varying vec3 torch;
varying vec3 viewVector;
varying vec2 lmtexcoord;
uniform mat4 gbufferModelViewInverse;
uniform sampler2D texture;

#include "/lib/color_transforms.glsl"
#include "/lib/uniforms.glsl"
float gbf(in vec3 eyePlayerPos, in float far)
{

    return smoothstep(0,length(eyePlayerPos.xz)*1.1, far);
}
/* RENDERTARGETS: 0 */
void main()
{
    vec3 p3 = mat3(gbufferModelViewInverse) * viewVector + gbufferModelViewInverse[3].xyz;

    vec4 color = texture(texture, lmtexcoord.xy) * color;
    color.rgb = toLinear(color.rgb) * (sunLight * NdotL + (atmosphereUp * 6.0) + torch);
    color.a = (gbf(p3, far));
    gl_FragData[0] = color;
}
