Files
CalamityModPublic/Effects/BasicTextureDistortionShader.fx
T
fryzahh 1f204be4e0 Watery distortion effect for Sunken Sea's custom backgrounds
- Implemented a water distortion effect for the Sunken Sea's custom backgrounds. This effect only applies when the Waves Quality settings is turned off.
- Added a graphical config option for the effect.
2025-05-18 10:26:14 -04:00

27 lines
736 B
HLSL

sampler baseTexture : register(s0);
sampler distortionTexture : register(s1);
float time;
float distortionXSpeed;
float distortionYSpeed;
float distortionStrength;
float noiseScale;
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
{
float2 distortedCoords = coords + float2(time * distortionXSpeed, time * distortionYSpeed);
distortedCoords *= noiseScale;
float distortion = tex2D(distortionTexture, distortedCoords).r;
float4 returnColor = tex2D(baseTexture, coords + distortion * distortionStrength);
return returnColor * sampleColor.a;
}
technique Technique1
{
pass DistortionPass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}