Shader fixes for Delta Touch.

This commit is contained in:
Marisa the Magician 2023-11-29 19:36:38 +01:00
commit df55aa4cc7
8 changed files with 40 additions and 40 deletions

View file

@ -5,11 +5,11 @@ vec4 ProcessLight( vec4 color )
if ( gs.x > .5 ) return color; if ( gs.x > .5 ) return color;
if ( gs.y > .5 ) 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); return vec4(min(color.rgb+vec3(glow),1.),color.a);
} }
float glow = 0.25+0.2*sin(timer*8); float glow = .25+.2*sin(timer*8.);
return vec4(min(color.rgb+vec3(glow),1.0),color.a); return vec4(min(color.rgb+vec3(glow),1.),color.a);
} }
vec4 ProcessTexel() vec4 ProcessTexel()
@ -18,7 +18,7 @@ vec4 ProcessTexel()
if ( gs.x > .5 ) getTexel(vTexCoord.st); if ( gs.x > .5 ) getTexel(vTexCoord.st);
if ( gs.y > .5 ) 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); vec4 col = getTexel(vTexCoord.st);
return vec4(min(col.rgb+vec3(glow),1.),col.a); return vec4(min(col.rgb+vec3(glow),1.),col.a);
} }

View file

@ -4,14 +4,14 @@ vec4 ProcessLight( vec4 color )
{ {
float bright = texture(brighttex,vTexCoord.st).x; float bright = texture(brighttex,vTexCoord.st).x;
vec2 gs = texture(ambglow,vec2(.5)).xy; 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 ) 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); return vec4(min(color.rgb+vec3(bright)+vec3(glow),1.),color.a);
} }
float glow = 0.25+0.2*sin(timer*8); float glow = .25+.2*sin(timer*8.);
return vec4(min(color.rgb+vec3(bright)+vec3(glow),1.0),color.a); return vec4(min(color.rgb+vec3(bright)+vec3(glow),1.),color.a);
} }
vec4 ProcessTexel() vec4 ProcessTexel()
@ -20,7 +20,7 @@ vec4 ProcessTexel()
if ( gs.x > .5 ) getTexel(vTexCoord.st); if ( gs.x > .5 ) getTexel(vTexCoord.st);
if ( gs.y > .5 ) 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); vec4 col = getTexel(vTexCoord.st);
return vec4(min(col.rgb+vec3(glow),1.),col.a); return vec4(min(col.rgb+vec3(glow),1.),col.a);
} }

View file

@ -1,6 +1,6 @@
void SetupMaterial( inout Material mat ) 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.Normal = ApplyNormalMap(vTexCoord.st);
mat.Bright = vec4(1.); mat.Bright = vec4(1.);
} }

View file

@ -1,17 +1,17 @@
vec4 ProcessLight( vec4 color ) vec4 ProcessLight( vec4 color )
{ {
return vec4(1.0); return vec4(1.);
} }
vec4 ProcessTexel() vec4 ProcessTexel()
{ {
vec2 coord = vTexCoord.st; vec2 coord = vTexCoord.st;
vec2 dist = 2.0*texture(warptex,vTexCoord.st).xy-1.0; vec2 dist = 2.*texture(warptex,vTexCoord.st).xy-1.;
dist.y *= abs(mod(dist.x+timer*3.34536,4)-2)-1; dist.y *= abs(mod(dist.x+timer*3.34536,4.)-2.)-1.;
coord.y += dist.y*0.12; coord.y += dist.y*.12;
dist = 2.0*texture(warptex,vTexCoord.st*2.0).xy-1.0; dist = 2.*texture(warptex,vTexCoord.st*2.0).xy-1.;
dist.y *= abs(mod(dist.x+timer*5.45363,4)-2)-1; dist.y *= abs(mod(dist.x+timer*5.45363,4.)-2.)-1.;
coord.y -= dist.y*0.09; coord.y -= dist.y*.09;
coord.y = clamp(coord.y,0.0,1.0); coord.y = clamp(coord.y,0.,1.);
return getTexel(coord); return getTexel(coord);
} }

View file

