1
0
Fork 0

Optional second landing light and light offset control for ALS

This commit is contained in:
Thorsten Renk 2014-10-06 09:43:51 +03:00
parent ac92428ff3
commit f3cc0ac539
8 changed files with 89 additions and 16 deletions

View file

@ -235,6 +235,16 @@
<type>float</type>
<value><use>view_fov</use></value>
</uniform>
<uniform>
<name>landing_light1_offset</name>
<type>float</type>
<value><use>landing_light1_offset</use></value>
</uniform>
<uniform>
<name>landing_light2_offset</name>
<type>float</type>
<value><use>landing_light2_offset</use></value>
</uniform>
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
@ -465,6 +475,11 @@
<type>int</type>
<value> <use>use_landing_light</use></value>
</uniform>
<uniform>
<name>use_alt_landing_light</name>
<type>int</type>
<value> <use>use_alt_landing_light</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>

View file

@ -276,6 +276,16 @@
<type>float</type>
<value><use>view_fov</use></value>
</uniform>
<uniform>
<name>landing_light1_offset</name>
<type>float</type>
<value><use>landing_light1_offset</use></value>
</uniform>
<uniform>
<name>landing_light2_offset</name>
<type>float</type>
<value><use>landing_light2_offset</use></value>
</uniform>
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
@ -501,6 +511,11 @@
<type>int</type>
<value> <use>use_landing_light</use></value>
</uniform>
<uniform>
<name>use_alt_landing_light</name>
<type>int</type>
<value> <use>use_alt_landing_light</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>

View file

@ -123,6 +123,9 @@
<view_fov><use>/sim/current-view/field-of-view</use></view_fov>
<use_searchlight><use>/sim/rendering/als-secondary-lights/use-searchlight</use></use_searchlight>
<use_landing_light><use>/sim/rendering/als-secondary-lights/use-landing-light</use></use_landing_light>
<use_alt_landing_light><use>/sim/rendering/als-secondary-lights/use-alt-landing-light</use></use_alt_landing_light>
<landing_light1_offset><use>/sim/rendering/als-secondary-lights/landing-light1-offset-deg</use></landing_light1_offset>
<landing_light2_offset><use>/sim/rendering/als-secondary-lights/landing-light2-offset-deg</use></landing_light2_offset>
<quality_level><use>/sim/rendering/shaders/landmass</use></quality_level>
<tquality_level><use>/sim/rendering/shaders/transition</use></tquality_level>
<cloudpos1_x><use>/local-weather/cloud-shadows/cloudpos-x[0]</use></cloudpos1_x>
@ -298,7 +301,7 @@
</texture-unit>
<program>
<vertex-shader>Shaders/terrain-haze-ultra.vert</vertex-shader>
<fragment-shader>Shaders/terrain-haze-ultra.frag</fragment-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>
<fragment-shader>Shaders/hazes.frag</fragment-shader>
@ -459,6 +462,16 @@
<type>float</type>
<value><use>view_fov</use></value>
</uniform>
<uniform>
<name>landing_light1_offset</name>
<type>float</type>
<value><use>landing_light1_offset</use></value>
</uniform>
<uniform>
<name>landing_light2_offset</name>
<type>float</type>
<value><use>landing_light2_offset</use></value>
</uniform>
<uniform>
<name>cloudpos1_x</name>
<type>float</type>
@ -679,6 +692,11 @@
<type>int</type>
<value> <use>use_landing_light</use></value>
</uniform>
<uniform>
<name>use_alt_landing_light</name>
<type>int</type>
<value> <use>use_alt_landing_light</use></value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>

View file

@ -34,12 +34,16 @@ uniform float overlay_bias;
uniform float overlay_alpha;
uniform float wetness;
uniform float air_pollution;
uniform float landing_light1_offset;
uniform float landing_light2_offset;
uniform int quality_level;
uniform int tquality_level;
uniform int cloud_shadow_flag;
uniform int use_overlay;
uniform int use_searchlight;
uniform int use_landing_light;
uniform int use_alt_landing_light;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@ -56,7 +60,7 @@ float rayleigh_in_func(in float dist, in float air_pollution, in float avisibili
float alt_factor(in float eye_alt, in float vertex_alt);
vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
vec3 searchlight(in float dist);
vec3 landing_light(in float dist);
vec3 landing_light(in float dist, in float offset);
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
{
@ -274,7 +278,11 @@ if (quality_level > 3)
}
if (use_landing_light == 1)
{
color.rgb += landing_light(dist);
color.rgb += landing_light(dist, landing_light1_offset);
}
if (use_alt_landing_light == 1)
{
color.rgb += landing_light(dist, landing_light2_offset);
}
fragColor = color * texel + specular;

View file

@ -31,12 +31,15 @@ uniform float fogstructure;
uniform float snow_thickness_factor;
uniform float cloud_self_shading;
uniform float uvstretch;
uniform float landing_light1_offset;
uniform float landing_light2_offset;
uniform int quality_level;
uniform int tquality_level;
uniform int cloud_shadow_flag;
uniform int use_searchlight;
uniform int use_landing_light;
uniform int use_alt_landing_light;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@ -50,7 +53,7 @@ float shadow_func (in float x, in float y, in float noise, in float dist);
float Noise2D(in vec2 coord, in float wavelength);
float fog_func (in float targ, in float alt);
vec3 searchlight(in float dist);
vec3 landing_light(in float dist);
vec3 landing_light(in float dist, in float offset);
@ -252,7 +255,11 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0))
}
if (use_landing_light == 1)
{
color.rgb += landing_light(dist);
color.rgb += landing_light(dist, landing_light1_offset);
}
if (use_alt_landing_light == 1)
{
color.rgb += landing_light(dist, landing_light2_offset);
}
fragColor = color * texel + specular;

