I am writing a ray tracer. So far I'm distracted, Blinn's coverage and thoughts. Something went wrong with my refractions, and I have no idea what. I hope someone can help me. 
I have a large red diffuse + Blinn sphere and a small refracting one with a refractive index of n = 1.5.
Little is simply contrived.
Relevant Code:
ReflectiveSurface::ReflectiveSurface(const Color& _n, const Color& _k) : F0(Color(((_n - 1)*(_n - 1) + _k * _k) / ((_n + 1)*(_n + 1) + _k * _k))) {} Color ReflectiveSurface::F(const Point& N, const Point& V) const { float cosa = fabs(N * V); return F0 + (F0 * (-1) + 1) * pow(1 - cosa, 5); } Color ReflectiveSurface::getColor(const Incidence& incidence, const Scene& scene, int traceDepth) const { Point reflectedDir = reflect(incidence.normal, incidence.direction); Ray ray = Ray(incidence.point + reflectedDir * epsilon, reflectedDir); return F(incidence.normal, incidence.direction) * scene.rayTrace(ray, traceDepth + 1); } Point ReflectiveSurface::reflect(const Point& N, const Point& V) const { return V - N * (2 * (N * V)); } bool RefractiveSurface::refractionDir(Point& T, Point& N, const Point& V) const { float cosa = -(N * V), cn = n; if (cosa < 0) { cosa = -cosa; N = N * (-1); cn = 1 / n; } float disc = 1 - (1 - cosa * cosa) / cn / cn; if (disc < 0) return false; T = V / cn + N * (cosa / cn - sqrt(disc)); return true; } RefractiveSurface::RefractiveSurface(float _n, const Color& _k) : ReflectiveSurface(Color(1, 1, 1) * _n, _k) {} Surface* RefractiveSurface::copy() { return new RefractiveSurface(*this); } Color RefractiveSurface::getColor(const Incidence& incidence, const Scene& scene, int traceDepth) const { Incidence I = Incidence(incidence); Color reflectedColor, refractedColor; Point direction = reflect(I.normal, I.direction); Ray reflectedRay = Ray(I.point + direction * epsilon, direction); if (refractionDir(direction, I.normal, I.direction)) { Ray refractedRay = Ray(I.point + direction * epsilon, direction); Color colorF = F(I.normal, I.direction); reflectedColor = colorF * scene.rayTrace(reflectedRay, traceDepth + 1); refractedColor = (Color(1, 1, 1) - colorF) * scene.rayTrace(refractedRay, traceDepth + 1); } else { reflectedColor = scene.rayTrace(reflectedRay, traceDepth + 1); } return reflectedColor + refractedColor; }
The code is everywhere since this is homework, and I am not allowed to include additional headers, and I have to send it to one cpp file, so I had to separate each class before direct declaration, declaration and implementation in this single file. It makes me vomit, but I tried to keep it as clean as possible. There are tons of code, so I included only what, in my opinion, was the most related. ReflectiveSurface is the parent class of RefractiveSurface. N is the surface normal, V is the beam direction vector, this normal, n is the refractive index. The incidence structure has a point, a normal and a direction vector.
Formulas for the approximation of Fรถrsel and the refractive vector, respectively: 
In the code that I use, the epsilon * beam direction value can be seen to avoid shadow blackheads caused by float inaccuracies. However, something similar happens with a small sphere. Another screenshot: 

As you can see, the sphere does not look transparent, but inherits the color of the diffuse sphere. It also usually has a few white pixels.
Without refraction:
