I'm working on a ray tracer for spheres and I'm trying to implement an illuminate function to calculate the light intensity per ray. I'm currently stuck on calculating the diffuse reflection:
Given a ray R, a sphere S, a point P where R intersects S, and a light source L
I understand that to use Lambert's Law to calculate diffuse reflection, I need the light direction vector and the normal vector.
I know I can get the light direction vector by calculating L - P. I'm stuck now on calculating the normal.
I know I need to use the inverse of the S transform matrix but I don't understand conceptually what inverting the S transform matrix does so I was hoping to get some guidance on how to do this.