raytracing.github.io
raytracing.github.io copied to clipboard
Book 1 Chapter 10.2 Snell's Law Unclear on the Length of Ray Directions for its Proof
In Chapter 10.2, Snell's Law
The book presents refracted ray formula as $$R' = R_{\perp}' + R_{\parallel}'$$
where $$R_{\perp}' = \frac{\eta}{\eta'} \left( R + \cos\theta \hat n \right)$$ $$R_{\parallel}' = - \sqrt{1 - |R_{\perp}'|^2} \hat n$$ for a given incoming ray $R$.
The book says
You can go ahead and prove this for yourself if you want, but we will treat it as fact and move on
Yet forgets to mention the important details: $R$ and $R'$ are unit vectors.
But to add more confusion, the book in Chapter 4.2 says
Note that I do not make the ray direction a unit length vector because I think not doing that makes for simpler and slightly faster code
In my opinion, the book at least should clarify that $R, R'$ are unit vectors, or present more general expression.
Here is my proof:
Snell's law states that $$\sin\theta' = \frac{\eta}{\eta'}\sin\theta$$
Assume $R$ and $R'$ are incoming rays and refracted rays respectively obeying Snell's Law. Also, we have $\hat n$, a unit normal vector, facing against the incoming ray.
Note that we can deconstruct $R'$ via $$R' = R_{\perp}' + R_{\parallel}'$$ where $R_{\perp}'$ is perpendicular to $\hat n$ and $R_{\parallel}'$ is parallel to $\hat n$.
Without loss of generality, assume a unit vector $\hat x$ is in the direction of $R_{\perp}'$ (ie. $\hat x = R_{\perp}' / |R_{\perp}'|$).
Then using trigonometry, one can see that $$R_{\perp}' = |R'|\sin\theta' \hat x $$ $$R_{\parallel}' = - |R'|\cos\theta' \hat n$$
By Snell's law, $$R_{\perp}' = |R'|\sin\theta' \hat x = |R'|\frac{\eta}{\eta'}\sin\theta \hat x$$ under suitable condition (ie. solution must exists).
Lemma: $\sin\theta \hat x = R/|R| + \cos\theta \hat n$
Consider $$R_{\perp}$$ where $$R = R_\perp + R_\parallel$$
Under 'right-hand rule' one can see that $(\hat n \times R) \times \hat n$ is in the direction of $\hat x$; hence there exists $\lambda \in \mathbb{R}^+$ such that $$\lambda \hat x = (\hat n \times R) \times \hat n$$
Then by Lagrange's formula $$\lambda \hat x = (\hat n \times R) \times \hat n = (\hat n \cdot \hat n)R - (\hat n \cdot R)\hat n = R + |R|\cos \theta \hat n$$
Consider $$|\lambda \hat x|^2 = \left|R + |R|\cos\theta \hat n\right|^2$$ $$\Rightarrow \lambda^2 = |R|^2 + 2|R|\cos\theta (R \cdot \hat n) + |R|^2 \cos^2 \theta$$ $$\Rightarrow \lambda^2 = |R|^2 - 2|R|^2\cos^2\theta + |R|^2 \cos^2 \theta = |R|^2 - |R|^2 \cos^2 \theta$$ $$\Rightarrow \lambda^2 = |R|^2 \left(1 - \cos^2\theta \right) = |R|^2 \sin^2\theta$$ $$\Rightarrow\lambda = |R| \sin\theta$$
Hence $$\lambda \hat x = |R| \sin\theta \hat x = R + |R|\cos\theta \hat n$$ or $$\sin\theta \hat x = \frac{R}{|R|} + \cos\theta \hat n$$
Now we are almost done with the proof.
Back to the proof
Again, consider $$R_\perp' = |R'| \frac{\eta}{\eta'}\sin \theta \hat x = |R'| \frac{\eta}{\eta'} \left(\frac{R}{|R|} + \cos\theta \hat n\right)$$ by the earlier lemma.
Since $|R'|^2 = |R_\parallel'|^2 + |R_\perp|^2$, $$\therefore R_\parallel' = -\sqrt{|R'|^2 - |R_\perp'|^2}\hat n$$
Conclusion
Thus, final formula for arbitrary length of $R$ and $R'$ are given by $$R_\perp' = |R'| \frac{\eta}{\eta'} \left(\frac{R}{|R|} + \cos\theta \hat n\right)$$ $$R_\parallel' = -\sqrt{|R'|^2 - |R_\perp'|^2}\hat n$$ which in general not equivalent to the given formula from the book.
However, if $R'$ and $R$ are both unit vector, this reduces to the expression given in the book: $$R_\perp' = \frac{\eta}{\eta'} \left(R+ \cos\theta \hat n\right)$$ $$R_\parallel' = -\sqrt{1 - |R_\perp'|^2}\hat n$$
Thanks for your proof. It helped me review some forgotten knowledge.👍
Thanks for your proof. It helped me review some forgotten knowledge.👍
I'm glad it helped ! :)
Are you open to moving this issue to a new discussion under the discussion tab?
Hi, I also prove this formula at the first time I learnt the book one. I think my proof is more intuitive and needs only senior high school knowledge. I write proof in LaTeX format and post it in my repo for reference.