Merge branch 'master' of git://gitorious.org/fg/fgdata
This commit is contained in:
commit
e9460a7c46
9 changed files with 545 additions and 30 deletions
|
@ -4,7 +4,7 @@
|
|||
<inherits-from>Effects/terrain-default</inherits-from>
|
||||
<parameters>
|
||||
<texture n="2">
|
||||
<image>Textures/Terrain/forest.png</image>
|
||||
<image>Textures/Terrain/rock.png</image>
|
||||
<filter>linear-mipmap-linear</filter>
|
||||
<wrap-s>repeat</wrap-s>
|
||||
<wrap-t>repeat</wrap-t>
|
||||
|
@ -23,8 +23,22 @@
|
|||
<wrap-t>repeat</wrap-t>
|
||||
<internal-format>normalized</internal-format>
|
||||
</texture>
|
||||
<texture n="5">
|
||||
<image>Textures.high/Terrain/forest-relief.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>
|
||||
<depth-factor type="float">0.04</depth-factor>
|
||||
<canopy-height type="float">15.0</canopy-height>
|
||||
<quality-level><use>/sim/rendering/quality-level</use></quality-level>
|
||||
</parameters>
|
||||
<generate>
|
||||
<tangent type="int">6</tangent>
|
||||
<binormal type="int">7</binormal>
|
||||
</generate>
|
||||
<technique n="9">
|
||||
<predicate>
|
||||
<and>
|
||||
|
@ -97,10 +111,27 @@
|
|||
<use>texture[4]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
|
||||
<texture-unit>
|
||||
<unit>5</unit>
|
||||
<image><use>texture[5]/image</use></image>
|
||||
<filter><use>texture[5]/filter</use></filter>
|
||||
<wrap-s><use>texture[5]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[5]/wrap-t</use></wrap-t>
|
||||
<internal-format>
|
||||
<use>texture[5]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/forest.frag</fragment-shader>
|
||||
<attribute>
|
||||
<name>tangent</name>
|
||||
<index>6</index>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<name>binormal</name>
|
||||
<index>7</index>
|
||||
</attribute>
|
||||
</program>
|
||||
<uniform>
|
||||
<name>NoiseTex</name>
|
||||
|
@ -122,11 +153,26 @@
|
|||
<type>sampler-1d</type>
|
||||
<value type="int">3</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>NormalTex</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">5</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>depth_factor</name>
|
||||
<type>float</type>
|
||||
<value><use>depth-factor</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
<value><use>snow-level</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>quality_level</name>
|
||||
<type>float</type>
|
||||
<value><use>quality-level</use></value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
178
Effects/glacier.eff
Normal file
178
Effects/glacier.eff
Normal file
|
@ -0,0 +1,178 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PropertyList>
|
||||
<name>Effects/glacier</name>
|
||||
<inherits-from>Effects/terrain-default</inherits-from>
|
||||
<parameters>
|
||||
<texture n="2">
|
||||
<image>Textures/Terrain/rock.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>
|
||||
<texture n="5">
|
||||
<image>Textures.high/Terrain/forest-relief.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>
|
||||
<depth-factor type="float">0.01</depth-factor>
|
||||
<canopy-height type="float">15.0</canopy-height>
|
||||
<quality-level><use>/sim/rendering/quality-level</use></quality-level>
|
||||
</parameters>
|
||||
<generate>
|
||||
<tangent type="int">6</tangent>
|
||||
<binormal type="int">7</binormal>
|
||||
</generate>
|
||||
<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>
|
||||
<texture-unit>
|
||||
<unit>5</unit>
|
||||
<image><use>texture[5]/image</use></image>
|
||||
<filter><use>texture[5]/filter</use></filter>
|
||||
<wrap-s><use>texture[5]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[5]/wrap-t</use></wrap-t>
|
||||
<internal-format>
|
||||
<use>texture[5]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/forest.frag</fragment-shader>
|
||||
<attribute>
|
||||
<name>tangent</name>
|
||||
<index>6</index>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<name>binormal</name>
|
||||
<index>7</index>
|
||||
</attribute>
|
||||
</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>NormalTex</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">5</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>depth_factor</name>
|
||||
<type>float</type>
|
||||
<value><use>depth-factor</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
<value><use>snow-level</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>quality_level</name>
|
||||
<type>float</type>
|
||||
<value><use>quality-level</use></value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
178
Effects/herbtundra.eff
Normal file
178
Effects/herbtundra.eff
Normal file
|
@ -0,0 +1,178 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PropertyList>
|
||||
<name>Effects/herbtundra</name>
|
||||
<inherits-from>Effects/terrain-default</inherits-from>
|
||||
<parameters>
|
||||
<texture n="2">
|
||||
<image>Textures/Terrain/rock.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/herbtundra-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>
|
||||
<texture n="5">
|
||||
<image>Textures.high/Terrain/forest-relief.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>
|
||||
<depth-factor type="float">0.01</depth-factor>
|
||||
<canopy-height type="float">15.0</canopy-height>
|
||||
<quality-level><use>/sim/rendering/quality-level</use></quality-level>
|
||||
</parameters>
|
||||
<generate>
|
||||
<tangent type="int">6</tangent>
|
||||
<binormal type="int">7</binormal>
|
||||
</generate>
|
||||
<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>
|
||||
<texture-unit>
|
||||
<unit>5</unit>
|
||||
<image><use>texture[5]/image</use></image>
|
||||
<filter><use>texture[5]/filter</use></filter>
|
||||
<wrap-s><use>texture[5]/wrap-s</use></wrap-s>
|
||||
<wrap-t><use>texture[5]/wrap-t</use></wrap-t>
|
||||
<internal-format>
|
||||
<use>texture[5]/internal-format</use>
|
||||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/forest.frag</fragment-shader>
|
||||
<attribute>
|
||||
<name>tangent</name>
|
||||
<index>6</index>
|
||||
</attribute>
|
||||
<attribute>
|
||||
<name>binormal</name>
|
||||
<index>7</index>
|
||||
</attribute>
|
||||
</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>NormalTex</name>
|
||||
<type>sampler-2d</type>
|
||||
<value type="int">5</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>depth_factor</name>
|
||||
<type>float</type>
|
||||
<value><use>depth-factor</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
<value><use>snow-level</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>quality_level</name>
|
||||
<type>float</type>
|
||||
<value><use>quality-level</use></value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
|
@ -2,23 +2,90 @@
|
|||
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VTangent;
|
||||
varying vec3 VBinormal;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 Normal;
|
||||
varying float bump;
|
||||
|
||||
uniform sampler3D NoiseTex;
|
||||
uniform sampler2D SampleTex;
|
||||
uniform sampler1D ColorsTex;
|
||||
uniform sampler2D SampleTex2;
|
||||
uniform sampler2D NormalTex;
|
||||
uniform float depth_factor;
|
||||
|
||||
uniform float quality_level; // From /sim/rendering/quality-level
|
||||
uniform float snowlevel; // From /sim/rendering/snow-level-m
|
||||
|
||||
const float scale = 1.0;
|
||||
int linear_search_steps = 10;
|
||||
|
||||
float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
|
||||
{
|
||||
|
||||
float size = 1.0 / float(linear_search_steps);
|
||||
float depth = 0.0;
|
||||
float best_depth = 1.0;
|
||||
|
||||
for(int i = 0; i < linear_search_steps - 1; ++i)
|
||||
{
|
||||
depth += size;
|
||||
float t = texture2D(reliefMap, dp + ds * depth).a;
|
||||
if(best_depth > 0.996)
|
||||
if(depth >= t)
|
||||
best_depth = depth;
|
||||
}
|
||||
depth = best_depth;
|
||||
|
||||
const int binary_search_steps = 5;
|
||||
|
||||
for(int i = 0; i < binary_search_steps; ++i)
|
||||
{
|
||||
size *= 0.5;
|
||||
float t = texture2D(reliefMap, dp + ds * depth).a;
|
||||
if(depth >= t)
|
||||
{
|
||||
best_depth = depth;
|
||||
depth -= 2.0 * size;
|
||||
}
|
||||
depth += size;
|
||||
}
|
||||
|
||||
return(best_depth);
|
||||
}
|
||||
|
||||
|
||||
void main (void)
|
||||
{
|
||||
|
||||
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144);
|
||||
if ( quality_level >= 3.5 ) {
|
||||
linear_search_steps = 20;
|
||||
}
|
||||
vec2 uv, dp, ds;
|
||||
vec3 N;
|
||||
float d;
|
||||
if ( bump > 0.9 && quality_level >= 2.0 )
|
||||
{
|
||||
vec3 V = normalize(ecPosition.xyz);
|
||||
float a = dot(VNormal, -V);
|
||||
vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal));
|
||||
s *= depth_factor / a;
|
||||
ds = s;
|
||||
dp = gl_TexCoord[0].st;
|
||||
d = ray_intersect(NormalTex, dp, ds);
|
||||
|
||||
uv = dp + ds * d;
|
||||
N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
uv = gl_TexCoord[0].st;
|
||||
N = vec3(0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000344);
|
||||
vec4 basecolor2 = texture2D(SampleTex2, rawpos.xy*0.000144);
|
||||
|
||||
basecolor = texture1D(ColorsTex, basecolor.r+0.0);
|
||||
|
@ -27,13 +94,15 @@ void main (void)
|
|||
|
||||
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
|
||||
|
||||
float vegetationlevel = (rawpos.z)+nvL[2]*3000.0;
|
||||
|
||||
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;
|
||||
float n=0.02;
|
||||
n += nvL[0]*0.4;
|
||||
n += nvL[1]*0.6;
|
||||
n += nvL[2]*2.0;
|
||||
|
@ -51,29 +120,63 @@ void main (void)
|
|||
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;
|
||||
vec4 c3, c4, c5, c3a, c4a, c5a;
|
||||
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));
|
||||
c4a = mix(vec4(n-0.76, n-0.66, -n, 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);
|
||||
|
||||
//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));
|
||||
if (vegetationlevel <= 2200) {
|
||||
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));
|
||||
}
|
||||
|
||||
else {
|
||||
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.1));
|
||||
if (vegetationlevel > 2200 && vegetationlevel < 2300) {
|
||||
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));
|
||||
}
|
||||
|
||||
//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));
|
||||
if (vegetationlevel >= 2300 && vegetationlevel < 2480) {
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
if (vegetationlevel >= 2480 && vegetationlevel < 2530) {
|
||||
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 && vegetationlevel < 2670) {
|
||||
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) {
|
||||
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) {
|
||||
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));
|
||||
c4 = 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]*0.9));
|
||||
c5 = mix(c3, c4, 1.0);
|
||||
c1 = mix(c1, c5, clamp(0.65, n*0.5, 0.6));
|
||||
diffuse = gl_Color.rgb * max(0.8, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
|
||||
}
|
||||
|
||||
//should come as varying!
|
||||
vec4 constantColor = vec4(1.0, 1.0, 1.0, 0.0);
|
||||
|
||||
vec4 ambient_light = gl_LightSource[0].diffuse * constantColor * vec4(diffuse, 1.0);
|
||||
|
||||
c1 *= ambient_light;
|
||||
vec4 finalColor = c1;
|
||||
|
|
|
@ -1,19 +1,28 @@
|
|||
#version 120
|
||||
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
varying vec3 VTangent;
|
||||
varying vec3 VBinormal;
|
||||
varying vec3 Normal;
|
||||
varying vec4 constantColor;
|
||||
varying float bump;
|
||||
|
||||
attribute vec3 tangent;
|
||||
attribute vec3 binormal;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
|
||||
rawpos = gl_Vertex;
|
||||
ecPosition = gl_ModelViewMatrix * gl_Vertex;
|
||||
VNormal = normalize(gl_NormalMatrix * gl_Normal);
|
||||
ecPosition = gl_ModelViewMatrix * rawpos;
|
||||
Normal = normalize(gl_Normal);
|
||||
VNormal = gl_NormalMatrix * gl_Normal;
|
||||
VTangent = gl_NormalMatrix * tangent;
|
||||
VBinormal = gl_NormalMatrix * binormal;
|
||||
bump = 1.0;
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
constantColor = gl_FrontMaterial.emission
|
||||
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 690 KiB |
BIN
Textures/Terrain/rock-colors.png
Normal file
BIN
Textures/Terrain/rock-colors.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 515 B |
Binary file not shown.
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 852 KiB |
|
@ -720,7 +720,7 @@ Shared parameters for various materials.
|
|||
<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>
|
||||
<tree-width-m>18.0</tree-width-m>
|
||||
<rolling-friction>1</rolling-friction>
|
||||
<bumpiness>1</bumpiness>
|
||||
</material>
|
||||
|
@ -1200,7 +1200,7 @@ Shared parameters for various materials.
|
|||
</equals>
|
||||
</condition>
|
||||
<name>HerbTundraCover</name>
|
||||
<effect>Effects/landmass-nowood</effect>
|
||||
<effect>Effects/herbtundra</effect>
|
||||
<texture>Terrain/herbtundra.png</texture>
|
||||
<texture>Terrain/herbtundra2.png</texture>
|
||||
<texture>Terrain/herbtundra3.png</texture>
|
||||
|
@ -2383,6 +2383,7 @@ Shared parameters for various materials.
|
|||
<material>
|
||||
<name>Glacier</name>
|
||||
<name>PolarIce</name>
|
||||
<effect>Effects/glacier</effect>
|
||||
<texture>Terrain/glacier1.png</texture>
|
||||
<texture>Terrain/glacier2.png</texture>
|
||||
<texture>Terrain/glacier3.png</texture>
|
||||
|
|
Loading…
Reference in a new issue