     vec3 d1 = normalize( vec3(1.0, -0.5, -1.0) );
     vec4 bg_color = vec4( vec3(0.05, 0.14, 0.27)*0.5, 1.0 );
     
-   	vec2 res = rayMarch( camPos, rayDir, 10.0 );
+   	vec2 res = rayMarch( camPos, rayDir, 100.0 );
+	float zn = 0.999;
     if( res.x == -1.0 ) 
     {
         frag_color = bg_color;
-        gl_FragDepth = 0.9;
     }
     else
     {

        z *= fixed2_over_min2;
        dz *= fixed2_over_min2;
    }
    else if(r2 < fixed_radius2) 
    {
        float temp = (fixed_radius2 / r2);
        z *= temp;

        vec3 normal = getNormal(pos);//-dir*normalDistance*3.0);
        vec3 col = l0 * max( 0.0, dot( d0, normal) ) + l1 * max( 0.0, dot( d1, normal) ); 
        
        frag_color = mix( vec4( col, 1.0 ), bg_color, res.y );
        
        float zeye = dot( camDir, rayDir ) * -res.x;
        zn = z_var.x + z_var.y / zeye;
		//frag_color = vec4( vec3( clamp( 0.5 + 0.5*zn , 0.0, 1.0) ), 1 );
    }
	
    //float zc = ( proj_mat * vec4( res.x * rayDir, 1.0 ) ).z;
    //float wc = ( proj_mat * vec4( res.x * rayDir, 1.0 ) ).w;
    //gl_FragDepth = zc/wc;
	gl_FragDepth = zn;
}