1
0
Fork 0

Make water efect use png textures by default, and rely on their dds counterparts only when using the dds materials file.

Signed-off-by: Emilian Huminiuc <emilianh@gmail.com>
This commit is contained in:
Emilian Huminiuc 2012-06-16 18:51:53 +03:00
parent 664c55c62a
commit 6ef4f5eca0
14 changed files with 230 additions and 174 deletions

50
Effects/water-dds.eff Normal file
View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/water-dds</name>
<inherits-from>Effects/water</inherits-from>
<parameters>
<texture n="0">
<image>Textures/Water/water-reflection.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="2">
<image>Textures/Water/waves-ver10-nm.dds</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/Water/water_sine_nmap.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="4">
<image>Textures/Water/water-reflection-grey.dds</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/Water/sea_foam.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="6">
<image>Textures/Water/perlin-noise-nm.dds</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<normalmap_dds type="float">1.0</normalmap_dds>
</parameters>
</PropertyList>

View file

@ -11,14 +11,14 @@
<internal-format>normalized</internal-format>
</texture>
<texture n="2">
<image>Textures/Water/waves-ver10-nm.dds</image>
<image>Textures/Water/waves-ver10-nm.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/Water/water_sine_nmap.dds</image>
<image>Textures/Water/water_sine_nmap.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
@ -32,19 +32,20 @@
<internal-format>normalized</internal-format>
</texture>
<texture n="5">
<image>Textures/Water/sea_foam.dds</image>
<image>Textures/Water/sea_foam.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="6">
<image>Textures/Water/perlin-noise-nm.dds</image>
<image>Textures/Water/perlin-noise-nm.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<normalmap_dds type="float">0.0</normalmap_dds>
<saturation>
<use>/rendering/scene/saturation</use>
</saturation>
@ -331,6 +332,14 @@
<type>sampler-2d</type>
<value type="int">6</value>
</uniform>
<!-- normalmap is .dds-->
<uniform>
<name>normalmap_dds</name>
<type>float</type>
<value>
<use>normalmap_dds</use>
</value>
</uniform>
<uniform>
<name>saturation</name>
<type>float</type>
@ -542,7 +551,7 @@
<use>render-bin/bin-name</use>
</bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<image>
@ -687,6 +696,14 @@
<type>sampler-2d</type>
<value type="int">6</value>
</uniform>
<!-- normalmap is .dds-->
<uniform>
<name>normalmap_dds</name>
<type>float</type>
<value>
<use>normalmap_dds</use>
</value>
</uniform>
<uniform>
<name>saturation</name>
<type>float</type>
@ -1044,6 +1061,14 @@
<type>sampler-2d</type>
<value type="int">6</value>
</uniform>
<!-- normalmap is .dds-->
<uniform>
<name>normalmap_dds</name>
<type>float</type>
<value>
<use>normalmap_dds</use>
</value>
</uniform>
<uniform>
<name>saturation</name>
<type>float</type>

View file

@ -400,111 +400,6 @@ Shared parameters for various materials.
<bumpiness>0.1</bumpiness>
</material>
<material n="2005">
<name>Ocean</name>
<effect>Effects/water</effect>
<texture>Terrain/water.png</texture>
<xsize>400</xsize>
<ysize>400</ysize>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Geometry/container_carrier.ac</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/ContainerShip.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/Freighter.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/LargeTrawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/SailBoatUnderSail.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/CruiseShip.xml</path>
<coverage-m2>5000000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/MPPShip.xml</path>
<coverage-m2>5000000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<ambient>
<r>0.0</r>
<g>0.0</g>
<b>0.0</b>
<a>1.0</a>
</ambient>
<diffuse>
<r>0.4</r>
<g>0.4</g>
<b>0.4</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.0</r>
<g>0.0</g>
<b>0.2</b>
<a>1.0</a>
</specular>
<shininess>0</shininess>
<solid>0</solid>
<rolling-friction>2</rolling-friction>
<bumpiness>0.8</bumpiness>
</material>
<material n="2006">
<name>BarrenCover</name>
<name>Dirt</name>

102
Materials/base/water.xml Normal file
View file

@ -0,0 +1,102 @@
<?xml version="1.0"?>
<!-- common water settings -->
<PropertyList>
<xsize>400</xsize>
<ysize>400</ysize>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Geometry/container_carrier.ac</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/ContainerShip.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
<object>
<path>Models/Maritime/Civilian/Trawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/Freighter.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/LargeTrawler.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/SailBoatUnderSail.xml</path>
<coverage-m2>500000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/CruiseShip.xml</path>
<coverage-m2>5000000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<object-group>
<range-m>40000</range-m>
<object>
<path>Models/Maritime/Civilian/MPPShip.xml</path>
<coverage-m2>5000000000</coverage-m2>
<heading-type>random</heading-type>
</object>
</object-group>
<ambient>
<r>0.0</r>
<g>0.0</g>
<b>0.0</b>
<a>1.0</a>
</ambient>
<diffuse>
<r>0.4</r>
<g>0.4</g>
<b>0.4</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.0</r>
<g>0.0</g>
<b>0.2</b>
<a>1.0</a>
</specular>
<shininess>0</shininess>
<solid>0</solid>
<rolling-friction>2</rolling-friction>
<bumpiness>0.8</bumpiness>
</PropertyList>

