Latexluv opened this issue on Jun 04, 2010 · 182 posts
bagginsbill posted Mon, 21 June 2010 at 6:43 PM
Quote - Without any answers, I'm starting to wonder if it is 1/cos(alpha+refraction).
Sort of, yes.
The angle of transmission is not equal to the angle of incidence on the outside. The angle of transmission is modified, causing the ray to pass more directly through the cloth, thus traversing a smaller distance than the angle of incidence would indicate.
Let's call the angle of transmittance beta.
So our attenuation factor due to angle was 1/cos(alpha) and it needs to be 1/cos(beta).
The relationship of the angle of transmittence, beta, to alpha is given by Snell's law:
IOR * sin(beta) = sin(alpha)
Which means:
sin(beta) = sin(alpha) / IOR
In other words, increasing the IOR from 1 decreases the sin of the angle beta.
Now the difficulty we have is that we're dealing with cosines, not sines. How to get cos(beta)?
Well, we use the following identity:
sin(x) ^ 2 + cos(x) ^ 2 = 1
Rearranging, we have:
sin(x) ^ 2 = 1 - cos(x) ^ 2
Cool. Start with Snell's law, but square both sides:
sin(beta) ^ 2 = (sin(alpha) ^ 2 ) / (IOR ^ 2)
Now use the previous identity to replace sin with cos.
1 - cos(beta)^2 = (1 - cos(alpha) ^ 2) / (IOR ^ 2)
Rearrange a bit:
cos(beta)^2 = 1 - (1 - cos(alpha)^2) / (IOR^2)
And taking square root, gives us cos(beta) in terms of cos(alpha).
cos(beta) = Sqrt(1 - (1 - cos(alpha)^2) / (IOR^2))
Since we have cos(alpha) [ from the Edge_Blend node ] we now have the correct attenuation factor taking IOR into account.
If you graph this it shows that the IOR makes a huge difference. The edge attenuation is much less when the material has even slightly higher IOR than air. According to a couple sources I Googled, the IOR of nylon is very high - 1.53.
I don't really know what to make of this, but I'll put it in the shader and see what happens.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)