diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2018-05-24 04:50:16 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2018-05-24 17:43:47 +0300 |
commit | 5505ba8d4753ee6b3c0101ba3e4abf337546a1b0 (patch) | |
tree | 1c0fdbed36127f670e8aa0d49a53f72988cc34c5 /source/blender/draw/engines/eevee/eevee_private.h | |
parent | e8c8ff4f86c276e4dca884ff1a411fcbbf003fed (diff) |
Cycles/Eevee: Implement disk and ellipse shapes for area lamps
The implementation is pretty straightforward.
In Cycles, sampling the shapes is currently done w.r.t. area instead of solid angle.
There is a paper on solid angle sampling for disks [1], but the described algorithm is based on
simply sampling the enclosing square and rejecting samples outside of the disk, which is not exactly
great for Cycles' RNG (we'd need to setup a LCG for the repeated sampling) and for GPU divergence.
Even worse, the algorithm is only defined for disks. For ellipses, the basic idea still works, but a
way to analytically calculate the solid angle is required. This is technically possible [2], but the
calculation is extremely complex and still requires a lookup table for the Heuman Lambda function.
Therefore, I've decided to not implement that for now, we could still look into it later on.
In Eevee, the code uses the existing ltc_evaluate_disk to implement the lighting calculations.
[1]: "Solid Angle Sampling of Disk and Cylinder Lights"
[2]: "Analytical solution for the solid angle subtended at any point by an ellipse via a point source radiation vector potential"
Reviewers: sergey, brecht, fclem
Differential Revision: https://developer.blender.org/D3171
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_private.h')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_private.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index c95e51548d0..a5f4f6d85a8 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -289,6 +289,9 @@ typedef struct EEVEE_Light { float forwardvec[3], lamptype; } EEVEE_Light; +/* Special type for elliptic area lamps, matches lamps_lib.glsl */ +#define LAMPTYPE_AREA_ELLIPSE 100.0f + typedef struct EEVEE_Shadow { float near, far, bias, exp; float shadow_start, data_start, multi_shadow_count, shadow_blur; |