How can I a find the Light Direction/Ray from a Point on a surface to an Area Light? Is there a universal technique to do this for all types of lights (circle, rectangle, sphere & tube)?

Although this is for area lighting in a ray tracer, is there another way to implement area lighting through an emissive value that I can apply to any object or surface (I have seen this mentioned online)? As opposed to doing it like this.

For example for a point light I know it can be done like this:

class PointLight : public Light 
    Vec3f pos; 
    PointLight(const Matrix44f &l2w, const Vec3f &c = 1, const float &i = 1) : Light(l2w, c, i) 
    { l2w.multVecMatrix(Vec3f(0), pos); } 
    // P: is the shaded point
    void getDirectionAndIntensity(const Vec3f &P, Vec3f &lightDir, Vec3f &lightIntensity) const 
        lightDir = pos - P; // compute light direction 
        float r2 = lightDir.norm(); 
        lightIntensity = intensity * color / (4 * M_PI * r2); 

If you want to use only one sample to approximate analytical area lighting (e.g. for real-time applications), you can use Most Representative Point (MRP) approximation as described in "Lighting in Killzone Shadow Fall", "Real Shading in Unreal Engine 4" and "Moving Frostbite to PBR". This works reasonably well for specular approximation, though the energy conservation is a challenge. What I have found working best is to find a point on a light source with smallest angle from the view reflection vector, and the solution depends on the shape of the light (for example here's my solution for rectangular lights).

For diffuse evaluation there are numerical and analytical approximations depending on light shape presented in the papers, which also properly handle the horizon case. You can also try to use MRP for diffuse lighting, but I haven't found good approximations for it. Depending your application though diffuse MRP might result in feasible quality.

There's also some more recent work for evaluating area lighting integrals not using MRP. "Accurate Analytic Approximations For Real-Time Specular Area Lighting" deals with the specular evaluation via edge integrals, though I recall this method is patented. "Real-Time Polygonal-Light Shading with Linearly Transformed Cosines" looks quite promising, but I haven't checked the paper in more details.

For non-real time applications and ray tracing area lighting is fundamentally and mathematically much simpler problem. For your integrator you just check the incident radiance at each sample (ray intersection with the scene) and accumulate results for total radiance towards the output direction. The challenge is how to reduce variance of your integrator, but getting basic area lighting to work in a ray tracer is relatively simple.


One way to achieve this, is using the same approach as POV-Ray wich uses multiple point lights to create an area light (as mentioned here) by aligning them into an array. This should also work for arbitrary surfaces if you approximate them through point lights. This has also the benefit that you don't need to change much of your code.

  • $\begingroup$ Will try this method! Although, would you have any knowledge of how I can do it without approximating it with point lights? $\endgroup$ – Arjan Singh May 28 '17 at 14:10
  • $\begingroup$ Unfortunately, I do not know any method for arbitrary surfaces which works with simple raytracing because it's hard to tell if an point can see the plane or not, but depending on your case you might want to try a Monte Carlo method such as Distribution Ray Tracing. $\endgroup$ – Tim Rolff May 28 '17 at 17:00
  • $\begingroup$ Maybe you could also try to sample some randomly distributed points on the plane of the area light and then check it against your surface point. $\endgroup$ – Tim Rolff May 29 '17 at 13:52

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.