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/shaders/volumetric_lib.glsl
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/shaders/volumetric_lib.glsl')
-rw-r--r--source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl
index 36c4562e137..ae36252153f 100644
--- a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl
@@ -74,7 +74,8 @@ vec3 light_volume(LightData ld, vec4 l_vector)
power *= 20.0 * max(0.0, dot(-ld.l_forward, l_vector.xyz / l_vector.w)); /* XXX ad hoc, empirical */
}
else if (ld.l_type == SUN) {
- power = (4.0f * ld.l_radius * ld.l_radius * M_2PI) * (1.0 / 12.5); /* Removing area light power*/
+ power = ld.l_radius * ld.l_radius * M_PI; /* Removing area light power*/
+ power /= 1.0f + (ld.l_radius * ld.l_radius * 0.5f);
power *= M_PI * 0.5; /* Matching cycles. */
}
else {
@@ -82,12 +83,12 @@ vec3 light_volume(LightData ld, vec4 l_vector)
power *= M_2PI; /* Matching cycles with point light. */
}
+ power /= (l_vector.w * l_vector.w);
+
/* OPTI: find a better way than calculating this on the fly */
float lum = dot(ld.l_color, vec3(0.3, 0.6, 0.1)); /* luminance approx. */
vec3 tint = (lum > 0.0) ? ld.l_color / lum : vec3(1.0); /* normalize lum. to isolate hue+sat */
- power /= (l_vector.w * l_vector.w);
-
lum = min(lum * power, volLightClamp);
return tint * lum;