Files
CalamityModPublic/Effects/DoGRealityCrackShader.fx
fryzahh c3ee433cd1 DoGSky touchups + misc fixes and changes
- Made some visual improvements to DoG's CustomSky, involving the creation of two new shaders, DoGRealityCrackShader and DoGRiftAuraShader
- - Descriptions for each can be found in CalamityShaders
- Ambient sky entities are now disabled while DoG's CustomSky is active
- The code for the distortion rift's lightning effect should now no longer run at all times and only when DoG's CustomSky is active
- DoG no longer has its death animation shader applied to all segments individually. Instead, all segments are now drawn to a render target, which is what the shader is then applied to via a new BaseRenderer class, DoGDeathAnimationRenderer. This was done to prevent all of DoG's sprites from suddenly rendering in full brightness during his death animation
- - Additionally, DoGDisintegration's code has been cleaned up
- Fixed DoG not spawning out of the correct teleport rift projectile on GFB due to not properly accommodating for fake rifts when searching for the correct teleport location
- Improved the visuals of DoGTeleportRift and decreased the visual intensity of fake rifts
- DoG's teleport rift indicator icon will no longer appear on GFB due to the inclusion of fake rifts as a mechanic on that seed. There are many differences between the real rift and fake rifts which should make up for this
2025-07-31 00:46:56 -04:00

55 lines
1.9 KiB
HLSL

sampler baseTexture : register(s0);
float overallOpacity;
float opacityCutoffValue;
float fadeoutPower;
float minBrightnessValue;
float gradientPrecision;
float3 brighterPixelColor;
float3 darkerPixelColor;
float InverseLerp(float from, float to, float value)
{
return (value - from) / (to - from);
}
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
{
// Convert the regular coordinates to polar coordinates to get a circle shape.
float2 centeredCoords = coords - 0.5;
float polarAngle = atan2(centeredCoords.y, centeredCoords.x) / 6.283;
float distanceToCenter = length(centeredCoords);
float2 polarCoords = float2(polarAngle, distanceToCenter);
float4 color = tex2D(baseTexture, coords);
// Get the horizontal brightness of the sampled texture and apply coloration.
float brightness = (color.r + color.g + color.b) / 3;
float brightnessRatio = InverseLerp(minBrightnessValue, 1, brightness);
float3 colorFromBrightness = lerp(darkerPixelColor, brighterPixelColor, brightnessRatio);
float4 coloredSample = color * float4(colorFromBrightness, 1);
// Fade out from the edges of the texture to the middle depending on the cutoff value.
// "fadeoutPower" values which vary from 1 will affect how strong the edges fade while also increasing the brightness of
// the non-faded parts of the image to the middle. Use this wisely.
if (-polarCoords.y < opacityCutoffValue)
coloredSample.rgba *= pow(-polarCoords.y / (polarCoords.y - opacityCutoffValue), -fadeoutPower);
// Apply optional posterization.
/*if (gradientPrecision > 0)
finalColor = round(finalColor * gradientPrecision) / gradientPrecision;
*/
return coloredSample * sampleColor * overallOpacity;
}
technique Technique1
{
pass DoGRealityCrackPass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}