             discard;
         }
         //renderTarget = vec4(1.0, 0.0, 0.0, 1.0);
-        
     }
 }
 

                                                            s, r, mu, attenuation, 
                                                            vec3(positionObjectsCoords.xyz),
                                                            groundHit, maxLength, pixelDepth,
                                                            color, sunIntensityInscatter); 
                    vec3 groundColorV = vec3(0.0);
                    vec3 sunColorV = vec3(0.0);                                                
                    if (groundHit) {

    if (groundHit) {
        return finalScatteringRadiance;
    } else {
        // Linearizing the stars contribution based on the observer's position (height)
        float cosTheta = dot(normalize(x0), normalize(s));
        float cosPhi = dot(normalize(v), normalize(s));
        if (cosTheta == 0.0 && cosPhi < 0.6) {
            return spaceColor.rgb * backgroundConstant + finalScatteringRadiance;
        } else {
            return ((r-Rg) * invRtMinusRg) * spaceColor.rgb * backgroundConstant + finalScatteringRadiance;
        }
    }
    
}
