How do you calculate the angle of incidence?

I am working on a raytracer for a large side project whose goal is to create realistic renderings without worrying about processor time. Basically pre-rendering, so I'm going to accuracy to speed.

I'm having trouble wrapping my head around more advanced math in lighting aspects. Basically, I have a point for my light. Assuming there is no distance offset, I would have to use the point on the polygon that I found and compare the normal value at that point with the angle of incidence to the light to find out my light value. Therefore, given the point on the plane normal to that plane and the point light, how could I figure out this angle?

I ask that I cannot find a link to search for the angle of incidence. I can find many links that describe in detail what to do when you received it, but it doesn’t tell me how to get it in the first place. I imagine something simple, but I just can’t explain it.

thanks

+4
source share
3 answers

The dot product of the normal surface vector and the incident light vector will give you the cosine of the angle of incidence if you normalize your vectors.

+8
source

NOTE: where I am sitting right now, I cannot upload an image for you. However, I will try to lay out the words for you.

Here is how you can imagine this process:

Define alt text http://www.yourequations.com/eq.latex?%5Chat%7Bn%7D as normal normal (a vertical vector that comes out of a planar polygon and has a unit of length, making mathematics easier).

Define alt text http://www.yourequations.com/eq.latex?p_0 as the point of your eyeball.

Define alt text http://www.yourequations.com/eq.latex?p_1 as the point of impact of your "eyeball beam" at the test site.

Define alt text http://www.yourequations.com/eq.latex?%5Chat%7Bv%7D as a normalized vector pointing from alt text http://www.yourequations.com/eq.latex?p_1 back to alt text http://www.yourequations.com/eq.latex?p_0 . You can write it like this:

alt text http://www.yourequations.com/eq.latex?%5Chat%7Bv%7D%20=%20%5Cfrac%7B%5Coverrightarrow%7B (p_0% 20-% 20p_1)% 7D% 7D% 7B | | p_0% 20-% 20p_1 ||% 7D

So, you created a vector that points alt text http://www.yourequations.com/eq.latex?p_1 to alt text http://www.yourequations.com/eq.latex?p_0 , and then divided this vector into its length by specifying a vector of length 1 that indicates alt text http://www.yourequations.com/eq.latex?p_1 to alt text http://www.yourequations.com/eq.latex?p_0

The reason we ran into this whole problem is because we would really like the angle alt text http://www.yourequations.com/eq.latex?%5Ctheta , which is the angle between normal alt text http: / /www.yourequations.com/eq.latex?%5Chat%7Bn%7D and this vector alt text http://www.yourequations.com/eq.latex?%5Chat%7Bv%7D that you just created. Another word for theta is the angle of incidence.

An easy way to calculate this angle of incidence is to use dot product . Using the terms defined above, you take the x, y, and z components of each of these unit length vectors, multiply them together and add the sums to get the point product.

alt text http://www.yourequations.com/eq.latex?%5Chat%7Bn%7D%20%5Ccdot%20%5Chat%7Bv%7D%20=%20%5Ccos%7B%5Ctheta%7D%20= % 20n_x% 20% 20v_x% 20 +% 20n_y% 20% 20v_y% 20 +% 20n_z% 20% 20v_z

To calculate alt text http://www.yourequations.com/eq.latex?%5Ctheta , you simply use the inverse cosine on the point product:

alt text http://www.yourequations.com/eq.latex?%5Ctheta%20=%20%5Carccos%28%5Chat%7Bn%7D%20%5Ccdot%20%5Chat%7Bv%7D%29

Edit: Modified above to add yourequations.com formatting.

0
source

All Articles