View file

@ -897,7 +897,7 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/urban-buildings.xml"/>
<object-group include="Materials/base/urban-buildings.xml"/>
<building-coverage>2500.0</building-coverage>
<building-small-ratio>0.4</building-small-ratio>
<building-small-min-floors>3</building-small-min-floors>
@ -943,7 +943,7 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/urban-buildings.xml"/>
<object-group include="Materials/base/urban-buildings.xml"/>
<building-coverage>2500.0</building-coverage>
<building-small-ratio>0.4</building-small-ratio>
<building-small-min-floors>3</building-small-min-floors>
@ -991,7 +991,7 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/industrial-buildings.xml"/>
<object-group include="Materials/base/industrial-buildings.xml"/>
</material>
<material>
@ -1004,7 +1004,7 @@
<name>Town</name>
<name>SubUrban</name>
<texture>Terrain/Town1.png</texture>
<object-mask>Terrain/Town1.mask.png</object-mask>
<object-mask>Terrain/Town1.mask.png</object-mask>
<xsize>1024</xsize>
<ysize>1024</ysize>
<light-coverage>100000.0</light-coverage>
@ -1028,40 +1028,10 @@
<tree-width-m>15.0</tree-width-m>
</material>
<material>
<condition>
<equals>
<property>sim/startup/season</property>
<value>summer</value>
</equals>
</condition>
<effect>Effects/water</effect>
<name>Lagoon</name>
<texture>Terrain/water-lake.png</texture>
<xsize>400</xsize>
<ysize>400</ysize>
<ambient>
<r>0.0</r>
<g>0.0</g>
<b>0.0</b>
<a>1.0</a>
</ambient>
<diffuse>
<r>0.5</r>
<g>0.5</g>
<b>0.5</b>
<a>1.0</a>
</diffuse>
<specular>
<r>0.3</r>
<g>0.3</g>
<b>0.3</b>
<a>1.0</a>
</specular>
<shininess>1.2</shininess>
<solid>0</solid>
<rolling-friction>1.5</rolling-friction>
<bumpiness>0.6</bumpiness>
<material include="Materials/base/water.xml">
<name>Ocean</name>
<effect>Effects/water-dds</effect>
<texture>Terrain/water.png</texture>
</material>
<material>
@ -1789,7 +1759,7 @@
<texture n="2">Terrain/city2-relief-light.png</texture>
</texture-set>
<object-mask>Terrain/city1.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<object-mask>Terrain/city1.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<xsize>1000</xsize>
@ -1801,7 +1771,7 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/urban-buildings.xml"/>
<object-group include="Materials/base/urban-buildings.xml"/>
<building-coverage>2500.0</building-coverage>
<building-small-ratio>0.4</building-small-ratio>
<building-small-min-floors>3</building-small-min-floors>
@ -1842,7 +1812,7 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/industrial-buildings.xml"/>
<object-group include="Materials/base/industrial-buildings.xml"/>
</material>
<material>
@ -1855,7 +1825,7 @@
<name>Town</name>
<name>SubUrban</name>
<texture>Terrain.winter/Town1.png</texture>
<object-mask>Terrain/Town1.mask.png</object-mask>
<object-mask>Terrain/Town1.mask.png</object-mask>
<xsize>1024</xsize>
<ysize>1024</ysize>
<light-coverage>100000.0</light-coverage>

View file

