     vec4 meanColor = vec4(0.0);
     vec4 meanNormal = vec4(0.0);
     vec4 meanPosition = vec4(0.0);
+    //vec4 positionArray[nAaSamples];
+    vec4 positionArray[8];
+    float maxAlpha = -1.0;
     for (int i = 0; i < nAaSamples; i++) {
       meanNormal   += texelFetch(mainNormalReflectanceTexture, ivec2(gl_FragCoord), i);
-      meanColor    += texelFetch(mainColorTexture, ivec2(gl_FragCoord), i);
+      vec4 color = texelFetch(mainColorTexture, ivec2(gl_FragCoord), i);
+      if ( color.a > maxAlpha )
+        maxAlpha = color.a;
+      meanColor += color;
       meanPosition += texelFetch(mainPositionTexture, ivec2(gl_FragCoord), i);
+      positionArray[i] = texelFetch(mainPositionTexture, ivec2(gl_FragCoord), i);
       //     geoDepth += denormalizeFloat(texelFetch(mainDepthTexture, ivec2(gl_FragCoord), i).x);
     }
     meanColor    /= nAaSamples;

    meanPosition /= nAaSamples;
    // geoDepth /= nAaSamples;

    //meanNormal.xyz = normalize(meanNormal.xyz);
    
    // Ray in object space

          vec3 inscatterColor = inscatterRadiance(x, tF, irradianceFactor, v,
                                                  s, r, mu, attenuation, 
                                                  vec3(fragObjectCoords.xyz),
                                                  maxLength, pixelDepth,
                                                  meanColor); 
          vec3 groundColor    = groundColor(x, tF, v, s, r, mu, attenuation,
                                            meanColor, meanNormal, irradianceFactor);
          vec3 sunColor       = sunColor(x, tF, v, s, r, mu, irradianceFactor); 