View file

@ -12,12 +12,12 @@ vec3 searchlight(in float dist)
vec2 center = vec2 (float(display_xsize) * 0.5, float(display_ysize) * 0.4);
float headlightIntensity;
float lightRadius = (200.0 * 55.0/field_of_view);
float lightRadius = (float(display_xsize) *9.16 /field_of_view);
float angularDist = length(gl_FragCoord.xy -center);
if (angularDist < lightRadius)
{
headlightIntensity = pow(cos(angularDist/lightRadius * 3.1415/2.0),2.0);
headlightIntensity = pow(cos(angularDist/lightRadius * 1.57075),2.0);
headlightIntensity = headlightIntensity * min(1.0, 10000.0/(dist*dist));
//headlightIntensity*= clamp(1.0 + 0.15 * log(1000.0/(dist*dist)),0.0,1.0);
return headlightIntensity * vec3 (0.5,0.5, 0.5);
@ -25,7 +25,7 @@ if (angularDist < lightRadius)
else return vec3 (0.0,0.0,0.0);
}
vec3 landing_light(in float dist)
vec3 landing_light(in float dist, in float offset)
{
float fov_h = field_of_view;
@ -38,22 +38,22 @@ if (view_heading_offset > 180.0)
else
{yaw_offset = view_heading_offset;}
float x_offset = (float(display_xsize) / fov_h * yaw_offset);
float x_offset = (float(display_xsize) / fov_h * (yaw_offset + offset));
float y_offset = -(float(display_ysize) / fov_v * view_pitch_offset);
vec2 center = vec2 (float(display_xsize) * 0.5 + x_offset, float(display_ysize) * 0.4 + y_offset);
float headlightIntensity;
float lightRadius = (200.0 * 55.0/field_of_view);
float landingLightIntensity;
float lightRadius = (float(display_xsize) *9.16 /field_of_view);
float angularDist = length(gl_FragCoord.xy -center);
if (angularDist < lightRadius)
{
headlightIntensity = pow(cos(angularDist/lightRadius * 3.1415/2.0),2.0);
headlightIntensity = headlightIntensity * min(1.0, 10000.0/(dist*dist));
return headlightIntensity * vec3 (0.5,0.5, 0.5);
landingLightIntensity = pow(cos(angularDist/lightRadius * 1.57075),2.0);
landingLightIntensity *= min(1.0, 10000.0/(dist*dist));
return landingLightIntensity * vec3 (0.5,0.5, 0.5);
}
else return vec3 (0.0,0.0,0.0);
}

View file

@ -52,6 +52,8 @@ uniform float dot_size;
uniform float dust_resistance;
uniform float WindE;
uniform float WindN;
uniform float landing_light1_offset;
uniform float landing_light2_offset;
uniform float osg_SimulationTime;
uniform int quality_level;
@ -61,6 +63,7 @@ uniform int cloud_shadow_flag;
uniform int rock_strata;
uniform int use_searchlight;
uniform int use_landing_light;
uniform int use_alt_landing_light;
const float EarthRadius = 5800000.0;
const float terminator_width = 200000.0;
@ -81,7 +84,7 @@ float rayleigh_in_func(in float dist, in float air_pollution, in float avisibili
float alt_factor(in float eye_alt, in float vertex_alt);
vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
vec3 searchlight(in float dist);
vec3 landing_light(in float dist);
vec3 landing_light(in float dist, in float offset);
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
{
@ -466,7 +469,11 @@ if ((dist < 5000.0)&& (quality_level > 3) && (combined_wetness>0.0))
}
if (use_landing_light == 1)
{
color.rgb += landing_light(dist);
color.rgb += landing_light(dist, landing_light1_offset);
}
if (use_alt_landing_light == 1)
{
color.rgb += landing_light(dist, landing_light2_offset);
}

View file

@ -290,6 +290,9 @@ Started September 2000 by David Megginson, david@megginson.com
<als-secondary-lights>
<use-searchlight type="bool">false</use-searchlight>
<use-landing-light type="bool">false</use-landing-light>
<use-alt-landing-light type="bool">false</use-alt-landing-light>
<landing-light1-offset-deg type="float">0.0</landing-light1-offset-deg>
<landing-light2-offset-deg type="float">0.0</landing-light2-offset-deg>
</als-secondary-lights>
</rendering>
<model-hz type="int">120</model-hz>