@ -75,7 +75,7 @@
<wrapu>false</wrapu>
<wrapv>false</wrapv>
</material>
<material include="Materials/base/runway_effect.xml">
<name>pa_stopway</name>
<texture>Runway/pa_stopway.png</texture>
@ -352,7 +352,7 @@
<wrapu>false</wrapu>
<wrapv>false</wrapv>
</material>
<material include="Materials/base/runway_effect.xml">
<name>pc_stopway</name>
<texture>Runway/pc_stopway.png</texture>
@ -859,7 +859,7 @@
<texture n="2">Terrain/city2-relief-light.png</texture>
</texture-set>
<object-mask>Terrain/city1.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<xsize>1000</xsize>
<ysize>1000</ysize>
<light-coverage>100000.0</light-coverage>
@ -869,7 +869,7 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/urban-buildings.xml"/>
<object-group include="Materials/base/urban-buildings.xml"/>
<building-coverage>2500.0</building-coverage>
<building-small-ratio>0.4</building-small-ratio>
<building-small-min-floors>3</building-small-min-floors>
@ -899,7 +899,7 @@
<texture>Terrain/city1.png</texture>
<texture>Terrain/city2.png</texture>
<object-mask>Terrain/city1.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<xsize>1000</xsize>
<ysize>1000</ysize>
<light-coverage>100000.0</light-coverage>
@ -909,9 +909,9 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/industrial-buildings.xml"/>
<object-group include="Materials/base/industrial-buildings.xml"/>
</material>
<material>
<condition>
<equals>
@ -922,7 +922,7 @@
<name>Town</name>
<name>SubUrban</name>
<texture>Terrain/Town1.png</texture>
<object-mask>Terrain/Town1.mask.png</object-mask>
<object-mask>Terrain/Town1.mask.png</object-mask>
<xsize>1024</xsize>
<ysize>1024</ysize>
<light-coverage>100000.0</light-coverage>
@ -946,6 +946,12 @@
<tree-width-m>15.0</tree-width-m>
</material>
<material include="Materials/base/water.xml">
<name>Ocean</name>
<effect>Effects/water</effect>
<texture>Terrain/water.png</texture>
</material>
<material>
<condition>
<equals>
@ -1297,7 +1303,7 @@
</condition>
<name>NaturalCrop</name>
<texture>Terrain/naturalcrop1.png</texture>
<object-mask>Terrain/naturalcrop1.mask.png</object-mask>
<object-mask>Terrain/naturalcrop1.mask.png</object-mask>
<xsize>2000</xsize>
<ysize>2000</ysize>
<solid>1</solid>
@ -1635,7 +1641,7 @@
<texture n="2">Terrain/city2-relief-light.png</texture>
</texture-set>
<object-mask>Terrain/city1.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<xsize>1000</xsize>
<ysize>1000</ysize>
<light-coverage>100000.0</light-coverage>
@ -1645,7 +1651,7 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/urban-buildings.xml"/>
<object-group include="Materials/base/urban-buildings.xml"/>
<building-coverage>2500.0</building-coverage>
<building-small-ratio>0.4</building-small-ratio>
<building-small-min-floors>3</building-small-min-floors>
@ -1675,7 +1681,7 @@
<texture>Terrain/city1.png</texture>
<texture>Terrain/city2.png</texture>
<object-mask>Terrain/city1.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<object-mask>Terrain/city2.mask.png</object-mask>
<xsize>1000</xsize>
<ysize>1000</ysize>
<light-coverage>100000.0</light-coverage>
@ -1685,9 +1691,9 @@
<b>0.02</b>
<a>1.0</a>
</emissive>
<object-group include="Materials/base/industrial-buildings.xml"/>
<object-group include="Materials/base/industrial-buildings.xml"/>
</material>
<material>
<condition>
<equals>
@ -1698,7 +1704,7 @@
<name>Town</name>
<name>SubUrban</name>
<texture>Terrain.winter/Town1.png</texture>
<object-mask>Terrain/Town1.mask.png</object-mask>
<object-mask>Terrain/Town1.mask.png</object-mask>
<xsize>1024</xsize>
<ysize>1024</ysize>
<light-coverage>100000.0</light-coverage>
@ -2265,7 +2271,7 @@
<a>1.0</a>
</emissive>
</material>
<material>
<name>UnidirectionalTaperRed</name>
<texture>Symbols/unidirectionalred.png</texture>

View file

@ -31,6 +31,7 @@ varying vec3 normal;
uniform float WaveFreq ;
uniform float WaveAmp ;
uniform float WaveSharp ;
uniform float normalmap_dds;
////fog "include" /////
uniform int fogType;
@ -99,7 +100,8 @@ void main(void)
vec4 dist = texture2D(water_dudvmap, vec2(waterTex1 + disdis*sca2)* windScale) * 2.0 - 1.0;
dist *= (0.6 + 0.5 * smoothstep(0.0, 15.0, windEffect));
vec4 fdist = normalize(dist);
fdist = -fdist; //dds fix
if (normalmap_dds > 0)
fdist = -fdist; //dds fix
fdist *= sca;
//normalmaps
@ -123,8 +125,8 @@ void main(void)
nmap1 *= windEffect_low;
// mix water and noise, modulated by factor
vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness);
vNorm = -vNorm; //dds fix
if (normalmap_dds > 0)
vNorm = -vNorm; //dds fix
//load reflection
vec4 tmp = vec4(lightdir, 0.0);
@ -168,7 +170,8 @@ void main(void)
vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness);
N = -N; //dds fix
if (normalmap_dds > 0)
N = -N; //dds fix
// specular
vec3 specular_color = vec3(gl_LightSource[0].diffuse)

View file

@ -37,6 +37,7 @@ uniform float WaveSharp ;
uniform float WaveAngle ;
uniform float WaveFactor ;
uniform float WaveDAngle ;
uniform float normalmap_dds;
////fog "include" /////
uniform int fogType;
@ -279,7 +280,9 @@ void main(void)
// mix water and noise, modulated by factor
vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness);
vNorm.r += ddxSum;
vNorm = -vNorm; //dds fix
if (normalmap_dds > 0)
vNorm = -vNorm; //dds fix
//load reflection
vec4 tmp = vec4(lightdir, 0.0);
@ -328,7 +331,9 @@ void main(void)
N0.g += ddySum;
Normal = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness);
Normal = -Normal; //dds fix
if (normalmap_dds > 0)
Normal = -Normal; //dds fix
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 KiB