Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/assets/shaders/GLSL/postProcessing.glsl

Diff revisions: vs.
  @@ -22,9 +22,9 @@
22 22
23 23 uniform bool enable_underwater;
24 24
25 - uniform float noise_tile;
26 - uniform float noise_factor;
27 - uniform float time;
25 + uniform float _noiseTile;
26 + uniform float _noiseFactor;
27 + uniform float dvd_time;
28 28
29 29 #if defined(POSTFX_ENABLE_BLOOM)
30 30 uniform sampler2D texBloom;
  @@ -41,18 +41,18 @@
41 41 #if defined(POSTFX_ENABLE_DOF)
42 42 #endif
43 43
44 - uniform bool enable_vignette;
45 - uniform bool enable_noise;
44 + uniform bool enable_vignette;
45 + uniform bool enable_noise;
46 46 uniform float randomCoeffNoise;
47 47 uniform float randomCoeffFlash;
48 48
49 49 const vec3 luminance = vec3 (0.299, 0.587, 0.114);
50 50
51 51 #if defined(POSTFX_ENABLE_SSAO)
52 - vec4 SSAO(vec4 color){
52 + vec4 SSAO(in vec4 color){
53 53 float ssaoFilter = texture(texSSAO, _texCoord).r;
54 54 if(ssaoFilter > 0){
55 - //color.rgb = color.rgb * ssaoFilter;
55 + color.rgb = color.rgb * ssaoFilter;
56 56 }
57 57 return color;
58 58 }
  @@ -80,7 +80,7 @@
80 80 return vec4(colorIn.r * luminance.x, colorIn.g * luminance.y,colorIn.b * luminance.z,colorIn.a);
81 81 }
82 82
83 - vec4 NoiseEffect(vec4 colorIn)
83 + vec4 NoiseEffect(in vec4 colorIn)
84 84 {
85 85 vec4 colorOut = LevelOfGrey(colorIn);
86 86 vec4 colorNoise = texture(texBruit, _texCoord + vec2(randomCoeffNoise,randomCoeffNoise));
  @@ -89,9 +89,8 @@
89 89 return colorOut;
90 90 }
91 91
92 - vec4 VignetteEffect(vec4 colorIn)
92 + vec4 VignetteEffect(in vec4 colorIn)
93 93 {
94 -
95 94 vec4 ColorVignette = texture(texVignette, _texCoord);
96 95
97 96 vec4 colorOut = colorIn - (vec4(1,1,1,2)-ColorVignette);
  @@ -105,22 +104,20 @@
105 104 {
106 105 vec4 colorOut;
107 106
108 - float time2 = time*0.0001;
109 - vec2 uvNormal0 = _texCoord*noise_tile;
110 - uvNormal0.s += time2;
111 - uvNormal0.t += time2;
112 - vec2 uvNormal1 = _texCoord*noise_tile;
107 + float time2 = dvd_time*0.0001;
108 + vec2 noiseUV = _texCoord*_noiseTile;
109 + vec2 uvNormal0 = noiseUV + time2;
110 + vec2 uvNormal1 = noiseUV;
113 111 uvNormal1.s -= time2;
114 - uvNormal1.t += time2;
112 + uvNormal1.t = uvNormal0.t;
115 113
116 114 vec3 normal0 = texture(texWaterNoiseNM, uvNormal0).rgb * 2.0 - 1.0;
117 - // vec3 normal1 = texture(texWaterNoiseNM, uvNormal1).rgb * 2.0 - 1.0;
118 - // vec3 normal = normalize(normal0+normal1);
119 -
115 + vec3 normal1 = texture(texWaterNoiseNM, uvNormal1).rgb * 2.0 - 1.0;
116 + vec3 normal = normalize(normal0+normal1);
120 117
121 - colorOut = texture(texScreen, _texCoord + noise_factor*normal0.st);
122 -
123 - colorOut = clamp(colorOut, vec4(0.0, 0.0, 0.0, 0.0), vec4(1.0, 1.0, 1.0, 1.0));
118 + colorOut = clamp(texture(texScreen, _texCoord + _noiseFactor*normal0.st),
119 + vec4(0.0, 0.0, 0.0, 0.0),
120 + vec4(1.0, 1.0, 1.0, 1.0));
124 121
125 122 return colorOut;
126 123 }
  @@ -130,10 +127,9 @@
130 127
131 128 _colorOut = texture(texScreen, _texCoord);
132 129
133 - if(enable_underwater){
130 + if(enable_underwater)
134 131 _colorOut = UnderWater();
135 - }
136 -
132 +
137 133 #if defined(POSTFX_ENABLE_SSAO)
138 134 _colorOut = SSAO(_colorOut);
139 135 #endif
  @@ -142,11 +138,9 @@
142 138 _colorOut = Bloom(_colorOut);
143 139 #endif
144 140
145 - if(enable_noise){
141 + if(enable_noise)
146 142 _colorOut = NoiseEffect(_colorOut);
147 - }
148 143
149 - if(enable_vignette){
144 + if(enable_vignette)
150 145 _colorOut = VignetteEffect(_colorOut);
151 - }
152 146 }