1
0
Fork 0

European deciduous trees change autumn color in ALS

This commit is contained in:
Thorsten Renk 2015-02-18 10:35:00 +02:00
parent 82774e0002
commit ce77fcfac9
7 changed files with 114 additions and 1 deletions

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/tree-european-deciduous</name>
<inherits-from>Effects/tree</inherits-from>
<parameters>
<num_deciduous_trees>8</num_deciduous_trees>
</parameters>
</PropertyList>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/tree-european-mixed</name>
<inherits-from>Effects/tree</inherits-from>
<parameters>
<num_deciduous_trees>4</num_deciduous_trees>
</parameters>
</PropertyList>

View file

@ -17,6 +17,7 @@
<texture n ="0"> <texture n ="0">
</texture> </texture>
<!-- fog include --> <!-- fog include -->
<num_deciduous_trees>0</num_deciduous_trees>
<visibility><use>/environment/ground-visibility-m</use></visibility> <visibility><use>/environment/ground-visibility-m</use></visibility>
<avisibility><use>/environment/visibility-m</use></avisibility> <avisibility><use>/environment/visibility-m</use></avisibility>
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness> <lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
@ -29,6 +30,7 @@
<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt> <eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
<snow_level><use>/environment/snow-level-m</use></snow_level> <snow_level><use>/environment/snow-level-m</use></snow_level>
<season><use>/environment/tree-season</use></season> <season><use>/environment/tree-season</use></season>
<cseason><use>/environment/season</use></cseason>
<dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor> <dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor>
<fogtype><use>/sim/rendering/shaders/skydome</use></fogtype> <fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
<fogstructure><use>/environment/fog-structure</use></fogstructure> <fogstructure><use>/environment/fog-structure</use></fogstructure>
@ -202,6 +204,11 @@
<type>float</type> <type>float</type>
<value><use>season</use></value> <value><use>season</use></value>
</uniform> </uniform>
<uniform>
<name>cseason</name>
<type>float</type>
<value><use>cseason</use></value>
</uniform>
<uniform> <uniform>
<name>WindE</name> <name>WindE</name>
<type>float</type> <type>float</type>
@ -472,6 +479,11 @@
<type>int</type> <type>int</type>
<value><use>display_ysize</use></value> <value><use>display_ysize</use></value>
</uniform> </uniform>
<uniform>
<name>num_deciduous_trees</name>
<type>int</type>
<value><use>num_deciduous_trees</use></value>
</uniform>
<uniform> <uniform>
<name>texture</name> <name>texture</name>
<type>sampler-2d</type> <type>sampler-2d</type>
@ -618,6 +630,11 @@
<type>float</type> <type>float</type>
<value><use>season</use></value> <value><use>season</use></value>
</uniform> </uniform>
<uniform>
<name>cseason</name>
<type>float</type>
<value><use>cseason</use></value>
</uniform>
<uniform> <uniform>
<name>WindE</name> <name>WindE</name>
<type>float</type> <type>float</type>
@ -888,6 +905,11 @@
<type>int</type> <type>int</type>
<value><use>display_ysize</use></value> <value><use>display_ysize</use></value>
</uniform> </uniform>
<uniform>
<name>num_deciduous_trees</name>
<type>int</type>
<value><use>num_deciduous_trees</use></value>
</uniform>
<uniform> <uniform>
<name>texture</name> <name>texture</name>
<type>sampler-2d</type> <type>sampler-2d</type>

View file

@ -60,6 +60,7 @@
<material> <material>
<effect>Effects/cropgrass</effect> <effect>Effects/cropgrass</effect>
<tree-effect>Effects/tree-european-mixed</tree-effect>
<name>CropGrassCover</name> <name>CropGrassCover</name>
<name>CropGrass</name> <name>CropGrass</name>
<texture>Terrain/cropgrass-hires-autumn.png</texture> <texture>Terrain/cropgrass-hires-autumn.png</texture>
@ -97,6 +98,7 @@
<material> <material>
<name>BuiltUpCover</name> <name>BuiltUpCover</name>
<name>Urban</name> <name>Urban</name>
<tree-effect>Effects/tree-european-deciduous</tree-effect>
<texture>Terrain/18th_century_city.png</texture> <texture>Terrain/18th_century_city.png</texture>
<object-mask>Terrain/18th_century_city.mask.png</object-mask> <object-mask>Terrain/18th_century_city.mask.png</object-mask>
<xsize>1000</xsize> <xsize>1000</xsize>
@ -245,4 +247,45 @@
<tree-width-m>12.0</tree-width-m> <tree-width-m>12.0</tree-width-m>
</material> </material>
<material>
<effect>Effects/forest</effect>
<tree-effect>Effects/tree-european-deciduous</tree-effect>
<name>DeciduousBroadCover</name>
<name>DeciduousForest</name>
<name>Bog</name>
<name>Heath</name>
<texture>Terrain/deciduous-hires-autumn.png</texture>
<xsize>2000</xsize>
<ysize>2000</ysize>
<light-coverage>10000000.0</light-coverage>
<wood-coverage>4000.0</wood-coverage>
<tree-texture>Trees/deciduous-alt.png</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
<tree-height-m>25.0</tree-height-m>
<tree-width-m>15.0</tree-width-m>
<rolling-friction>1</rolling-friction>
<bumpiness>0.85</bumpiness>
</material>
<material>
<effect>Effects/forest</effect>
<tree-effect>Effects/tree-european-mixed</tree-effect>
<name>MixedForestCover</name>
<name>MixedForest</name>
<name>RainForest</name>
<texture>Terrain/mixedforest-hires-autumn.png</texture>
<xsize>2000</xsize>
<ysize>2000</ysize>
<light-coverage>5000000.0</light-coverage>
<wood-coverage>4000.0</wood-coverage>
<tree-texture>Trees/mixed-alt.png</tree-texture>
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
<tree-height-m>25.0</tree-height-m>
<tree-width-m>15.0</tree-width-m>
<rolling-friction>1</rolling-friction>
<bumpiness>0.95</bumpiness>
</material>
</PropertyList> </PropertyList>

