     Final = mix(Final, EnvColor, Fresnel(dot(Normal, ViewDir), EnvReflectance));
 #endif
 
-    return Final;
+    return vec4(Final,alpha);
+
 }
 
 void main()
 {
-    gl_FragColor = vec4(mainFS(), 0);
-}
-
-#endif
-
+    gl_FragColor = mainFS();
+}
+
+#endif
+

    vec3 ViewDir  = normalize(ViewDirection);
    vec3 LightDir = normalize(LightDirection);

#if defined(ExponentialMapping)
    Texcoord = Pow(fract(Texcoord) - 0.5, ExpScale) + 0.5;
#endif

#if defined(DiffuseMap_Present)
    // Read the diffuse map
    vec3 DiffuseTexColor = texture2D(DiffuseMap, Texcoord).xyz;

    // Adjust contrast if needed
#if defined(DiffuseMap_AdjustContrast)

varying vec3 ViewDirection;
varying vec3 LightDirection;

vec4 mainFS()
{
#if defined(DistanceBasedCutting)
    if (distance(Position, ClipOrigin) > ClipDistance) discard;
