It's easy to find guides to calculating the transmitted direction of light given an incoming direction, the normal, and indexes of refraction. However, I can't find anything about determining the normal, given all the other information. That's understandable because it's a bit of an odd thing to do, but I think I need it in my bidirectional path tracer to correctly weight paths that involve a microfacet surface. Even if it turns out that I don't, at this point I'm curious. I know that it's not possible if both indexes of refraction are the same, but that's fine.
2 Answers
See equation (16) in Microfacet Models for Refraction through Rough Surfaces : $-(\eta_i w_i + \eta_o w_o)$ which you'll probably want to normalize. $\eta$ are the two indices of refraction and $w$ the two vectors (they use $i$ and $o$ in the paper). Also look at the left part of figure 7 on the same page to see where all the vectors are pointing.
-
$\begingroup$ Thank you so much! I've read that paper several times and somehow just glossed over that part. $\endgroup$ Commented Jul 2, 2018 at 17:39
It should be possible I think. Take the reflection equation:
R = 2*Dot(N,I)*N -I, where I is the incidence.
Make an equation for every component of the vector i.e. x,y,z
You now have 3 equations and 3 unknowns. However, due to Dot(N,I)*N, I don't think this system is linear. So a unique solution probably wont exist.
But why do you need this? If you have an intersection point at a surface, you should have the normal for that surface?
Hope this helps
-
$\begingroup$ So, yes I know the "true normal" at any point on the surface, but microfacet BRDFs work by treating every point as having many very small facets whose normals are different from the true normal, and you pick one from a probability distribution. Connecting edges in bidirectional path tracing requires being able to determine the probability of generating point x + 1 given point x, which would depend on what normal you get from the distribution. I want to be able to say "ok I need this particular normal to make this bounce happen" so I can ask the distribution how likely that is. $\endgroup$ Commented Jun 27, 2018 at 21:57
-
$\begingroup$ For reflection, normalize(R + I) = N unless dot(R, I) == 0, in which case there's no collision anyway. Refraction is the tricky part. $\endgroup$ Commented Jun 27, 2018 at 22:03
-
$\begingroup$ haha. of course R+I. Man I wrote some very useless complicated stuff. I can recommend this blog post which is a very good treatment of fersnel. seblagarde.wordpress.com/2013/04/29/memo-on-fresnel-equations $\endgroup$ Commented Jun 27, 2018 at 22:07