Point Lighting

Does any one know how to implement a point light in volume rendering?

I have managed to implement shading using directional light with the lookat as the camera position.

From my understanding, to make it a point light, i got to include attenuation like

1 - (distance from light to pixel / radius of area of light influence)^2

If so, how do I get the position for each pixel in the case of volume rendering?
Do I have to do lighting computation in the texture space and how?


I haven’t done much volume rendering, but I think it’s something like this:

Precalculate object-space normals and store them into a 3d texture. In addition to this you need a cubemap that gives you the light’s direction vector, after that it’s just a matter of taking a dot product between the light dir and the normal.

The cubemap is almost similar to a normalization cubemap, it’s supposed to return for each vector a normalized vector in the opposite direction. You use texgen to generate texture coordinates for this cubemap, and it returns the light->fragment vector for each fragment. The texgen is as simple as