Added new shaders
Some checks failed
CI / Native Windows Build And Tests (push) Has been cancelled
CI / React UI Build (push) Has been cancelled
CI / Windows Release Package (push) Has been cancelled

This commit is contained in:
2026-05-05 22:36:52 +10:00
parent 119e49aec1
commit ce5905373a
32 changed files with 882 additions and 78 deletions

View File

@@ -0,0 +1,49 @@
float4 balatroSwirl(float2 screenSize, float2 screenCoords, float time)
{
const float pi = 3.14159265359;
float safePixelFilter = max(pixelFilter, 1.0);
float safeScreenLength = max(length(screenSize), 1.0);
float pixelSize = safeScreenLength / safePixelFilter;
float2 uv = (floor(screenCoords * (1.0 / pixelSize)) * pixelSize - 0.5 * screenSize) / safeScreenLength - offset;
float uvLength = length(uv);
float speed = spinRotation * spinEase * 0.2;
if (isRotate)
speed = time * speed;
speed += 302.2;
float newPixelAngle = atan2(uv.y, uv.x) + speed - spinEase * 20.0 * (spinAmount * uvLength + (1.0 - spinAmount));
float2 mid = (screenSize / safeScreenLength) * 0.5;
uv = float2(uvLength * cos(newPixelAngle) + mid.x, uvLength * sin(newPixelAngle) + mid.y) - mid;
uv *= 30.0;
speed = time * spinSpeed;
float2 uv2 = float2(uv.x + uv.y, uv.x + uv.y);
for (int i = 0; i < 5; ++i)
{
uv2 += float2(sin(max(uv.x, uv.y)), sin(max(uv.x, uv.y))) + uv;
uv += 0.5 * float2(cos(5.1123314 + 0.353 * uv2.y + speed * 0.131121), sin(uv2.x - 0.113 * speed));
float warp = cos(uv.x + uv.y) - sin(uv.x * 0.711 - uv.y);
uv -= float2(warp, warp);
}
float contrastMod = 0.25 * contrast + 0.5 * spinAmount + 1.2;
float paintRes = min(2.0, max(0.0, length(uv) * 0.035 * contrastMod));
float c1p = max(0.0, 1.0 - contrastMod * abs(1.0 - paintRes));
float c2p = max(0.0, 1.0 - contrastMod * abs(paintRes));
float c3p = 1.0 - min(1.0, c1p + c2p);
float light = (lighting - 0.2) * max(c1p * 5.0 - 4.0, 0.0) + lighting * max(c2p * 5.0 - 4.0, 0.0);
float safeContrast = max(contrast, 0.001);
float4 base = (0.3 / safeContrast) * colour1;
float4 paint = colour1 * c1p + colour2 * c2p + float4(c3p * colour3.rgb, c3p * colour1.a);
return base + (1.0 - 0.3 / safeContrast) * paint + float4(light, light, light, light);
}
float4 shadeVideo(ShaderContext context)
{
float2 screenSize = max(context.outputResolution, float2(1.0, 1.0));
float4 swirl = balatroSwirl(screenSize, context.uv * screenSize, context.time);
return saturate(lerp(swirl, context.sourceColor, sourceMix));
}