Original Post
I have generated the lightmap for both left and right eye from eye image. let the lightmap height is denoted by "height" width is by "width" assuming there is only one point light source in the map with pixel color(255,255,255) I have computed the light source position at light_u and light_v now how can I compute the light direction? I have got a code but cant convince myself with the computation. would anyone plz help me to figure it out? //compute the light direction Vector light; light.dy = ((float)light_u - (float)height / 2) * 2 / (float)height; light.dx = -((float)light_v - (float)width / 2) * 2 / (float)width; double factor = 1.0 - (double)(light.dx*light.dx + light.dy + light.dy); if(factor < 0.0) factor = 0.0; light.dz = (float)sqrt(factor); light.Normalize();