Improved shader performance
(hopefully)
This commit is contained in:
parent
ef03e87306
commit
040dd5f3ba
3 changed files with 9 additions and 22 deletions
|
@ -13,8 +13,8 @@ void main(void) {
|
|||
uniform sampler2D tex;
|
||||
|
||||
void main(void) {
|
||||
vec4 clr = texture2D(tex, vec2(gl_TexCoord[0].xy));
|
||||
vec4 clr = texture2D(tex, gl_TexCoord[0].xy);
|
||||
gl_FragColor = vec4(0.1,0.0,0.07,1.0);
|
||||
gl_FragDepth = 0.5*gl_FragCoord.z/clr.a;
|
||||
gl_FragDepth = 0.5*gl_FragCoord.z/clr.a;
|
||||
|
||||
}
|
|
@ -13,25 +13,14 @@ void main(void) {
|
|||
uniform sampler2D tex;
|
||||
uniform float intensity;
|
||||
|
||||
float pi = 2.0 * asin(1.0);
|
||||
|
||||
void main(void) {
|
||||
vec2 pos = vec2(gl_TexCoord[0]);
|
||||
|
||||
float a;
|
||||
float i = 0.0;
|
||||
vec4 sum = vec4(0.0), c;
|
||||
vec4 sum = vec4(0.0);
|
||||
|
||||
for(a = 0.0; a <= 2.0*pi; a+=0.6) {
|
||||
c = texture2D(tex, pos + vec2(cos(a),sin(a))*0.01);
|
||||
if(c != vec4(0.0)) {
|
||||
sum += c;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for(int a = 0; a < 10; a++) {
|
||||
sum += texture2D(tex, pos + vec2(cos(0.628*float(a)),sin(0.628*float(a)))*0.03);;
|
||||
}
|
||||
|
||||
|
||||
gl_FragColor = texture2D(tex, pos) + intensity*sum*sum/i;
|
||||
|
||||
// gl_FragColor = texture2D(tex, pos);
|
||||
gl_FragColor = texture2D(tex, pos) + intensity*sum*sum/10.0;
|
||||
}
|
|
@ -24,14 +24,12 @@ void main(void) {
|
|||
vec2 pos1 = pos;
|
||||
pos1.y *= ratio;
|
||||
|
||||
if(length(pos1) < blur_rad)
|
||||
pos *= length(pos1)/blur_rad;
|
||||
pos *= min(length(pos1)/blur_rad,1.0);
|
||||
|
||||
gl_FragColor = texture2D(tex, pos + blur_orig);
|
||||
|
||||
pos1 = vec2(gl_TexCoord[0]) - fix_orig;
|
||||
pos1.y *= ratio;
|
||||
|
||||
if(length(pos1) < rad)
|
||||
gl_FragColor *= pow(vec4(0.1,0.2,0.3,1),vec4(3.0*(rad - length(pos1))));
|
||||
gl_FragColor *= pow(vec4(0.1,0.2,0.3,1),vec4(3.0*max(0.0,rad - length(pos1))));
|
||||
}
|
Loading…
Reference in a new issue