Merge branch 'master' of git://gitorious.org/fg/fgdata
This commit is contained in:
commit
ec73ac03c6
10 changed files with 266 additions and 25 deletions
|
@ -16,6 +16,7 @@
|
|||
<wrap-s>mirror</wrap-s>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
|
||||
</parameters>
|
||||
<technique n="9">
|
||||
<predicate>
|
||||
|
@ -98,6 +99,11 @@
|
|||
<type>sampler-1d</type>
|
||||
<value type="int">2</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
<value><use>snow-level</use></value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<wrap-s>mirror</wrap-s>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
|
||||
</parameters>
|
||||
<technique n="9">
|
||||
<predicate>
|
||||
|
@ -98,6 +99,11 @@
|
|||
<type>sampler-1d</type>
|
||||
<value type="int">2</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
<value><use>snow-level</use></value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
132
Effects/forest.eff
Normal file
132
Effects/forest.eff
Normal file
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PropertyList>
|
||||
<name>Effects/forest</name>
|
||||
<inherits-from>Effects/terrain-default</inherits-from>
|
||||
<parameters>
|
||||
<texture n="2">
|
||||
<image>Textures/Terrain/forest.png</image>
|
||||
<filter>linear-mipmap-linear</filter>
|
||||
<wrap-s>repeat</wrap-s>
|
||||
<wrap-t>repeat</wrap-t>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
<texture n="3">
|
||||
<image>Textures/Terrain/forest-colors.png</image>
|
||||
<filter>linear-mipmap-linear</filter>
|
||||
<wrap-s>mirror</wrap-s>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
<texture n="4">
|
||||
<image>Textures/Terrain/forest.png</image>
|
||||
<filter>linear-mipmap-linear</filter>
|
||||
<wrap-s>repeat</wrap-s>
|
||||
<wrap-t>repeat</wrap-t>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
|
||||
</parameters>
|
||||
<technique n="9">
|
||||
<predicate>
|
||||
<and>
|
||||
<property>/sim/rendering/crop-shader</property>
|
||||
<property>/sim/rendering/shader-effects</property>
|
||||
<or>
|
||||
<less-equal>
|
||||
<value type="float">2.0</value>
|
||||
<glversion/>
|
||||
</less-equal>
|
||||
<and>
|
||||
<extension-supported>GL_ARB_shader_objects</extension-supported>
|
||||
<extension-supported>GL_ARB_shading_language_100</extension-supported>
|
||||
<extension-supported>GL_ARB_vertex_shader</extension-supported>
|
||||
<extension-supported>GL_ARB_fragment_shader</extension-supported>
|
||||
</and>
|
||||
</or>
|
||||
</and>
|
||||
</predicate>
|
||||
<pass>
|
||||
<lighting>true</lighting>
|
||||
<!-- Use material values that are either inherited from the
|
||||
terrain-default effect or supplied by an effect derived
|
||||
from this one e.g., one created in the materials library. -->
|
||||
<material>
|
||||
<ambient><use>material/ambient</use></ambient>
|
||||
<diffuse><use>material/diffuse</use></diffuse>
|
||||
<specular><use>material/specular</use></specular>
|
||||
<color-mode>ambient-and-diffuse</color-mode>
|
||||
</material>
|
||||
<blend><use>transparent</use></blend>
|
||||
<alpha-test><use>transparent</use></alpha-test>
|
||||
<shade-model>smooth</shade-model>
|
||||
<cull-face>back</cull-face>
|
||||
<render-bin>
|
||||
<bin-number><use>render-bin/bin-number</use></bin-number>
|
||||
<bin-name><use>render-bin/bin-name</use></bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<unit>0</unit>
|
||||
<type>noise</type>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>1</unit>
|
||||
<image><use>texture[2]/image</use></image>
|
||||
<filter><use>texture[2]/filter</use></filter>
|
||||
<wrap-s><use>texture[2]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[2]/wrap-t</use></wrap-t>
|
||||
<internal-format>
|
||||
<use>texture[2]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>3</unit>
|
||||
<type>1d</type>
|
||||
<image><use>texture[3]/image</use></image>
|
||||
<filter><use>texture[3]/filter</use></filter>
|
||||
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
|
||||
<internal-format>
|
||||
<use>texture[3]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
<texture-unit>
|
||||
<unit>2</unit>
|
||||
<image><use>texture[4]/image</use></image>
|
||||
<filter><use>texture[4]/filter</use></filter>
|
||||
<wrap-s><use>texture[4]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[4]/wrap-t</use></wrap-t>
|
||||
<internal-format>
|
||||
<use>texture[4]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
|
||||
<program>
|
||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/forest.frag</fragment-shader>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>NoiseTex</name>
|
||||
<type>sampler-3d</type>
|
||||
<value type="int">0</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>SampleTex</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">1</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>SampleTex2</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">2</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>ColorsTex</name>
|
||||
<type>sampler-1d</type>
|
||||
<value type="int">3</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
<value><use>snow-level</use></value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
|
@ -4,25 +4,20 @@ varying vec4 rawpos;
|
|||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 Normal;
|
||||
varying vec4 constantColor;
|
||||
|
||||
uniform sampler3D NoiseTex;
|
||||
uniform sampler2D SampleTex;
|
||||
uniform sampler1D ColorsTex;
|
||||
|
||||
const float scale = 1.0;
|
||||
uniform float snowlevel; // From /sim/rendering/snow-level-m
|
||||
|
||||
const vec4 red = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
const vec4 green = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
const vec4 blue = vec4(0.0, 0.0, 1.0, 1.0);
|
||||
const vec4 yellow = vec4(1.0, 1.0, 0.0, 1.0);
|
||||
const float scale = 1.0;
|
||||
|
||||
#define BLA 1
|
||||
#define BLA2 0
|
||||
|
||||
void main (void)
|
||||
{
|
||||
const float snowlevel=2000.0;
|
||||
|
||||
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144);
|
||||
basecolor = texture1D(ColorsTex, basecolor.r+0.00);
|
||||
|
@ -54,13 +49,15 @@ void main (void)
|
|||
// good
|
||||
vec4 c1;
|
||||
c1 = basecolor * vec4(smoothstep(0.0, 1.15, n), smoothstep(0.0, 1.2, n), smoothstep(0.1, 1.3, n), 1.0);
|
||||
|
||||
//"steep = gray"
|
||||
c1 = mix(vec4(n-0.42, n-0.44, n-0.51, 1.0), c1, smoothstep(0.970, 0.990, abs(normalize(Normal).z)+nvL[2]*1.3));
|
||||
|
||||
//"snow"
|
||||
c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
|
||||
|
||||
vec3 diffuse = gl_Color.rgb * max(0.0, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||
vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
|
||||
vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
|
||||
|
||||
c1 *= ambient_light;
|
||||
vec4 finalColor = c1;
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
#version 120
|
||||
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 Normal;
|
||||
varying vec4 constantColor;
|
||||
centroid varying vec4 ipos;
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 Normal;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
||||
rawpos = gl_Vertex;
|
||||
ipos = gl_Vertex;
|
||||
rawpos = gl_Vertex;
|
||||
ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
VNormal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
Normal = normalize(gl_Normal);
|
||||
gl_FrontColor = gl_Color;
|
||||
constantColor = gl_FrontMaterial.emission
|
||||
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
85
Shaders/forest.frag
Normal file
85
Shaders/forest.frag
Normal file
|
@ -0,0 +1,85 @@
|
|||
#version 120
|
||||
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 Normal;
|
||||
|
||||
uniform sampler3D NoiseTex;
|
||||
uniform sampler2D SampleTex;
|
||||
uniform sampler1D ColorsTex;
|
||||
uniform sampler2D SampleTex2;
|
||||
|
||||
uniform float snowlevel; // From /sim/rendering/snow-level-m
|
||||
|
||||
const float scale = 1.0;
|
||||
|
||||
|
||||
void main (void)
|
||||
{
|
||||
|
||||
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144);
|
||||
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 fogFactor;
|
||||
float fogCoord = ecPosition.z;
|
||||
const float LOG2 = 1.442695;
|
||||
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
|
||||
float biasFactor = exp2(-0.00000002 * fogCoord * fogCoord * LOG2);
|
||||
|
||||
float n=0.12;
|
||||
n += nvL[0]*0.4;
|
||||
n += nvL[1]*0.6;
|
||||
n += nvL[2]*2.0;
|
||||
n += nvL[3]*4.0;
|
||||
n += noisevec[0]*0.1;
|
||||
n += noisevec[1]*0.4;
|
||||
|
||||
n += noisevec[2]*0.8;
|
||||
n += noisevec[3]*2.1;
|
||||
n = mix(0.6, 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);
|
||||
|
||||
//draw floor where !steep, and another blurb for smoothing transitions
|
||||
vec4 c3, c4, c5;
|
||||
c3 = mix(vec4(n-0.88, n-0.14, -n, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3));
|
||||
c4 = mix(vec4(n-0.88, n-0.74, -n, 0.0), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9));
|
||||
c5 = mix(c3, c4, 1.0);
|
||||
|
||||
//brings vegetation 'floor', added vegetationlevel
|
||||
|
||||
float vegetationlevel = (rawpos.z)+nvL[2]*3000.0;
|
||||
|
||||
if (vegetationlevel < 2200) {
|
||||
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.4));
|
||||
}
|
||||
|
||||
else {
|
||||
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.1));
|
||||
}
|
||||
|
||||
//snow
|
||||
c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
|
||||
|
||||
vec3 diffuse = gl_Color.rgb * max(0.4, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||
vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
|
||||
|
||||
c1 *= ambient_light;
|
||||
vec4 finalColor = c1;
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor);
|
||||
}
|
19
Shaders/forest.vert
Normal file
19
Shaders/forest.vert
Normal file
|
@ -0,0 +1,19 @@
|
|||
#version 120
|
||||
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 Normal;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
||||
rawpos = gl_Vertex;
|
||||
ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
VNormal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
Normal = normalize(gl_Normal);
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_Position = ftransform();
|
||||
}
|
BIN
Textures/Terrain/forest-colors.png
Normal file
BIN
Textures/Terrain/forest-colors.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 525 B |
BIN
Textures/Terrain/forest.png
Normal file
BIN
Textures/Terrain/forest.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 852 KiB |
|
@ -708,7 +708,7 @@ Shared parameters for various materials.
|
|||
</condition>
|
||||
<name>EvergreenBroadCover</name>
|
||||
<name>EvergreenForest</name>
|
||||
<effect>Effects/landmass</effect>
|
||||
<effect>Effects/forest</effect>
|
||||
<texture>Terrain/forest1a.png</texture>
|
||||
<texture>Terrain/forest1b.png</texture>
|
||||
<texture>Terrain/forest1c.png</texture>
|
||||
|
@ -732,7 +732,7 @@ Shared parameters for various materials.
|
|||
<value>summer</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<effect>Effects/landmass</effect>
|
||||
<effect>Effects/forest</effect>
|
||||
<name>DeciduousBroadCover</name>
|
||||
<name>DeciduousForest</name>
|
||||
<name>Bog</name>
|
||||
|
@ -759,7 +759,7 @@ Shared parameters for various materials.
|
|||
<value>summer</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<effect>Effects/landmass</effect>
|
||||
<effect>Effects/forest</effect>
|
||||
<name>MixedForestCover</name>
|
||||
<name>MixedForest</name>
|
||||
<name>RainForest</name>
|
||||
|
@ -786,7 +786,7 @@ Shared parameters for various materials.
|
|||
<value>summer</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<effect>Effects/landmass</effect>
|
||||
<effect>Effects/forest</effect>
|
||||
<name>EvergreenNeedleCover</name>
|
||||
<name>WoodedTundraCover</name>
|
||||
<texture>Terrain/evergreen.png</texture>
|
||||
|
@ -810,7 +810,7 @@ Shared parameters for various materials.
|
|||
<value>summer</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<effect>Effects/landmass</effect>
|
||||
<effect>Effects/forest</effect>
|
||||
<name>DeciduousNeedleCover</name>
|
||||
<texture>Terrain/dec_evergreen.png</texture>
|
||||
<xsize>1000</xsize>
|
||||
|
|
Loading…
Reference in a new issue