Thank you for the explanation!
Sorry for late reply. I was at school.
What do you think?
Sorry, I don’t think I can provide anything useful as I’m inferior in these subjects compared to you. I’m currently talking to a Physicist, I will tell you anything that I find useful after talking to him.
So I have to 2 formulas:
t = (n(n•i)−i)nᵢ/nₜ−n√(1−(1−(n•i)²)(nᵢ/nₜ)²)
t = (i−n(n•i))nᵢ/nₜ−n√(1−(1−(n•i)²)(nᵢ/nₜ)²)
I don’t think I’m gonna use first one since it’s not OpenGL’s formula (which is what I’m told to be what Blender implemented as Vector Refraction), even though it outputs correct refracted vector. And the second one is what I transcribed from OpenGL’s code so I’m gonna use it.
Another reason I’m avoiding it is because its direction of the incident vector is not theoretically correct (as you said, in Physics, the incident vector is supposed to point inwards, but here, its incident vector is derived to point outwards).
Also, its i•n and t•n has different signs (whereas my latest calculation uses OpenGL’s formula which outputs same sign for both i•n and t•n. Why should I care? Because t•n should always have the same sign as i•n, as refraction doesn’t change the direction (whereas for reflection, n•r should always have the opposite sign to i•n).
Here are the derivations of the first formula, hope you’ll find them useful, you can see that in all the diagrams of these derivations, i is derived to point outwards:
- Slidetodoc.com (Derivation appears after clicking “next” 35 times)
- Ohio state edu (At slide 12)
- Stack Exchange (Images in the replies - it’s from a book)
I can’t find any derivation of the second one (OpenGL), apparently no one has ever derived it.
the formula is meaningless if the normal and incident vector have the same “overall direction”
Does it mean that my second calculation here doesn’t serve any purpose? Does it mean that, as long as n•i ≤ 0 , the function has a chance to output correct refracted vector and n•i > 0 will output incorrect vector?
I notice that, the side of the box whose incident vectors have opposite “overall direction” to the normal vector get refracted and outputted like that. But the side of the box whose incident vectors have the same “overall direction” to the normal vector just disappears. Actually those vectors don’t disappear but are overlaying the refracted vector, like this:

What do you think?
I’ll ask the blender devs as well
Yes sir. Do as you please.