Some shader touchups (textureLod where needed, -0.5 LOD bias on TexFilterHack).
This commit is contained in:
parent
bd55e2ad57
commit
1fb1e51ba8
4 changed files with 16 additions and 15 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1185 \cu(jue 20 feb 2025 16:01:59 CET)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r1185 \cu(2025-02-20 16:01:59)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1186 \cu(lun 24 feb 2025 13:57:06 CET)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r1186 \cu(2025-02-24 13:57:06)\c-";
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ vec3 GradientMap( in vec3 color )
|
|||
{
|
||||
float gray = dot(color,vec3(.333333));
|
||||
vec2 pos = vec2(gray/2.+.25,0.);
|
||||
return texture(gradtex,pos,0.).rgb;
|
||||
return textureLod(gradtex,pos,0.).rgb;
|
||||
}
|
||||
|
||||
void SetupMaterial( inout Material mat )
|
||||
|
|
@ -51,27 +51,27 @@ void SetupMaterial( inout Material mat )
|
|||
// base blank layer
|
||||
vec4 base = vec4(1.);
|
||||
// first layer, warp then multiply red
|
||||
base.rgb *= texture(Layer1,warpcoord(uv)).x;
|
||||
base.rgb *= texture(Layer1,warpcoord(uv),-.5).x;
|
||||
// first layer, multiply green
|
||||
base.rgb *= texture(Layer1,uv).y;
|
||||
base.rgb *= texture(Layer1,uv,-.5).y;
|
||||
// first layer, add blue
|
||||
base.rgb += texture(Layer1,uv).zzz;
|
||||
base.rgb += texture(Layer1,uv,-.5).zzz;
|
||||
// multiply by red fade
|
||||
base.rgb *= texture(fadetex,vec2(.5)).x;
|
||||
base.rgb *= textureLod(fadetex,vec2(.5),0.).x;
|
||||
// gradient map result
|
||||
base.rgb = GradientMap(base.rgb);
|
||||
// color to alpha
|
||||
base = blacktoalpha(base);
|
||||
// second layer, alpha blend
|
||||
vec4 tmp = texture(Layer2,uv);
|
||||
vec4 tmp = texture(Layer2,uv,-.5);
|
||||
vec4 tmp2;
|
||||
tmp2.a = tmp.a+base.a*(1.-tmp.a);
|
||||
tmp2.rgb = (tmp.rgb*tmp.a+base.rgb*base.a*(1.-tmp.a))/tmp2.a;
|
||||
base = tmp2;
|
||||
// third layer, hard light with two multiplied masks
|
||||
tmp.xy = texture(Layer3,uv).xy;
|
||||
tmp.z = texture(fadetex,vec2(.5)).y;
|
||||
tmp.y *= texture(Layer3,clamp(uv+vec2(1.-tmp.z*2.,0.),vec2(0.),vec2(1.))).z;
|
||||
tmp.xy = texture(Layer3,uv,-.5).xy;
|
||||
tmp.z = textureLod(fadetex,vec2(.5),0.).y;
|
||||
tmp.y *= texture(Layer3,clamp(uv+vec2(1.-tmp.z*2.,0.),vec2(0.),vec2(1.)),-.5).z;
|
||||
tmp2.r = hardlight(base.r,tmp.x);
|
||||
tmp2.g = hardlight(base.g,tmp.x);
|
||||
tmp2.b = hardlight(base.b,tmp.x);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void SetupMaterial( inout Material mat )
|
|||
mat.Normal = ApplyNormalMap(vTexCoord.st);
|
||||
mat.Bright = texture(brighttexture,vTexCoord.st);
|
||||
// status canvas tex (only need two channels)
|
||||
vec2 fade = texture(fadetex,vec2(.5)).rg;
|
||||
vec2 fade = textureLod(fadetex,vec2(.5),0.).rg;
|
||||
// red: battery connection led
|
||||
vec3 bat = texture(battex,vTexCoord.st).rgb*fade.r;
|
||||
mat.Base.rgb += bat;
|
||||
|
|
@ -39,7 +39,7 @@ void SetupMaterial( inout Material mat )
|
|||
// green: charge glow
|
||||
float chg = texture(chgtex,vTexCoord.st).x*fade.g;
|
||||
// TODO noise
|
||||
vec3 grad = texture(gradtex,vec2(.25+chg*.5,.5)).rgb;
|
||||
vec3 grad = textureLod(gradtex,vec2(.25+chg*.5,.5),0.).rgb;
|
||||
mat.Base.rgb += grad;
|
||||
mat.Bright.rgb += vec3(chg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// VKDoom's quirked up when it comes to texture filtering in custom materials
|
||||
// so this shader is needed as a compromise
|
||||
// (the negative LOD bias is needed for sharpness when used in 2D drawing)
|
||||
|
||||
void SetupMaterial( inout Material mat )
|
||||
{
|
||||
|
|
@ -14,9 +15,9 @@ void SetupMaterial( inout Material mat )
|
|||
float threshold = 0.; // this controls sharpness, kinda
|
||||
coeff = (coeff-threshold)*1./(1.-2.*threshold);
|
||||
coeff = clamp(coeff,0.,1.);
|
||||
mat.Base = textureLod(retex,pos+pxsize*(coeff-fcoord),0.);
|
||||
mat.Base = texture(retex,pos+pxsize*(coeff-fcoord),-.5);
|
||||
#else
|
||||
mat.Base = textureLod(retex,vTexCoord.st,0.);
|
||||
mat.Base = texture(retex,vTexCoord.st,-.5);
|
||||
#endif
|
||||
mat.Normal = ApplyNormalMap(vTexCoord.st);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue