Files
CalamityModPublic/Effects/Dyes/CeaselessDyeShader.fx
T

37 lines
1.1 KiB
HLSL

sampler uImage0 : register(s0);
sampler uImage1 : register(s1);
float3 uColor;
float3 uSecondaryColor;
float uOpacity;
float uSaturation;
float uRotation;
float uTime;
float4 uSourceRect;
float2 uWorldPosition;
float uDirection;
float3 uLightSource;
float2 uImageSize0;
float2 uImageSize1;
float randomness(float2 uv)
{
float noise = (frac(sin(dot(uv, float2(12.9898, 78.233) * 2.0)) * 43758.5453));
return noise;
}
float4 PixelShaderFunction(float4 sampleColor : TEXCOORD, float2 coords : TEXCOORD0) : COLOR0
{
float frameY = (coords.y * uImageSize0.y - uSourceRect.y) / uSourceRect.w; // Gets a 0-1 representation of the y position on a given frame, with 0 being the top, and 1 being the bottom.
coords.x += randomness(uTime + frameY).x * 0.09 * (1 - frameY); // Add an X offset based on a noise function, giving a moon lord void-esque shader effect.
float4 color = tex2D(uImage0, coords);
float4 returnColor = color * 0.1;
returnColor.a = color.a;
return returnColor;
}
technique Technique1
{
pass DyePass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}