@ -1,18 +1,18 @@
vec4 ProcessLight( vec4 color ) vec4 ProcessLight( vec4 color )
{ {
return vec4(1.0); return vec4(1.);
} }
vec4 ProcessTexel() vec4 ProcessTexel()
{ {
vec2 coord = vTexCoord.st; vec2 coord = vTexCoord.st;
vec2 dist = 2.0*texture(warptex,vTexCoord.st*0.6).xy-1.0; vec2 dist = 2.*texture(warptex,vTexCoord.st*.6).xy-1.;
dist.x *= abs(mod(dist.y+timer*1.34536,4)-2)-1; dist.x *= abs(mod(dist.y+timer*1.34536,4.)-2.)-1.;
coord.x += dist.x*0.12; coord.x += dist.x*.12;
dist = 2.0*texture(warptex,vTexCoord.st*1.2).xy-1.0; dist = 2.*texture(warptex,vTexCoord.st*1.2).xy-1.;
dist.y *= abs(mod(dist.x+timer*1.45363,4)-2)-1; dist.y *= abs(mod(dist.x+timer*1.45363,4.)-2.)-1.;
coord.y -= dist.y*0.09; coord.y -= dist.y*.09;
coord.x += timer*0.05346; coord.x += timer*.05346;
coord.y += timer*0.03425; coord.y += timer*.03425;
return getTexel(coord); return getTexel(coord);
} }

View file

@ -3,5 +3,5 @@ vec4 ProcessTexel()
{ {
vec3 eyedir = normalize(uCameraPos.xyz-pixelpos.xyz); vec3 eyedir = normalize(uCameraPos.xyz-pixelpos.xyz);
vec3 norm = reflect(eyedir,normalize(vWorldNormal.xyz)); vec3 norm = reflect(eyedir,normalize(vWorldNormal.xyz));
return getTexel(norm.xz*0.5+0.5); return getTexel(norm.xz*.5+.5);
} }

View file

@ -5,11 +5,11 @@ vec4 ProcessLight( vec4 color )
if ( gs.x > .5 ) return color; if ( gs.x > .5 ) return color;
if ( gs.y > .5 ) 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); return vec4(min(color.rgb+vec3(glow),1.),color.a);
} }
float glow = 0.25+0.2*sin(timer*8); float glow = .25+.2*sin(timer*8.);
return vec4(min(color.rgb+vec3(glow),1.0),color.a); 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 // 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 eyedir = normalize(uCameraPos.xyz-pixelpos.xyz);
vec3 norm = reflect(eyedir,normalize(vWorldNormal.xyz)); vec3 norm = reflect(eyedir,normalize(vWorldNormal.xyz));
vec2 gs = texture(ambglow,vec2(.5)).xy; 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 ) 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); vec4 col = getTexel(norm.xz*.5+.5);
return vec4(min(col.rgb+vec3(glow),1.),col.a); return vec4(min(col.rgb+vec3(glow),1.),col.a);
} }
return getTexel(norm.xz*0.5+0.5); return getTexel(norm.xz*.5+.5);
} }

View file

@ -3,22 +3,22 @@ void main()
vec4 tinted = texture(InputTexture,TexCoord); vec4 tinted = texture(InputTexture,TexCoord);
vec2 nc; vec2 nc;
vec2 sz = textureSize(InputTexture,0); vec2 sz = textureSize(InputTexture,0);
vec2 px = 1.0/vec2(1920.0); vec2 px = 1./vec2(1920.);
px.y *= sz.x/sz.y; px.y *= sz.x/sz.y;
for ( int j=-1; j<=1; j++ ) for ( int i=-1; i<=1; i++ ) for ( int j=-1; j<=1; j++ ) for ( int i=-1; i<=1; i++ )
{ {
nc = TexCoord+px*vec2(i,j); nc = TexCoord+px*vec2(i,j);
tinted += texture(InputTexture,nc); tinted += texture(InputTexture,nc);
} }
tinted /= 10.0; tinted /= 10.;
vec2 coord = TexCoord; vec2 coord = TexCoord;
coord *= 4.0; coord *= 4.;
coord.y *= px.x/px.y; coord.y *= px.x/px.y;
vec2 tc; vec2 tc;
tc.x = coord.x*cos(Timer)-coord.y*sin(Timer); tc.x = coord.x*cos(Timer)-coord.y*sin(Timer);
tc.y = coord.x*sin(Timer)+coord.y*cos(Timer); tc.y = coord.x*sin(Timer)+coord.y*cos(Timer);
tinted = mix(tinted,texture(StaticTexture,tc),0.1); tinted = mix(tinted,texture(StaticTexture,tc),.1);
tinted = pow(tinted,vec4(0.7,1.1,1.3,1.0)); tinted = pow(tinted,vec4(.7,1.1,1.3,1.));
tinted *= vec4(1.2,0.6,0.5,1.0); tinted *= vec4(1.2,.6,.5,1.);
FragColor = tinted; FragColor = tinted;
} }