View file

@ -522,6 +522,15 @@
<rolling-friction>0.1</rolling-friction> <rolling-friction>0.1</rolling-friction>
<bumpiness>0.1</bumpiness> <bumpiness>0.1</bumpiness>
<load-resistance>1e30</load-resistance> <load-resistance>1e30</load-resistance>
<!-- uncomment this to get volumetric grass on airport keep
<wood-coverage>10.0</wood-coverage>
<tree-texture>Trees/grass_blades.png</tree-texture>
<tree-varieties>1</tree-varieties>
<tree-range-m>200.0</tree-range-m>
<tree-height-m>0.3</tree-height-m>
<tree-width-m>1.0</tree-width-m>
-->
</material> </material>
<!-- default mixed crop --> <!-- default mixed crop -->

View file

@ -11,6 +11,7 @@ uniform sampler2D texture;
varying float yprime_alt; varying float yprime_alt;
varying float autumn_flag;
uniform float visibility; uniform float visibility;
uniform float avisibility; uniform float avisibility;
@ -26,6 +27,7 @@ uniform float dust_cover_factor;
uniform float air_pollution; uniform float air_pollution;
uniform float landing_light1_offset; uniform float landing_light1_offset;
uniform float landing_light2_offset; uniform float landing_light2_offset;
uniform float cseason;
uniform int use_searchlight; uniform int use_searchlight;
uniform int use_landing_light; uniform int use_landing_light;
@ -135,10 +137,22 @@ void main()
if (quality_level > 3) if (quality_level > 3)
{ {
// seasonal color changes
if ((cseason < 1.5)&& (autumn_flag > 0.0))
{
texel.r = min(1.0, (1.0 + 5.0 *cseason * autumn_flag ) * texel.r);
//texel.g = texel.g + 0.05 * (autumn_flag-0.5) * cseason;
texel.b = max(0.0, (1.0 - 8.0 * cseason) * texel.b);
}
// mix dust // mix dust
vec4 dust_color = vec4 (0.76, 0.71, 0.56, texel.a); vec4 dust_color = vec4 (0.76, 0.71, 0.56, texel.a);
texel = mix(texel, dust_color, clamp(0.6 * dust_cover_factor ,0.0, 1.0) ); texel = mix(texel, dust_color, clamp(0.6 * dust_cover_factor ,0.0, 1.0) );
} }
@ -346,6 +360,8 @@ fragColor.rgb = mix( hazeColor + secondary_light * fog_backscatter(mvisibility)
} }
//if (autumn_flag > 0.0) {fragColor = vec4 (0.0,0.0,0.0,1.0);}
gl_FragColor = fragColor; gl_FragColor = fragColor;
} }

View file

@ -22,10 +22,12 @@
varying vec3 relPos; varying vec3 relPos;
varying float yprime_alt; varying float yprime_alt;
varying float autumn_flag;
uniform int colorMode; uniform int colorMode;
uniform int wind_effects; uniform int wind_effects;
uniform int forest_effects; uniform int forest_effects;
uniform int num_deciduous_trees;
uniform float hazeLayerAltitude; uniform float hazeLayerAltitude;
uniform float terminator; uniform float terminator;
uniform float terrain_alt; uniform float terrain_alt;
@ -66,7 +68,6 @@ return e / pow((1.0 + a * exp(-b * (x-c)) ),(1.0/d));
void main() void main()
{ {
//vec4 light_diffuse;
vec4 light_ambient; vec4 light_ambient;
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88); vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
@ -81,6 +82,12 @@ void main()
float numVarieties = gl_Normal.z; float numVarieties = gl_Normal.z;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties; float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
// determine whether the tree changes color in autumn
if (texFract < (float) num_deciduous_trees/numVarieties) {autumn_flag = 0.5 + fract(gl_Color.x);}
else {autumn_flag = 0.0;}
texFract += floor(gl_MultiTexCoord0.x) / numVarieties; texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
// Determine the rotation for the tree. The Fog Coordinate provides rotation information // Determine the rotation for the tree. The Fog Coordinate provides rotation information