From df55aa4cc7d3ba01508fffcb9cda66b0a6399f86 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Wed, 29 Nov 2023 19:36:38 +0100 Subject: [PATCH] Shader fixes for Delta Touch. --- shaders/glsl/AmbientGlow.fp | 8 ++++---- shaders/glsl/AmbientGlow_Brightmapped.fp | 10 +++++----- shaders/glsl/AmmoLed.fp | 2 +- shaders/glsl/FizzDistortX.fp | 16 ++++++++-------- shaders/glsl/FizzDistortXY.fp | 18 +++++++++--------- shaders/glsl/MeshEnviroMap.fp | 2 +- shaders/glsl/MeshEnviroMap_AmbientGlow.fp | 12 ++++++------ shaders/glsl/RedeemerView.fp | 12 ++++++------ 8 files changed, 40 insertions(+), 40 deletions(-) diff --git a/shaders/glsl/AmbientGlow.fp b/shaders/glsl/AmbientGlow.fp index b89ee37..31d6020 100644 --- a/shaders/glsl/AmbientGlow.fp +++ b/shaders/glsl/AmbientGlow.fp @@ -5,11 +5,11 @@ vec4 ProcessLight( vec4 color ) if ( gs.x > .5 ) return color; if ( gs.y > .5 ) { - float glow = max(0.,sin(timer*4)-.5); + float glow = max(0.,sin(timer*4.)-.5); return vec4(min(color.rgb+vec3(glow),1.),color.a); } - float glow = 0.25+0.2*sin(timer*8); - return vec4(min(color.rgb+vec3(glow),1.0),color.a); + float glow = .25+.2*sin(timer*8.); + return vec4(min(color.rgb+vec3(glow),1.),color.a); } vec4 ProcessTexel() @@ -18,7 +18,7 @@ vec4 ProcessTexel() if ( gs.x > .5 ) getTexel(vTexCoord.st); if ( gs.y > .5 ) { - float glow = max(0.,sin(timer*4)-.5); + float glow = max(0.,sin(timer*4.)-.5); vec4 col = getTexel(vTexCoord.st); return vec4(min(col.rgb+vec3(glow),1.),col.a); } diff --git a/shaders/glsl/AmbientGlow_Brightmapped.fp b/shaders/glsl/AmbientGlow_Brightmapped.fp index 79d9330..b9759a8 100644 --- a/shaders/glsl/AmbientGlow_Brightmapped.fp +++ b/shaders/glsl/AmbientGlow_Brightmapped.fp @@ -4,14 +4,14 @@ vec4 ProcessLight( vec4 color ) { float bright = texture(brighttex,vTexCoord.st).x; vec2 gs = texture(ambglow,vec2(.5)).xy; - if ( gs.x > .5 ) return vec4(min(color.rgb+vec3(bright),1.0),color.a); + if ( gs.x > .5 ) return vec4(min(color.rgb+vec3(bright),1.),color.a); if ( gs.y > .5 ) { - float glow = max(0.,sin(timer*4)-.5); + float glow = max(0.,sin(timer*4.)-.5); return vec4(min(color.rgb+vec3(bright)+vec3(glow),1.),color.a); } - float glow = 0.25+0.2*sin(timer*8); - return vec4(min(color.rgb+vec3(bright)+vec3(glow),1.0),color.a); + float glow = .25+.2*sin(timer*8.); + return vec4(min(color.rgb+vec3(bright)+vec3(glow),1.),color.a); } vec4 ProcessTexel() @@ -20,7 +20,7 @@ vec4 ProcessTexel() if ( gs.x > .5 ) getTexel(vTexCoord.st); if ( gs.y > .5 ) { - float glow = max(0.,sin(timer*4)-.5); + float glow = max(0.,sin(timer*4.)-.5); vec4 col = getTexel(vTexCoord.st); return vec4(min(col.rgb+vec3(glow),1.),col.a); } diff --git a/shaders/glsl/AmmoLed.fp b/shaders/glsl/AmmoLed.fp index 3e089f1..b87cde4 100644 --- a/shaders/glsl/AmmoLed.fp +++ b/shaders/glsl/AmmoLed.fp @@ -1,6 +1,6 @@ void SetupMaterial( inout Material mat ) { - mat.Base = texture(scrtex,vec2(vTexCoord.s,1.-vTexCoord.t)); + mat.Base = vec4(texture(scrtex,vec2(vTexCoord.s,1.-vTexCoord.t)).rgb,1.); mat.Normal = ApplyNormalMap(vTexCoord.st); mat.Bright = vec4(1.); } diff --git a/shaders/glsl/FizzDistortX.fp b/shaders/glsl/FizzDistortX.fp index 2cf77af..3ea0108 100644 --- a/shaders/glsl/FizzDistortX.fp +++ b/shaders/glsl/FizzDistortX.fp @@ -1,17 +1,17 @@ vec4 ProcessLight( vec4 color ) { - return vec4(1.0); + return vec4(1.); } vec4 ProcessTexel() { vec2 coord = vTexCoord.st; - vec2 dist = 2.0*texture(warptex,vTexCoord.st).xy-1.0; - dist.y *= abs(mod(dist.x+timer*3.34536,4)-2)-1; - coord.y += dist.y*0.12; - dist = 2.0*texture(warptex,vTexCoord.st*2.0).xy-1.0; - dist.y *= abs(mod(dist.x+timer*5.45363,4)-2)-1; - coord.y -= dist.y*0.09; - coord.y = clamp(coord.y,0.0,1.0); + vec2 dist = 2.*texture(warptex,vTexCoord.st).xy-1.; + dist.y *= abs(mod(dist.x+timer*3.34536,4.)-2.)-1.; + coord.y += dist.y*.12; + dist = 2.*texture(warptex,vTexCoord.st*2.0).xy-1.; + dist.y *= abs(mod(dist.x+timer*5.45363,4.)-2.)-1.; + coord.y -= dist.y*.09; + coord.y = clamp(coord.y,0.,1.); return getTexel(coord); } diff --git a/shaders/glsl/FizzDistortXY.fp b/shaders/glsl/FizzDistortXY.fp index 8ecc683..73fe1df 100644 --- a/shaders/glsl/FizzDistortXY.fp +++ b/shaders/glsl/FizzDistortXY.fp @@ -1,18 +1,18 @@ vec4 ProcessLight( vec4 color ) { - return vec4(1.0); + return vec4(1.); } vec4 ProcessTexel() { vec2 coord = vTexCoord.st; - vec2 dist = 2.0*texture(warptex,vTexCoord.st*0.6).xy-1.0; - dist.x *= abs(mod(dist.y+timer*1.34536,4)-2)-1; - coord.x += dist.x*0.12; - dist = 2.0*texture(warptex,vTexCoord.st*1.2).xy-1.0; - dist.y *= abs(mod(dist.x+timer*1.45363,4)-2)-1; - coord.y -= dist.y*0.09; - coord.x += timer*0.05346; - coord.y += timer*0.03425; + vec2 dist = 2.*texture(warptex,vTexCoord.st*.6).xy-1.; + dist.x *= abs(mod(dist.y+timer*1.34536,4.)-2.)-1.; + coord.x += dist.x*.12; + dist = 2.*texture(warptex,vTexCoord.st*1.2).xy-1.; + dist.y *= abs(mod(dist.x+timer*1.45363,4.)-2.)-1.; + coord.y -= dist.y*.09; + coord.x += timer*.05346; + coord.y += timer*.03425; return getTexel(coord); } diff --git a/shaders/glsl/MeshEnviroMap.fp b/shaders/glsl/MeshEnviroMap.fp index 572c467..8f95332 100644 --- a/shaders/glsl/MeshEnviroMap.fp +++ b/shaders/glsl/MeshEnviroMap.fp @@ -3,5 +3,5 @@ vec4 ProcessTexel() { vec3 eyedir = normalize(uCameraPos.xyz-pixelpos.xyz); vec3 norm = reflect(eyedir,normalize(vWorldNormal.xyz)); - return getTexel(norm.xz*0.5+0.5); + return getTexel(norm.xz*.5+.5); } diff --git a/shaders/glsl/MeshEnviroMap_AmbientGlow.fp b/shaders/glsl/MeshEnviroMap_AmbientGlow.fp index fec7a79..5b5f39b 100644 --- a/shaders/glsl/MeshEnviroMap_AmbientGlow.fp +++ b/shaders/glsl/MeshEnviroMap_AmbientGlow.fp @@ -5,11 +5,11 @@ vec4 ProcessLight( vec4 color ) if ( gs.x > .5 ) return color; if ( gs.y > .5 ) { - float glow = max(0.,sin(timer*4)-.5); + float glow = max(0.,sin(timer*4.)-.5); return vec4(min(color.rgb+vec3(glow),1.),color.a); } - float glow = 0.25+0.2*sin(timer*8); - return vec4(min(color.rgb+vec3(glow),1.0),color.a); + float glow = .25+.2*sin(timer*8.); + return vec4(min(color.rgb+vec3(glow),1.),color.a); } // imitation of the Unreal Engine 1.x bMeshEnviroMap effect, not 1:1 but gets close @@ -18,12 +18,12 @@ vec4 ProcessTexel() vec3 eyedir = normalize(uCameraPos.xyz-pixelpos.xyz); vec3 norm = reflect(eyedir,normalize(vWorldNormal.xyz)); vec2 gs = texture(ambglow,vec2(.5)).xy; - if ( gs.x > .5 ) getTexel(norm.xz*0.5+0.5); + if ( gs.x > .5 ) getTexel(norm.xz*.5+.5); if ( gs.y > .5 ) { - float glow = max(0.,sin(timer*4)-.5); + float glow = max(0.,sin(timer*4.)-.5); vec4 col = getTexel(norm.xz*.5+.5); return vec4(min(col.rgb+vec3(glow),1.),col.a); } - return getTexel(norm.xz*0.5+0.5); + return getTexel(norm.xz*.5+.5); } diff --git a/shaders/glsl/RedeemerView.fp b/shaders/glsl/RedeemerView.fp index 78c0a10..7cfa363 100644 --- a/shaders/glsl/RedeemerView.fp +++ b/shaders/glsl/RedeemerView.fp @@ -3,22 +3,22 @@ void main() vec4 tinted = texture(InputTexture,TexCoord); vec2 nc; vec2 sz = textureSize(InputTexture,0); - vec2 px = 1.0/vec2(1920.0); + vec2 px = 1./vec2(1920.); px.y *= sz.x/sz.y; for ( int j=-1; j<=1; j++ ) for ( int i=-1; i<=1; i++ ) { nc = TexCoord+px*vec2(i,j); tinted += texture(InputTexture,nc); } - tinted /= 10.0; + tinted /= 10.; vec2 coord = TexCoord; - coord *= 4.0; + coord *= 4.; coord.y *= px.x/px.y; vec2 tc; tc.x = coord.x*cos(Timer)-coord.y*sin(Timer); tc.y = coord.x*sin(Timer)+coord.y*cos(Timer); - tinted = mix(tinted,texture(StaticTexture,tc),0.1); - tinted = pow(tinted,vec4(0.7,1.1,1.3,1.0)); - tinted *= vec4(1.2,0.6,0.5,1.0); + tinted = mix(tinted,texture(StaticTexture,tc),.1); + tinted = pow(tinted,vec4(.7,1.1,1.3,1.)); + tinted *= vec4(1.2,.6,.5,1.); FragColor = tinted; }