Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-11-14 17:46:40 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-11-15 20:16:22 +0300
commitf3074b96d6fe748900d062c7dc3f51f37f06fc5a (patch)
tree2835bd18db47e3720d3143b0c5a658e8a1043f9f /source/blender/draw/engines/eevee/eevee_lights.c
parentcfb6f14616ecd96831815b48c7edfdd706ddcf2e (diff)
Eevee: Make sun power match cycles better.
I made an empirical test with a 100% diffuse sphere and manually tweak the lighting power of a sun lamp trying to fit cycles and eevee the best I can. Then I plotted the result and found a rough fit to the equation and that seems to work pretty well.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_lights.c')
-rw-r--r--source/blender/draw/engines/eevee/eevee_lights.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c
index 02667bf7087..962cb7c2033 100644
--- a/source/blender/draw/engines/eevee/eevee_lights.c
+++ b/source/blender/draw/engines/eevee/eevee_lights.c
@@ -663,6 +663,9 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli)
else {
power = 1.0f / (4.0f * evli->radius * evli->radius * M_PI * M_PI) * /* 1/(r²*Pi) */
12.5f; /* XXX : Empirical, Fit cycles power */
+ /* Make illumation power closer to cycles for bigger radii. Cycles uses a cos^3 term that we cannot reproduce
+ * so we account for that by scaling the light power. This function is the result of a rough manual fitting. */
+ power *= 1.0f + evli->radius * evli->radius * 0.5f;
}
mul_v3_fl(evli->color, power * la->energy);