The previous Code already provides the base of our ray tracer. In this post I will provide 3 examples on how can we extend this functionality. Ray trace with two light sources The following snippet describes how two light sources will affect how the sphere is rendered Vec3 intersect, normal; double depth = IntersectSphere(p0, p1, s, intersect, normal); if (depth < 1 ) { Vec3 finalColor1 = l1.CalculateDiffuse(intersect, normal, s.color); Vec3 finalColor2 = l2.CalculateDiffuse(intersect, normal, s.color); Vec3 finalColor (finalColor1.x + finalColor2.x, finalColor1.y + finalColor2.y, finalColor1.z + finalColor2.z); finalColor.Clamp( 0.f , 1.f ); DrawPixel(x, y, finalColor); } else { DrawPixel(x, y, s_bgColor); } To recap, we first identify the intersection between the line segment and the sphere (Moved to a function). If the intersection lies within the drawing box (depth betw...