1
0
Fork 0

ALS - begin infrastructure for moonlight perception filtering

This commit is contained in:
Thorsten Renk 2017-06-18 10:08:39 +03:00
parent 79244fd5e4
commit 746e80547e
13 changed files with 38 additions and 1 deletions

View file

@ -239,6 +239,7 @@
</texture-unit>
<program>
<vertex-shader>Shaders/terrain-ALS-ultra.vert</vertex-shader>
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
<fragment-shader>Shaders/agriculture-ALS.frag</fragment-shader>
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>

View file

@ -138,6 +138,7 @@
</texture-unit>
<program>
<vertex-shader>Shaders/terrain-ALS-ultra.vert</vertex-shader>
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
<fragment-shader>Shaders/airfield-ALS.frag</fragment-shader>
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>

View file

@ -139,6 +139,7 @@
</texture-unit>
<program>
<vertex-shader n="0">Shaders/terrain-ALS-ultra.vert</vertex-shader>
<vertex-shader n="1">Shaders/filters-ALS.vert</vertex-shader>
<fragment-shader n="0">Shaders/drunway-ALS.frag</fragment-shader>
<fragment-shader n="1">Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader n="2">Shaders/noise.frag</fragment-shader>

View file

@ -132,6 +132,7 @@
</texture-unit>
<program>
<vertex-shader>Shaders/terrain-ALS-ultra.vert</vertex-shader>
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
<fragment-shader>Shaders/airfield-ALS.frag</fragment-shader>
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>

View file

@ -88,6 +88,7 @@
</render-bin>
<program>
<vertex-shader>Shaders/terrain-ALS-ultra.vert</vertex-shader>
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
<fragment-shader>Shaders/rock-ALS.frag</fragment-shader>
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>

View file

@ -203,6 +203,7 @@
</texture-unit>
<program>
<vertex-shader n="0">Shaders/terrain-ALS-ultra.vert</vertex-shader>
<vertex-shader n="1">Shaders/filters-ALS.vert</vertex-shader>
<fragment-shader n="0">Shaders/runway-ALS.frag</fragment-shader>
<fragment-shader n="1">Shaders/cloud-shadowfunc.frag</fragment-shader>
<fragment-shader n="2">Shaders/noise.frag</fragment-shader>

View file

@ -311,6 +311,7 @@
</texture-unit>
<program>
<vertex-shader>Shaders/terrain-ALS-ultra.vert</vertex-shader>
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
<fragment-shader>Shaders/terrain-ALS-ultra.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/cloud-shadowfunc.frag</fragment-shader>
@ -932,6 +933,7 @@
</texture-unit>
<program>
<vertex-shader>Shaders/terrain-ALS-detailed.vert</vertex-shader>
<vertex-shader>Shaders/filters-ALS.vert</vertex-shader>
<fragment-shader>Shaders/terrain-ALS-detailed.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/hazes.frag</fragment-shader>

View file

@ -67,6 +67,12 @@ return vec3 (0.7, 0.7, 0.7) * gain;
}
vec3 moonlight_perception (in vec3 light) {
return light;
}
vec3 g_force (in vec3 color) {

11
Shaders/filters-ALS.vert Normal file
View file

@ -0,0 +1,11 @@
// -*-C++-*-
// This is a library of filter functions for the vertex shader
// Thorsten Renk 2017
vec3 moonlight_perception (in vec3 light) {
return light;
}

View file

@ -114,6 +114,7 @@ vec3 get_hazeColor(in float lightArg);
vec3 searchlight();
vec3 landing_light(in float offset, in float offsetv);
vec3 filter_combined (in vec3 color) ;
vec3 moonlight_perception (in vec3 light) ;
vec3 addLights(in vec3 color1, in vec3 color2);
@ -147,6 +148,7 @@ void main (void)
///some generic light scattering parameters
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
moonLightColor = moonlight_perception(moonLightColor);
float alt = eye_alt;
float effective_scattering = min(scattering, cloud_self_shading);

View file

@ -122,6 +122,9 @@ vec3 searchlight();
vec3 landing_light(in float offset, in float offsetv);
vec3 addLights(in vec3 color1, in vec3 color2);
vec4 color_temperature (in float T);
vec3 filter_combined (in vec3 color) ;
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)
{
@ -151,6 +154,7 @@ void main (void)
///some generic light scattering parameters
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
moonLightColor = moonlight_perception(moonLightColor);
float alt = eye_alt;
float effective_scattering = min(scattering, cloud_self_shading);

View file

@ -54,6 +54,8 @@ float yprime_alt;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
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)
{
//x = x - 0.5;
@ -72,6 +74,7 @@ void main()
vec4 light_ambient;
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
moonLightColor = moonlight_perception (moonLightColor);
//float yprime_alt;
float yprime;

View file

@ -51,7 +51,7 @@ uniform mat4 osg_ViewMatrixInverse;
float earthShade;
float yprime_alt;
vec3 moonlight_perception (in vec3 light);
// This is the value used in the skydome scattering shader - use the same here for consistency?
const float EarthRadius = 5800000.0;
@ -77,6 +77,9 @@ void main()
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight + vec3 (0.005, 0.005, 0.005);
moonLightColor = moonlight_perception (moonLightColor);
//float yprime_alt;
float yprime;
float lightArg;