<p>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 "<a href="https://www.guerrilla-games.com/read/killzone-shadow-fall-creating-art-tools-for-a-new-generation" rel="nofollow noreferrer">Lighting in Killzone Shadow Fall</a>", "<a href="https://de45xmedrsdbp.cloudfront.net/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf" rel="nofollow noreferrer">Real Shading in Unreal Engine 4</a>" and "<a href="http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr_v2.pdf" rel="nofollow noreferrer">Moving Frostbite to PBR</a>". 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 <a href="https://math.stackexchange.com/questions/1438242/finding-ray-direction-with-smallest-angle-from-a-ray-to-a-rectangle-in-3d">here's my solution for rectangular lights</a>).</p>

<p>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.</p>

<p>There's also some more recent work for evaluating area lighting integrals not using MRP. "<a href="http://jmarvie.free.fr/Publis/2016_I3D/i3d_2016_AccurateAnalyticApproximationsForReal-TimeSpecularAreaLighting.pdf" rel="nofollow noreferrer">Accurate Analytic Approximations For Real-Time Specular Area Lighting</a>" deals with the specular evaluation via edge integrals, though I recall this method is patented. "<a href="https://eheitzresearch.wordpress.com/415-2/" rel="nofollow noreferrer">Real-Time Polygonal-Light Shading with Linearly Transformed Cosines</a>" looks quite promising, but I haven't checked the paper in more details.</p>

<p>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.</p>

CC BY-SA 3.0
2017-05-30T13:36:02.933Z
2017-05-30T13:36:02.933Z
JarkkoL
<p>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 <a href="http://www.povray.org/documentation/view/3.6.2/38/" rel="nofollow noreferrer">here</a>) 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.</p>

CC BY-SA 3.0
2017-05-28T14:10:01.077Z
Will try this method! Although, would you have any knowledge of how I can do it without approximating it with point lights?
Arjan Singh
CC BY-SA 3.0
2017-05-28T17:00:09.253Z
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.
Tim Rolff
CC BY-SA 3.0
2017-05-29T13:52:32.210Z
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.
Tim Rolff
CC BY-SA 3.0
2017-05-28T13:33:44.313Z
2017-05-28T13:33:44.313Z
Tim Rolff
<p>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 &amp; tube)?</p>

<p>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. </p>

<p>For example for a point light I know it can be done like this:</p>

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

<raytracing><lighting><pathtracing>
How to find Light Direction from a Point on a surface to an Area Light
Arjan Singh
# How to find Light Direction from a Point on a surface to an Area Light

(Asked by: username_0 on 2017-05-28)

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; 
public: 
    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(); 
        lightDir.normalize(); 
        lightIntensity = intensity * color / (4 * M_PI * r2); 
    } 
};

```

**Tags:** raytracing, lighting, pathtracing


---

## 2 answers

### Answer by username_1 on 2017-05-30. Score: 3 | Accepted answer

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](https://www.guerrilla-games.com/read/killzone-shadow-fall-creating-art-tools-for-a-new-generation)", "[Real Shading in Unreal Engine 4](https://de45xmedrsdbp.cloudfront.net/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf)" and "[Moving Frostbite to PBR](http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr_v2.pdf)". 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](https://math.stackexchange.com/questions/1438242/finding-ray-direction-with-smallest-angle-from-a-ray-to-a-rectangle-in-3d)).

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](http://jmarvie.free.fr/Publis/2016_I3D/i3d_2016_AccurateAnalyticApproximationsForReal-TimeSpecularAreaLighting.pdf)" deals with the specular evaluation via edge integrals, though I recall this method is patented. "[Real-Time Polygonal-Light Shading with Linearly Transformed Cosines](https://eheitzresearch.wordpress.com/415-2/)" 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.


---

### Answer by username_2 on 2017-05-28. Score: 0

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](http://www.povray.org/documentation/view/3.6.2/38/)) 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.

> **Comments:**
> **username_0**: Will try this method! Although, would you have any knowledge of how I can do it without approximating it with point lights?  
> **username_2**: 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.  
> **username_2**: 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.  

---

