Ray-Sphere-Intersection in postprocessing

I am working on a cloud shader. I have several raysphere intersectios. when i’m inside a sphere there are no problems. but when i’m outside of a sphere, i always get really ugly lines. I assume this is due to the fact that the sphere always interacts with the ray from the inside to the outside, but not when i’m outside. the antialiasing function of three.js logically doesn’t work in my postprocessing shader. does anyone have an idea for a ray sphere intersection function with anti-aliasing in postprocessing?

//my RaySphereIntersection function

	int RayIntersectsSphere(vec3 rayStart, vec3 rayDir, vec3 sphereCenter, float sphereRadius, out vec2 t){
	
		normalize(rayDir);
		vec3 oc = (rayStart - sphereCenter);
		float b = 2.0 * dot(oc, rayDir);
		float c = dot(oc, oc) - sphereRadius * sphereRadius;
		float d =  b * b - 4.0 * c;
    

		if(abs(d) - 0.0001 <= 0.0){ 		
			t.x = t.y = 0.0; 		
			return 0; 	
		} 	
		else {
			float q = -0.5 * (b + sign(b) * sqrt(d));
			float r0 = c/q;
			float r1 = q;

			t.x = min(r0, r1);
			t.y = max(r0, r1);	
		
			if(t.x < 0.0){ 			
				t.x = t.y; 			
				if(t.x < 0.0){ 				
					return 0;
				} 		
				return 1;
			} 		
			return 2;
		}
	}