- #1
luisbf
- 3
- 0
Hi
I wasn't sure of where to post, since well, I'm an adult, and math/physics weren't a big part of my curriculum, and yet, years later, i thought that continuing to have severe holes in my understanding of math and physics wasn't beneficial, even if i didn't had any direct applications to aqquiring this new knowledge, so, if I'm sorry if i'll be asking stupid things, but i wasn't sure where to post, and i have no one to talk about such things.
My problem is as follows (this is problably basic, but here goes), I'm trying to write a shader for this BRDF (found that seeing things makes understanding easier), the Wolff BRDF, which is basically a Lambertian diffuse, the cosine of the angle between incident (light) vector, and surface normal, but, multiplied by 2 Fresnel terms, one accounting for the amount of reflected light (from the incident light vector), and another second term, that accounts for the scattered light at the surface, and which uses the viewer vector instead.
This paper uses for the first term, the cosine of the angle between the incident (light) vector, and the surface normal, and the absolute IOR of the interior medium, let's say 1.5.
So far so good, let's say, in RSL (shading language similar to C, for RenderMan renderers, such as the GPLv2 http://www.renderpixie.com/" ):
float foo = fresnel( cos(theta) , IOR)
What's puzzling me is how they do the 2nd Fresnel term. They mention they mention the following formula
i don't understand this, i mean, i spent some time reading Fresnel equations and Snell's Law of reflection and refraction, and please correct me if I'm wrong, but, according to Snell's law, the ratio of the sine of the incident angle, and of the refracted angle, is equal to the ratio of the IOR of the interior and exterior medium, so
[tex]\eta_{1} * sin(\theta_{1}) = \eta_{2} * sin(\theta_{2})[/tex]
so, to get the sine of theta2:
[tex]sin(\theta_{2}) = \eta_{1} * sin(\theta_{1}) / \eta_{2}
= (\eta_{1} / \eta_{2}) * sin(\theta_{1})[/tex]
but since i have the cosine of theta1, using trigonometric identities then
[tex]sin(\theta_{2}) = (\eta_{1}/\eta_{2}) * \sqrt{ 1 - cos(\theta_{1})^2}[/tex]
and since i wanted the cosine of the transmitted angle to begin with, then
[tex]cos(\theta_{2}) = \sqrt{ 1 - ( (\eta_{1}/\eta_{2}) * \sqrt{ 1 - cos(\theta_{1})^2}^2} } = \sqrt{ 1 - (\eta_{1}/\eta_{2})^2 * \sqrt{ 1 - cos(\theta_{1})^2}^2}[/tex]
the square root and the squaring cancel each other leaving
[tex]cos(\theta_{2}) = \sqrt{ 1 - (\eta_{1}/\eta_{2})^2 * (1 - cos(\theta_{1})^2)}[/tex]
Does this seems correct?
I still don't understand the reasoning for the fresnel( [tex]1/ (sin(\theta_{1})/IOR), 1/IOR)[/tex] though
This model can be seen in the following paper:
http://www.bmva.org/bmvc/2004/papers/paper_185.pdf"
Sorry if this wasn't the right place to post such questions, perhaps there should be a section for math&physics impaired adults to fix the holes in their knowledge without fear of the ridicule?
Thank you in advance for your time.
P.S.: just reallized that
[tex]sin^{-1}( (\eta_{1}/\eta_{2}) * sin(\theta_{1})) = asin( (\eta_{1}/\eta_{2}) * sin(\theta_{1}) )[/tex]
The raise to -1 power was confusing me, according to wikipedia
Still, if anyone can correct my reasoning, i would apretiate it a lot (already ordered 2 books on algebra, calculus, and 1 on optics, to avoid making a fool of myself, at least often...).
I wasn't sure of where to post, since well, I'm an adult, and math/physics weren't a big part of my curriculum, and yet, years later, i thought that continuing to have severe holes in my understanding of math and physics wasn't beneficial, even if i didn't had any direct applications to aqquiring this new knowledge, so, if I'm sorry if i'll be asking stupid things, but i wasn't sure where to post, and i have no one to talk about such things.
My problem is as follows (this is problably basic, but here goes), I'm trying to write a shader for this BRDF (found that seeing things makes understanding easier), the Wolff BRDF, which is basically a Lambertian diffuse, the cosine of the angle between incident (light) vector, and surface normal, but, multiplied by 2 Fresnel terms, one accounting for the amount of reflected light (from the incident light vector), and another second term, that accounts for the scattered light at the surface, and which uses the viewer vector instead.
This paper uses for the first term, the cosine of the angle between the incident (light) vector, and the surface normal, and the absolute IOR of the interior medium, let's say 1.5.
So far so good, let's say, in RSL (shading language similar to C, for RenderMan renderers, such as the GPLv2 http://www.renderpixie.com/" ):
float foo = fresnel( cos(theta) , IOR)
What's puzzling me is how they do the 2nd Fresnel term. They mention they mention the following formula
Code:
float foo = fresnel( 1 / ( sin(theta)/IOR), 1/IOR );
i don't understand this, i mean, i spent some time reading Fresnel equations and Snell's Law of reflection and refraction, and please correct me if I'm wrong, but, according to Snell's law, the ratio of the sine of the incident angle, and of the refracted angle, is equal to the ratio of the IOR of the interior and exterior medium, so
[tex]\eta_{1} * sin(\theta_{1}) = \eta_{2} * sin(\theta_{2})[/tex]
so, to get the sine of theta2:
[tex]sin(\theta_{2}) = \eta_{1} * sin(\theta_{1}) / \eta_{2}
= (\eta_{1} / \eta_{2}) * sin(\theta_{1})[/tex]
but since i have the cosine of theta1, using trigonometric identities then
[tex]sin(\theta_{2}) = (\eta_{1}/\eta_{2}) * \sqrt{ 1 - cos(\theta_{1})^2}[/tex]
and since i wanted the cosine of the transmitted angle to begin with, then
[tex]cos(\theta_{2}) = \sqrt{ 1 - ( (\eta_{1}/\eta_{2}) * \sqrt{ 1 - cos(\theta_{1})^2}^2} } = \sqrt{ 1 - (\eta_{1}/\eta_{2})^2 * \sqrt{ 1 - cos(\theta_{1})^2}^2}[/tex]
the square root and the squaring cancel each other leaving
[tex]cos(\theta_{2}) = \sqrt{ 1 - (\eta_{1}/\eta_{2})^2 * (1 - cos(\theta_{1})^2)}[/tex]
Does this seems correct?
I still don't understand the reasoning for the fresnel( [tex]1/ (sin(\theta_{1})/IOR), 1/IOR)[/tex] though
This model can be seen in the following paper:
http://www.bmva.org/bmvc/2004/papers/paper_185.pdf"
Sorry if this wasn't the right place to post such questions, perhaps there should be a section for math&physics impaired adults to fix the holes in their knowledge without fear of the ridicule?
Thank you in advance for your time.
P.S.: just reallized that
[tex]sin^{-1}( (\eta_{1}/\eta_{2}) * sin(\theta_{1})) = asin( (\eta_{1}/\eta_{2}) * sin(\theta_{1}) )[/tex]
The raise to -1 power was confusing me, according to wikipedia
In trigonometry, for historical reasons, sin2(x) usually does mean the square of sin(x):
[tex]sin^2 x = (\sin x)^2.[/tex]
However, the expression sin-1(x) does not represent the multiplicative inverse to sin(x):
[tex]sin^{-1} x \neq (\sin x)^{-1}.[/tex]
It denotes the inverse function for sin(x) (actually a partial inverse; see below). To avoid confusion, an inverse trigonometric function is often indicated by the prefix "arc". For instance the inverse sine is typically called the arcsine
Still, if anyone can correct my reasoning, i would apretiate it a lot (already ordered 2 books on algebra, calculus, and 1 on optics, to avoid making a fool of myself, at least often...).
Last edited by a moderator: