Oops, hadn't seen the other comments yet.
@Laguna, 2 jobs ago we had a folder for these kinds of mistakes the whole team could post to. I still remember from time to time. "That's one for the 'found' art folder". So I guess I'm more likely than the average person to save their mistakes now?
@toasty Various causes, I seem to remember:
@voxel Yes I am! :-) At the moment these glitches look better than the more correctly functioning shader though ….
Initially I had planned to retool/simplify the raytracer I had so it could do raycasting, but I abandonned that and am instead making a branch where I throw out all of the 'arbitrary oriented triangle' stuff I had and focus on speheres and axis aligned cubes instead. Which I feel is still a bit in the spirit of raycasting being a simplified raytracing.
To compensate I plan to give rays a role in the gameplay as well. If I get that far before the deadline!