1
0
Fork 0

Bugfix for lower quality water shader in Atmospheric Light Scattering

This commit is contained in:
Thorsten Renk 2013-02-04 14:52:14 +02:00
parent 235c21985e
commit 4426b4a301
2 changed files with 16 additions and 13 deletions

View file

@ -513,7 +513,8 @@
</technique> </technique>
<technique n="2">
<technique n="2">
<predicate> <predicate>
<and> <and>
<property>/sim/rendering/shaders/skydome</property> <property>/sim/rendering/shaders/skydome</property>
@ -843,7 +844,7 @@
<use>eye_alt</use> <use>eye_alt</use>
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>cloud_self_shading</name> <name>cloud_self_shading</name>
<type>float</type> <type>float</type>
<value><use>cloud_self_shading</use></value> <value><use>cloud_self_shading</use></value>
@ -873,6 +874,9 @@
<!-- END fog include --> <!-- END fog include -->
</pass> </pass>
</technique> </technique>
<technique n="6"> <technique n="6">
<predicate> <predicate>

View file

@ -129,10 +129,10 @@ void sumWaves(float angle, float dangle, float windScale, float factor, out floa
ddx = deriv * wave0.dir.x; ddx = deriv * wave0.dir.x;
ddy = deriv * wave0.dir.y; ddy = deriv * wave0.dir.y;
P.y += evaluateWave(wave1, P.xz, osg_SimulationTime); //P.y += evaluateWave(wave1, P.xz, osg_SimulationTime);
deriv = evaluateWaveDeriv(wave1, P.xz, osg_SimulationTime); //deriv = evaluateWaveDeriv(wave1, P.xz, osg_SimulationTime);
ddx += deriv * wave1.dir.x; //ddx += deriv * wave1.dir.x;
ddy += deriv * wave1.dir.y; //ddy += deriv * wave1.dir.y;
P.y += evaluateWaveSharp(wave2, P.xz, osg_SimulationTime, WaveSharp); P.y += evaluateWaveSharp(wave2, P.xz, osg_SimulationTime, WaveSharp);
deriv = evaluateWaveDerivSharp(wave2, P.xz, osg_SimulationTime, WaveSharp); deriv = evaluateWaveDerivSharp(wave2, P.xz, osg_SimulationTime, WaveSharp);
@ -272,10 +272,9 @@ void main(void)
sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1); sumWaves(WaveAngle, 1.5, windScale, WaveFactor, ddx1, ddy1);
//reset the waves //reset the waves
/*
angle = 0.0; angle = 0.0;
float waveamp = WaveAmp * 0.75; float waveamp = WaveAmp * 0.75;
wave0.freq = WaveFreq ; wave0.freq = WaveFreq ;
wave0.amp = waveamp; wave0.amp = waveamp;
wave0.dir = vec2 (0.0, 1.0); //vec2(cos(radians(angle)), sin(radians(angle))); wave0.dir = vec2 (0.0, 1.0); //vec2(cos(radians(angle)), sin(radians(angle)));
@ -296,11 +295,11 @@ void main(void)
wave3.dir = vec2(0.866025, -0.5); //vec2(cos(radians(angle)), sin(radians(angle))); wave3.dir = vec2(0.866025, -0.5); //vec2(cos(radians(angle)), sin(radians(angle)));
ddx2 = 0.0, ddy2 = 0.0; ddx2 = 0.0, ddy2 = 0.0;
sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2); //sumWaves(WaveAngle + WaveDAngle, -1.5, windScale, WaveFactor, ddx2, ddy2);
ddx3 = 0.0, ddy3 = 0.0; ddx3 = 0.0, ddy3 = 0.0;
sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3); //sumWaves(WaveAngle + WaveDAngle, 1.5, windScale, WaveFactor, ddx3, ddy3);
*/
} }
// end sine stuff // end sine stuff
@ -318,8 +317,8 @@ void main(void)
vec4 nmap = texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; vec4 nmap = texture2D(water_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0;
vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0; vec4 nmap1 = texture2D(perlin_normalmap, vec2(waterTex1 + disdis * sca2) * windScale) * 2.0 - 1.0;
//rotationmatrix(radians(3.0 * sin(osg_SimulationTime * 0.0075)), RotationMatrix); rotationmatrix(radians(3.0 * sin(osg_SimulationTime * 0.0075)), RotationMatrix);
//nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0; nmap += texture2D(water_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0;
//nmap1 += texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0; //nmap1 += texture2D(perlin_normalmap, vec2(waterTex2 * RotationMatrix * tscale) * windScale) * 2.0 - 1.0;
nmap *= windEffect_low; nmap *= windEffect_low;