More infrastructure for perception filtering of moonlight
This commit is contained in:
parent
405e754583
commit
e5f4b0a511
11 changed files with 25 additions and 2 deletions
|
@ -70,6 +70,7 @@
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<program>
|
<program>
|
||||||
<vertex-shader>Shaders/cloud-impostor-ALS.vert</vertex-shader>
|
<vertex-shader>Shaders/cloud-impostor-ALS.vert</vertex-shader>
|
||||||
|
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
|
||||||
<fragment-shader>Shaders/cloud-static-ALS.frag</fragment-shader>
|
<fragment-shader>Shaders/cloud-static-ALS.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<program>
|
<program>
|
||||||
<vertex-shader>Shaders/cloud-noctilucent-ALS.vert</vertex-shader>
|
<vertex-shader>Shaders/cloud-noctilucent-ALS.vert</vertex-shader>
|
||||||
|
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
|
||||||
<fragment-shader>Shaders/cloud-static-ALS.frag</fragment-shader>
|
<fragment-shader>Shaders/cloud-static-ALS.frag</fragment-shader>
|
||||||
</program>
|
</program>
|
||||||
<uniform>
|
<uniform>
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<program>
|
<program>
|
||||||
<vertex-shader>Shaders/cloud-static-ALS.vert</vertex-shader>
|
<vertex-shader>Shaders/cloud-static-ALS.vert</vertex-shader>
|
||||||
|
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
|
||||||
<fragment-shader>Shaders/cloud-static-ALS.frag</fragment-shader>
|
<fragment-shader>Shaders/cloud-static-ALS.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
</texture-unit>
|
</texture-unit>
|
||||||
<program>
|
<program>
|
||||||
<vertex-shader>Shaders/3dcloud-ALS.vert</vertex-shader>
|
<vertex-shader>Shaders/3dcloud-ALS.vert</vertex-shader>
|
||||||
|
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
|
||||||
<fragment-shader>Shaders/3dcloud-ALS.frag</fragment-shader>
|
<fragment-shader>Shaders/3dcloud-ALS.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
||||||
|
|
|
@ -30,6 +30,8 @@ float top_factor = usrAttr2.b;
|
||||||
|
|
||||||
const float EarthRadius = 5800000.0;
|
const float EarthRadius = 5800000.0;
|
||||||
|
|
||||||
|
vec3 moonlight_perception (in vec3 light);
|
||||||
|
|
||||||
// light_func is a generalized logistic function fit to the light intensity as a function
|
// light_func is a generalized logistic function fit to the light intensity as a function
|
||||||
// of scaled terminator position obtained from Flightgear core
|
// of scaled terminator position obtained from Flightgear core
|
||||||
|
|
||||||
|
@ -68,6 +70,8 @@ void main(void)
|
||||||
|
|
||||||
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
|
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
|
||||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight * scattering;
|
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight * scattering;
|
||||||
|
moonLightColor = moonlight_perception (moonLightColor);
|
||||||
|
|
||||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||||
vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
|
vec4 ep = gl_ModelViewMatrixInverse * vec4(0.0,0.0,0.0,1.0);
|
||||||
vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0);
|
vec4 l = gl_ModelViewMatrixInverse * vec4(0.0,0.0,1.0,1.0);
|
||||||
|
|
|
@ -16,6 +16,8 @@ const float shade = 1.0;
|
||||||
const float cloud_height = 1000.0;
|
const float cloud_height = 1000.0;
|
||||||
const float EarthRadius = 5800000.0;
|
const float EarthRadius = 5800000.0;
|
||||||
|
|
||||||
|
vec3 moonlight_perception (in vec3 light);
|
||||||
|
|
||||||
// light_func is a generalized logistic function fit to the light intensity as a function
|
// light_func is a generalized logistic function fit to the light intensity as a function
|
||||||
// of scaled terminator position obtained from Flightgear core
|
// of scaled terminator position obtained from Flightgear core
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@ void main(void)
|
||||||
|
|
||||||
vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88);
|
vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88);
|
||||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||||
|
moonLightColor = moonlight_perception (moonLightColor);
|
||||||
|
|
||||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||||
//gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0);
|
//gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0);
|
||||||
|
|
|
@ -13,6 +13,8 @@ const float shade = 1.0;
|
||||||
const float cloud_height = 1000.0;
|
const float cloud_height = 1000.0;
|
||||||
const float EarthRadius = 5800000.0;
|
const float EarthRadius = 5800000.0;
|
||||||
|
|
||||||
|
vec3 moonlight_perception (in vec3 light);
|
||||||
|
|
||||||
// light_func is a generalized logistic function fit to the light intensity as a function
|
// light_func is a generalized logistic function fit to the light intensity as a function
|
||||||
// of scaled terminator position obtained from Flightgear core
|
// of scaled terminator position obtained from Flightgear core
|
||||||
|
|
||||||
|
@ -33,6 +35,7 @@ void main(void)
|
||||||
|
|
||||||
vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88);
|
vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88);
|
||||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||||
|
moonLightColor = moonlight_perception (moonLightColor);
|
||||||
|
|
||||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||||
//gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0);
|
//gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0);
|
||||||
|
|
|
@ -13,6 +13,8 @@ const float shade = 1.0;
|
||||||
const float cloud_height = 1000.0;
|
const float cloud_height = 1000.0;
|
||||||
const float EarthRadius = 5800000.0;
|
const float EarthRadius = 5800000.0;
|
||||||
|
|
||||||
|
vec3 moonlight_perception (in vec3 light);
|
||||||
|
|
||||||
// light_func is a generalized logistic function fit to the light intensity as a function
|
// light_func is a generalized logistic function fit to the light intensity as a function
|
||||||
// of scaled terminator position obtained from Flightgear core
|
// of scaled terminator position obtained from Flightgear core
|
||||||
|
|
||||||
|
@ -33,6 +35,7 @@ void main(void)
|
||||||
|
|
||||||
vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88);
|
vec3 shadedFogColor = vec3 (0.55, 0.67, 0.88);
|
||||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||||
|
moonLightColor = moonlight_perception (moonLightColor);
|
||||||
|
|
||||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||||
//gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0);
|
//gl_TexCoord[0] = gl_MultiTexCoord0 + vec4(textureIndexX, textureIndexY, 0.0, 0.0);
|
||||||
|
|
|
@ -25,6 +25,7 @@ uniform sampler2D structure_texture;
|
||||||
|
|
||||||
float Noise2D(in vec2 coord, in float wavelength);
|
float Noise2D(in vec2 coord, in float wavelength);
|
||||||
vec3 filter_combined (in vec3 color) ;
|
vec3 filter_combined (in vec3 color) ;
|
||||||
|
vec3 moonlight_perception (in vec3 light);
|
||||||
|
|
||||||
|
|
||||||
float add_cosines (in float cos1, in float cos2, in float sign)
|
float add_cosines (in float cos1, in float cos2, in float sign)
|
||||||
|
@ -140,6 +141,7 @@ void main()
|
||||||
color.rgb += lightning_color(gl_TexCoord[0].st) * (1.0 - texel.a) * lightning * darkness_fact;
|
color.rgb += lightning_color(gl_TexCoord[0].st) * (1.0 - texel.a) * lightning * darkness_fact;
|
||||||
|
|
||||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||||
|
moonLightColor = moonlight_perception (moonLightColor);
|
||||||
|
|
||||||
color.rgb += moonLightColor;
|
color.rgb += moonLightColor;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ uniform sampler2D normal_texture;
|
||||||
|
|
||||||
float Noise2D(in vec2 coord, in float wavelength);
|
float Noise2D(in vec2 coord, in float wavelength);
|
||||||
vec3 filter_combined (in vec3 color) ;
|
vec3 filter_combined (in vec3 color) ;
|
||||||
|
vec3 moonlight_perception (in vec3 light);
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
@ -135,8 +136,9 @@ void main()
|
||||||
* pow(NdotHV, gl_FrontMaterial.shininess));
|
* pow(NdotHV, gl_FrontMaterial.shininess));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||||
color.rgb += moonLightColor;
|
moonLightColor = moonlight_perception (moonLightColor);
|
||||||
|
color.rgb += moonLightColor;
|
||||||
|
|
||||||
color.a = diffuse_term.a;
|
color.a = diffuse_term.a;
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ vec3 searchlight();
|
||||||
vec3 landing_light(in float offset, in float offsetv);
|
vec3 landing_light(in float offset, in float offsetv);
|
||||||
vec3 filter_combined (in vec3 color) ;
|
vec3 filter_combined (in vec3 color) ;
|
||||||
vec3 addLights(in vec3 color1, in vec3 color2);
|
vec3 addLights(in vec3 color1, in vec3 color2);
|
||||||
|
vec3 moonlight_perception (in vec3 light);
|
||||||
|
|
||||||
|
|
||||||
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
|
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
|
||||||
|
@ -216,6 +217,7 @@ void main (void)
|
||||||
///some generic light scattering parameters
|
///some generic light scattering parameters
|
||||||
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
|
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
|
||||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||||
|
moonLightColor = moonlight_perception (moonLightColor);
|
||||||
float alt = eye_alt;
|
float alt = eye_alt;
|
||||||
float effective_scattering = min(scattering, cloud_self_shading);
|
float effective_scattering = min(scattering, cloud_self_shading);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue