So I'm studying Webgl and after directional light I'm approaching point light.

So I've seen two different approaches:

  1. 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)
  2. 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?



The latter isn't point lighting in the traditional sense and also discusses Phong shading (that's where the complication comes from mostly, it's a simpler approach by default). It will lighten up a surface if it's facing in the direction of the point, regardless of distance. It works similarly to stars (e.g. the Sun), while the former imitates a desk lamp

  • \$\begingroup\$ Hi @Bálint, thanks for the answer, but can you elaborate a little bit? \$\endgroup\$ – nkint Mar 17 '19 at 17:20
  • \$\begingroup\$ @nkint which part? \$\endgroup\$ – Bálint Mar 17 '19 at 17:23
  • \$\begingroup\$ Note that the Sun experiences inverse-square falloff due to diverging light rays too — just over longer scales. We can approximate the sunlight falling on Earth as a directional light source with no falloff, but if we wanted to reach out to Pluto in the same scene we'd definitely want to factor in directional divergence & distance falloff. ;) \$\endgroup\$ – DMGregory Mar 17 '19 at 17:51
  • \$\begingroup\$ Hi @Bálint . In the second link, I'm referring to this first example that has no phong: tinyurl.com/yxtgrmjw So, what is that? I understand that the directional is like the Sun and the point light is like a bulb, but I'm still confused.. Where can I find a clear definition of what is a point light? Considering only the diffuse component (no specular, no phong, no reflection), what is the difference between a diffuse and a point lights other then falloff attenuation? \$\endgroup\$ – nkint Mar 17 '19 at 18:31
  • \$\begingroup\$ and you comment is clear thanks @DMGregory \$\endgroup\$ – nkint Mar 17 '19 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.