So I'm studying Webgl and after directional light I'm approaching point light.
So I've seen two different approaches:
- Take the directional light (diffuse and specular components) and multiply them by a falloff attenuation, for example with the attenuation function is by Tom Madams that anyway take in account the distance from the fragment surface point to the light point. This approach is spotted in this webgl light walkthrough tutorial, and I find it easier to understand. Seems also the same approach from this OpenGL tutorial (in the section Point Light)
- The other approach listed here does not involve a light attenuation falloff but calculate the light direction from any fragment position and the light point source. It seems a little bit more complicated to me.
Is there something that I have totally misunderstood? What is the difference between this two approaches? When to use the first and when to use the second?