diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-10-01 20:33:38 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-10-01 20:33:38 -0300 |
commit | c864b782c05f5e2833afd69a4c0dfc6fbcfc4b26 (patch) | |
tree | 374819a22170d8510257c9cd7c369747ac9b2dfa /drivers/gles3/shaders | |
parent | c9a925c4e0e226b168f05b1d54b1050437869b5e (diff) |
Using advise from Matias, left the 0-1 range for lights, divisiom by PI, and multiplied lights by PI internally.
Diffstat (limited to 'drivers/gles3/shaders')
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 715237281f..715485dfba 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -915,7 +915,7 @@ LIGHT_SHADER_CODE #if defined(DIFFUSE_LAMBERT_WRAP) //energy conserving lambert wrap shader - light_amount = max(0.0,(dot(N,L) + roughness) / ((1.0 + roughness) * (1.0 + roughness))); + light_amount = max(0.0,(dot(N,L) + roughness) / ((1.0 + roughness) * (1.0 + roughness) * M_PI)); #elif defined(DIFFUSE_OREN_NAYAR) @@ -932,8 +932,7 @@ LIGHT_SHADER_CODE vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) ); float B = 0.45 * sigma2 / (sigma2 + 0.09); -// light_amount = dotNL * (A + vec3(B) * s / t) / M_PI; - light_amount = dotNL * (A + vec3(B) * s / t); + light_amount = dotNL * (A + vec3(B) * s / t) / M_PI; } #elif defined(DIFFUSE_TOON) @@ -953,8 +952,7 @@ LIGHT_SHADER_CODE float FD90 = 0.5 + 2.0 * LoH * LoH * roughness; float FdV = 1.0 + (FD90 - 1.0) * SchlickFresnel(NoV); float FdL = 1.0 + (FD90 - 1.0) * SchlickFresnel(NoL); - //light_amount = ( (1.0 / M_PI) * FdV * FdL ) * NoL; - light_amount = ( FdV * FdL ) * NoL; + light_amount = ( (1.0 / M_PI) * FdV * FdL ) * NoL; /* float energyBias = mix(roughness, 0.0, 0.5); float energyFactor = mix(roughness, 1.0, 1.0 / 1.51); @@ -967,8 +965,7 @@ LIGHT_SHADER_CODE } #else //lambert -// light_amount = dotNL / M_PI; - light_amount = dotNL; + light_amount = dotNL / M_PI; #endif #if defined(TRANSMISSION_USED) |