paftdunk it has something to do with normals. on ray hit, get the normal vector of the hit point, then you can calculade othre angels.

I struggle with meths so i cant help you there, but i know it gotta do with normals.