Isotropic lighting for trees in Atmospheric Light Scattering
This commit is contained in:
parent
df35c11af2
commit
4817183507
1 changed files with 17 additions and 16 deletions
|
@ -59,7 +59,7 @@ return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d));
|
|||
void main()
|
||||
{
|
||||
|
||||
vec4 light_diffuse;
|
||||
//vec4 light_diffuse;
|
||||
vec4 light_ambient;
|
||||
|
||||
vec3 shadedFogColor = vec3(0.65, 0.67, 0.78);
|
||||
|
@ -155,11 +155,11 @@ if (terminator < 1000000.0) // the full, sunrise and sunset computation
|
|||
|
||||
|
||||
|
||||
light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0);
|
||||
light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
light_diffuse.a = 1.0;
|
||||
light_diffuse = light_diffuse * scattering;
|
||||
//light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 3.827, 1.08e-05, 1.0);
|
||||
//light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
//light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
//light_diffuse.a = 1.0;
|
||||
//light_diffuse = light_diffuse * scattering;
|
||||
|
||||
light_ambient.r = light_func(lightArg, 0.236, 0.253, 1.073, 0.572, 0.33);
|
||||
light_ambient.g = light_ambient.r * 0.4/0.33;
|
||||
|
@ -178,8 +178,8 @@ if (earthShade < 0.5)
|
|||
intensity = length(light_ambient.rgb);
|
||||
light_ambient.rgb = intensity * normalize(mix(light_ambient.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade) ));
|
||||
|
||||
intensity = length(light_diffuse.rgb);
|
||||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) ));
|
||||
//intensity = length(light_diffuse.rgb);
|
||||
//light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.7,earthShade) ));
|
||||
}
|
||||
|
||||
|
||||
|
@ -211,16 +211,16 @@ else // the faster, full-day version without lightfields
|
|||
mie_angle = 1.0;
|
||||
|
||||
if (terminator > 3000000.0)
|
||||
{light_diffuse = vec4 (1.0, 1.0, 1.0, 1.0);
|
||||
{//light_diffuse = vec4 (1.0, 1.0, 1.0, 1.0);
|
||||
light_ambient = vec4 (0.33, 0.4, 0.5, 1.0); }
|
||||
else
|
||||
{
|
||||
|
||||
lightArg = (terminator/100000.0 - 10.0)/20.0;
|
||||
light_diffuse.b = 0.78 + lightArg * 0.21;
|
||||
light_diffuse.g = 0.907 + lightArg * 0.091;
|
||||
light_diffuse.r = 0.904 + lightArg * 0.092;
|
||||
light_diffuse.a = 1.0;
|
||||
//light_diffuse.b = 0.78 + lightArg * 0.21;
|
||||
//light_diffuse.g = 0.907 + lightArg * 0.091;
|
||||
//light_diffuse.r = 0.904 + lightArg * 0.092;
|
||||
//light_diffuse.a = 1.0;
|
||||
|
||||
light_ambient.r = 0.316 + lightArg * 0.016;
|
||||
light_ambient.g = light_ambient.r * 0.4/0.33;
|
||||
|
@ -228,16 +228,17 @@ else // the faster, full-day version without lightfields
|
|||
light_ambient.a = 1.0;
|
||||
}
|
||||
|
||||
light_diffuse = light_diffuse * scattering;
|
||||
//light_diffuse = light_diffuse * scattering;
|
||||
yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude);
|
||||
}
|
||||
|
||||
light_ambient.rgb = light_ambient.rgb * (1.0 + smoothstep(1000000.0, 3000000.0,terminator));
|
||||
|
||||
// tree shader lighting
|
||||
|
||||
vec3 diffuse = gl_FrontMaterial.diffuse.rgb * max(0.1, n);
|
||||
//vec3 diffuse = gl_FrontMaterial.diffuse.rgb * max(0.1, n);
|
||||
vec4 ambientColor = gl_FrontLightModelProduct.sceneColor + light_ambient * gl_FrontMaterial.ambient;
|
||||
gl_FrontColor = ambientColor + light_diffuse * vec4(diffuse, 1.0);
|
||||
gl_FrontColor = ambientColor;// + light_diffuse * vec4(diffuse, 1.0);
|
||||
gl_FrontColor.a = mie_angle; gl_BackColor.a = mie_angle;
|
||||
//gl_FrontColor.a = 1.0; gl_BackColor.a = 1.0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue