1
0
Fork 0

Merge branch 'master' of git://gitorious.org/fg/fgdata

This commit is contained in:
BARANGER Emmanuel 2012-02-13 00:44:05 +01:00
commit 45c56e51bc
6 changed files with 258 additions and 37 deletions

View file

@ -173,6 +173,15 @@ property-assign - assign a value to a property
value: the new value for the property; or
property[1]: the name of the property holding the new value.
property-interpolate - assign a value to a property, interpolated
over time
property[0]: the name of the property that will get the new value
and defines the starting point of the interpolation
value: the new value for the property; or
property[1]: the name of the property holding the new value.
time: the time in seconds it takes for the transition from the
old value to the new value of property[0]
property-adjust - adjust the value of a property
property: the name of the property to increment or decrement
step: the amount of the increment or decrement (defaults to 0)

View file

@ -34,13 +34,33 @@
<depth-factor type="float">0.04</depth-factor>
<canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
<!--fog include-->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/shaders/skydome</use>
</fogtype>
<!-- END fog include -->
</parameters>
<generate>
<tangent type="int">6</tangent>
@ -128,8 +148,10 @@
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/forest.vert</vertex-shader>
<fragment-shader>Shaders/forest.frag</fragment-shader>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
@ -192,13 +214,57 @@
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
</PropertyList>

View file

@ -34,13 +34,34 @@
<depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
<!--fog include-->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/shaders/skydome</use>
</fogtype>
<!-- END fog include -->
</parameters>
<generate>
<tangent type="int">6</tangent>
@ -128,8 +149,10 @@
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/forest.vert</vertex-shader>
<fragment-shader>Shaders/forest.frag</fragment-shader>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
@ -192,13 +215,57 @@
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
</PropertyList>

View file

@ -33,13 +33,34 @@
<snow-level><use>/environment/snow-level-m</use></snow-level>
<depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
<!--fog include-->
<visibility>
<use>/environment/ground-visibility-m</use>
</visibility>
<avisibility>
<use>/environment/visibility-m</use>
</avisibility>
<lthickness>
<use>/environment/ground-haze-thickness-m</use>
</lthickness>
<scattering>
<use>/rendering/scene/scattering</use>
</scattering>
<terminator>
<use>/environment/terminator-relative-position-m</use>
</terminator>
<fogtype>
<use>/sim/rendering/shaders/skydome</use>
</fogtype>
<!-- END fog include -->
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
</parameters>
<generate>
@ -128,8 +149,10 @@
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/forest.vert</vertex-shader>
<fragment-shader>Shaders/forest.frag</fragment-shader>
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
@ -192,13 +215,57 @@
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
<!-- BEGIN fog include -->
<uniform>
<name>visibility</name>
<type>float</type>
<value>
<use>visibility</use>
</value>
</uniform>
<uniform>
<name>avisibility</name>
<type>float</type>
<value>
<use>avisibility</use>
</value>
</uniform>
<uniform>
<name>hazeLayerAltitude</name>
<type>float</type>
<value>
<use>lthickness</use>
</value>
</uniform>
<uniform>
<name>scattering</name>
<type>float</type>
<value>
<use>scattering</use>
</value>
</uniform>
<uniform>
<name>terminator</name>
<type>float</type>
<value>
<use>terminator</use>
</value>
</uniform>
<uniform>
<name>fogType</name>
<type>int</type>
<value>
<use>fogtype</use>
</value>
</uniform>
<!-- END fog include -->
</pass>
</technique>
</PropertyList>

View file

@ -22,6 +22,12 @@ uniform float snowlevel; // From /sim/rendering/snow-level-m
const float scale = 1.0;
int linear_search_steps = 10;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
{
@ -89,13 +95,13 @@ void main (void)
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000344);
vec4 basecolor2 = texture2D(SampleTex2, rawpos.xy*0.000144);
basecolor = texture1D(ColorsTex, basecolor.r+0.0);
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
float vegetationlevel = (rawpos.z)+nvL[2]*3000.0;
const float LOG2 = 1.442695;
@ -113,20 +119,20 @@ void main (void)
n += noisevec[2]*0.8;
n += noisevec[3]*2.1;
//very low n/biasFactor mix, to keep forest color
n = mix(0.05, n, biasFactor);
vec4 c1;
c1 = basecolor * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0);
vec4 c2;
c2 = basecolor2 * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0);
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse;
//draw floor where !steep, and another blurb for smoothing transitions
vec4 c3, c4, c5, c3a, c4a, c5a;
float subred = 1.0 - red; float subgreen = 1.0 - green; float subblue = 1.0 - blue;
@ -135,39 +141,39 @@ void main (void)
c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n-subblue, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32));
c5 = mix(c3, c4, 1.0);
c5a = mix(c3, c4a, 1.0);
if (vegetationlevel <= 2200.0) {
c1 = mix(c2, c5, clamp(0.65, n*0.1, 0.5));
diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel > 2200.0 && vegetationlevel < 2300.0) {
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.35));
diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel >= 2300.0 && vegetationlevel < 2480.0) {
c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.30));
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel >= 2480.0 && vegetationlevel < 2530.0) {
c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.20));
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel >= 2530.0 && vegetationlevel < 2670.0) {
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.10));
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel >= 2670.0) {
c1 = mix(c2, c5, clamp(0.0, n*0.1, 0.4));
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
//adding snow and permanent snow/glacier
if (vegetationlevel > snowlevel || vegetationlevel > 3100.0) {
c3 = mix(vec4(n+1.0, n+1.0, n+1.0, 0.0), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*1.3));
@ -182,8 +188,6 @@ void main (void)
c1 *= ambient_light;
vec4 finalColor = c1;
if(gl_Fog.density == 1.0)
fogFactor=1.0;
gl_FragColor = mix(gl_Fog.color,finalColor, fogFactor);
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
gl_FragColor = finalColor;
}

View file

@ -1,3 +1,4 @@
#version 120
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 VNormal;
@ -9,6 +10,12 @@ varying vec4 constantColor;
attribute vec3 tangent;
attribute vec3 binormal;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main(void)
{
rawpos = gl_Vertex;
@ -20,7 +27,8 @@ void main(void)
gl_FrontColor = gl_Color;
constantColor = gl_FrontMaterial.emission
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
fog_Func(fogType);
}