I have generated the lightmap for both left and right eye from eye image.
the lightmap height is denoted by "height"
width is by "width"
assuming there is only one point light source in the map with
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
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);
computing light vector direction from lightmap
No replies to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users