diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-05-30 16:23:57 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-05-30 18:18:00 +0300 |
commit | 470d66397d579944d2cbc54e9596073015b4493e (patch) | |
tree | bdfdbe219e4c4f54b67ba3a1a4306058c0346674 /source/blender/draw/engines/eevee/shaders/bsdf_direct_lib.glsl | |
parent | eed26b25d2cabf39ceee76ed87fed51d03d5d360 (diff) |
Eevee: Fix ggx sun light.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/bsdf_direct_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/bsdf_direct_lib.glsl | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_direct_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_direct_lib.glsl index 07fff8ac2d2..e91c4a4411b 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_direct_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_direct_lib.glsl @@ -20,6 +20,14 @@ float direct_diffuse_point(LightData ld, ShadingData sd) return bsdf; } +/* infinitly far away point source, no decay */ +float direct_diffuse_sun(LightData ld, ShadingData sd) +{ + float bsdf = max(0.0, dot(sd.N, -ld.l_forward)); + bsdf *= M_1_PI; /* Normalize */ + return bsdf; +} + /* From Frostbite PBR Course * Analitical irradiance from a sphere with correct horizon handling * http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf */ @@ -66,13 +74,6 @@ float direct_diffuse_rectangle(LightData ld, ShadingData sd) return bsdf; } -/* infinitly far away point source, no decay */ -float direct_diffuse_sun(LightData ld, ShadingData sd) -{ - float bsdf = max(0.0, dot(sd.N, -ld.l_forward)); - bsdf *= M_1_PI; /* Normalize */ - return bsdf; -} #if 0 float direct_diffuse_unit_disc(vec3 N, vec3 L) @@ -94,6 +95,13 @@ vec3 direct_ggx_point(ShadingData sd, float roughness, vec3 f0) return F_schlick(f0, VH) * bsdf; } +vec3 direct_ggx_sun(LightData ld, ShadingData sd, float roughness, vec3 f0) +{ + float bsdf = bsdf_ggx(sd.N, -ld.l_forward, sd.V, roughness); + float VH = max(dot(sd.V, normalize(sd.V - ld.l_forward)), 0.0); + return F_schlick(f0, VH) * bsdf; +} + vec3 direct_ggx_sphere(LightData ld, ShadingData sd, float roughness, vec3 f0) { vec3 L = normalize(sd.l_vector); |