summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-09-12 07:58:18 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-09-12 07:58:54 -0300
commit1c5376ae5951a4e47b972244cd2ec47760469b0c (patch)
treea7c20e5e0c5c0f65dcd794cca56f17a85256ae8e /drivers/gles3
parentaabbd00284640a4789f96702c134ea40b11b402e (diff)
Many fixes to visual script, changed virtuals override for a proper selector.
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/shaders/scene.glsl23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 73268c1914..5f83033293 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -935,17 +935,26 @@ LIGHT_SHADER_CODE
#elif defined(DIFFUSE_BURLEY)
{
- float NdotL = dot(L, N);
- float NdotV = dot(N, V);
- float VdotH = dot(N, normalize(L+V));
+
+
+ vec3 H = normalize(V + L);
+ float NoL = max(0.0,dot(N, L));
+ float VoH = max(0.0,dot(L, H));
+ float NoV = max(0.0,dot(N, V));
+
+ float FD90 = 0.5 + 2.0 * VoH * VoH * roughness;
+ float FdV = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoV, 5.0 );
+ float FdL = 1.0 + (FD90 - 1.0) * pow( 1.0 - NoL, 5.0 );
+ light_amount = ( (1.0 / M_PI) * FdV * FdL );
+/*
float energyBias = mix(roughness, 0.0, 0.5);
float energyFactor = mix(roughness, 1.0, 1.0 / 1.51);
- float fd90 = energyBias + 2.0 * VdotH * VdotH * roughness;
+ float fd90 = energyBias + 2.0 * VoH * VoH * roughness;
float f0 = 1.0;
- float lightScatter = f0 + (fd90 - f0) * pow(1.0 - NdotL, 5.0);
- float viewScatter = f0 + (fd90 - f0) * pow(1.0 - NdotV, 5.0);
+ float lightScatter = f0 + (fd90 - f0) * pow(1.0 - NoL, 5.0);
+ float viewScatter = f0 + (fd90 - f0) * pow(1.0 - NoV, 5.0);
- light_amount = lightScatter * viewScatter * energyFactor;
+ light_amount = lightScatter * viewScatter * energyFactor;*/
}
#else
//lambert