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>
@ -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

@ -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>

View file

@ -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>

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,6 +100,7 @@ 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);
if (normalmap_dds > 0)
fdist = -fdist; //dds fix
fdist *= sca;
@ -123,7 +125,7 @@ void main(void)
nmap1 *= windEffect_low;
// mix water and noise, modulated by factor
vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness);
if (normalmap_dds > 0)
vNorm = -vNorm; //dds fix
//load reflection
@ -168,6 +170,7 @@ void main(void)
vec3 N = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness);
if (normalmap_dds > 0)
N = -N; //dds fix
// specular

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,6 +280,8 @@ void main(void)
// mix water and noise, modulated by factor
vec4 vNorm = normalize(mix(nmap, nmap1, mixFactor) * waveRoughness);
vNorm.r += ddxSum;
if (normalmap_dds > 0)
vNorm = -vNorm; //dds fix
//load reflection
@ -328,6 +331,8 @@ void main(void)
N0.g += ddySum;
Normal = normalize(mix(Normal + N0, Normal + N1, mixFactor) * waveRoughness);
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