Original Post
hi, i need some explanations on how to convert or map pixel coordinate to world coordinate. for example , if i have a lightmap then how do i compute the light directions and vice verse. i've seen this code but i need the basic theory behind such mapping light direction(light.x, light.y) to pixel coordinate(u,v) mapping---> u = (light.x+1) * SIZE/2 + 0.5; v = (light.y+1) * SIZE/2 + 0.5; from (u,v) to (x,y) mapping---> light.y = (u-SIZE/2)*2/SIZE light.x = -(v-SIZE/2)*2/SIZE i tried to do the reverse mapping from either side by hand but results don't come up to be the same bcoz of the 0.5 term during the first mapping. why are we adding this 0.5 to get a pixel value? and why are we using this negative sign before computing light.x. BTW "light" is a normalized vector.