I couldn't figure out what was going wrong with my refraction code (It was broken in another way that I fixed, then this bug shows up). Then I suddenly realised that the normals were all screwy and there was "weird stuff" happening. So, after going through the debugger, I noticed this gem:
// If first intersection distance is < 0, ray starts inside usif(fInDist < 0){ // Does the intersection occur within the ray length? if(fOutDist > fLength) return false; // In primitive info.fIntersectPos = -1; info.fDist = fOutDist;}else{ // Does the intersection occur within the ray length? if(fInDist > fLength) return false; // Hit info.fIntersectPos = 1; info.fDist = fInDist;}info.fIntersectPos = 0;info.vNormal = (ray.vPos + info.fDist * ray.vDir) - m_vPos;info.vNormal.Normalise();return true;
And guess what value is multiplied by the normal when the function returns true? [sad]
Anyway, here's the current image:
![Working reftraction (I think...)](http://members.gamedev.net/EvilSteve/JournalStuff/Raytracer/Refraction.png)
It seems to be working correctly. I'll have to run a few more tests to actually check that though.
Anyway. End of lunch, back to work, etc.