views:

1649

answers:

3

I'm working on a raytracer for a large side project, with the goal being to produce realistic renders without worrying about CPU time. Basically pre-rendering, so I'm going for accuracy over speed.

I'm having some trouble wrapping my head around some of the more advanced math going on in the lighting aspects of things. Basically, I have a point for my light. Assuming no distance falloff, I should be able to use the point on the polygon I've found, and compare the normal at that point to the angle of incidence on the light to figure out my illumination value. So given a point on a plane, the normal for that plane, and the point light, how would I go about figuring out that angle?

The reason I ask is that I can't seem to find any reference on finding the angle of incidence. I can find lots of references detailing what to do once you've got it, but nothing telling me how to get it in the first place. I imagine it's something simple, but I just can't logic it out.

Thanks

+7  A: 

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

Ian Hopkinson
Just had a look back at my old raytracer code from university, and indeed the only time it mentions angle of incidence is related to the cosine of it, which is calculated exactly this way.
Chad Birch
+1  A: 
Kevin Loney
Nice typesetting for the equations, Kevin. What did you use to do it?
duffymo
Looks like he used http://yourequations.com, neat site.
Chad Birch
http://www.yourequations.com/ I've been waiting for a question I could use it on.
Kevin Loney
A: 
Bob Cross