I know that the formula for irradiance at surface point p with normal n given a point light source at position l is:

H = I(cos x) / ||l - p||^2


Where:

x = angle between n and l-p I() = Intensity of light

But if I have an area light source defined by a polygon P, what is the formula for irradiance?

• I'm not sure but i suppose it's related to integrals. – nikoliazekter Apr 22 '15 at 17:15
• Yes absolutely, and some results are famously known: the infinite line area light results in 1/r decay. The infinite plane area light results in no decay. – v.oddou Apr 23 '15 at 1:54

As nikoliazekter explained, you'd have to calculate the integral over the surface of polygon P. To solve this integral, you'd probably use a numerical approximation. I don't think it is realistic to do this in a real-time application, due to the complexity of this calculation.

While solutions might exist for some specific shapes, they don't for polygons P of any arbitrary shape. If you still want to use area lights, I think you can do either of two things.

# Approach 1: Raytracing

You could opt for a raytracing renderer rather than a standard rasterizer. A raytracer works by "shooting" rays from the camera and checking where these rays end up. They might hit a diffuse surface, bounce of a reflective surface, hit a light source or something else. You might shoot several rays per pixel, to obtain multiple samples to determine the pixel's color.

A raytracer is a lot more flexible than a standard rasterizer, but this comes at the cost of complexity. This option might not be suitable for real-time applications.

Pathtracing is a specific type of raytracing where the full path of a ray is calculated, instead of only calculating direct light bounces (ie. bounces directed towards light sources) when the rays from the camera hit a surface. This technique is a global lighting solution. When calculating the color of a pixel, the entire scene is considered as a whole, as light rays can bounce between objects. Thus, effects such as shadow casting, color bleeding etc will be simulated.

# Approach 2: Approximate the area light with point lights

Alternatively, you could approximate your area light with multiple standard point lights. While your render will not be physically correct, it is possible to closely approximate the area light. This way, you can make use of standard rasterization.

Rasterization is less flexible than raytracing, but it is much faster. This makes it suitable for real-time rendering.

Rasterization (in its basic form, using a simple illumination model such as Phong illumination) is a local lighting solution. When a polygon is being rasterized into fragments, only the fragment itself is considered. The entire rest of the scene is considered non-existant at that point. You are just calculating angles relative to the normal, camera and light sources, ignoring shadow casting, reflecting of light rays etc.

In summary, area lights are a lot more difficult to calculate than point lights, using a standard rasterizer. If your use-case is non-time-critical (e.g. an offline renderer for videos), you could look into raytracing as a rendering technique. If your use-case is time-critical (e.g. a video game), you might be more interested in approximating your area light using multiple point lights.

I'm not an expert at lighting equations, so I can't provide you with the exact mathematical solution unfortunately. I may have also butchered some of the lighting and rendering related terminology.

• good answer. but some fixes: raytracing is not global per se. You can make it global when implementing indirect lights, but the most straightforward raytracer one can write just does direct ligthing, and maybe shadows. one step away from standard raytracing paradigm, but still doable in 99 lines, pathtracing, provides global lighting. kevinbeason.com/smallpt – v.oddou Apr 23 '15 at 1:47
• rasterization is not local per se either. it says and assumes nothing about lighting models. some say, renderman is a rasterizer, but it implements gloal lighting too. You can do very easy image based lighting in rasterization, which is a part of the global lighting equation. Appart from that, I admit that rasterization cannot really achieve global lighting without support from other techniques. Either pre-baked using PRT, or lightmaps. Or realtime using SSGI, LPV, or SVGO. – v.oddou Apr 23 '15 at 1:53
• Thanks for the feedback, I modified the answer based on your comments! – Jelle van Campen Apr 23 '15 at 6:48