From eb98e109fab751bab139bbfefbf44527b43f0b8e Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Sun, 6 Mar 2022 07:32:24 +0100 Subject: [PATCH] Added an AoE visual on Ares' gauss nuke --- Effects/CalamityShaders.cs | 3 ++ Effects/CircularAoETelegraph.fx | 57 ++++++++++++++++++++ Effects/CircularAoETelegraph.xnb | Bin 0 -> 3404 bytes Projectiles/Boss/AresGaussNukeProjectile.cs | 16 ++++++ 4 files changed, 76 insertions(+) create mode 100644 Effects/CircularAoETelegraph.fx create mode 100644 Effects/CircularAoETelegraph.xnb diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index e244ab9f98..6b1c44e2da 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Effects public static Effect BasicTintShader; public static Effect DoGDisintegrationShader; public static Effect ArtAttackTrailShader; + public static Effect CircularAoETelegraph; public static Effect BaseFusableParticleEdgeShader; public static Effect AdditiveFusableParticleEdgeShader; @@ -57,6 +58,7 @@ namespace CalamityMod.Effects BasicTintShader = CalamityMod.Instance.GetEffect("Effects/BasicTint"); DoGDisintegrationShader = CalamityMod.Instance.GetEffect("Effects/DoGDisintegration"); ArtAttackTrailShader = CalamityMod.Instance.GetEffect("Effects/ArtAttackTrail"); + CircularAoETelegraph = CalamityMod.Instance.GetEffect("Effects/CircularAoETelegraph"); BaseFusableParticleEdgeShader = CalamityMod.Instance.GetEffect("Effects/ParticleFusion/BaseFusableParticleEdgeShader"); AdditiveFusableParticleEdgeShader = CalamityMod.Instance.GetEffect("Effects/ParticleFusion/AdditiveFusableParticleEdgeShader"); @@ -85,6 +87,7 @@ namespace CalamityMod.Effects GameShaders.Misc["CalamityMod:BasicTint"] = new MiscShaderData(new Ref(BasicTintShader), "TintPass"); GameShaders.Misc["CalamityMod:DoGDisintegration"] = new MiscShaderData(new Ref(DoGDisintegrationShader), "DisintegrationPass"); GameShaders.Misc["CalamityMod:ArtAttack"] = new MiscShaderData(new Ref(ArtAttackTrailShader), "TrailPass"); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"] = new MiscShaderData(new Ref(CircularAoETelegraph), "TelegraphPass"); GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"] = new MiscShaderData(new Ref(BaseFusableParticleEdgeShader), "ParticlePass"); GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"] = new MiscShaderData(new Ref(AdditiveFusableParticleEdgeShader), "ParticlePass"); diff --git a/Effects/CircularAoETelegraph.fx b/Effects/CircularAoETelegraph.fx new file mode 100644 index 0000000000..fe5cddcf51 --- /dev/null +++ b/Effects/CircularAoETelegraph.fx @@ -0,0 +1,57 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; //Color of the telegraph zone +float3 uSecondaryColor; //Color of the outline +float uOpacity; +float uSaturation; //Saturation is being used as completion here. 0 = Telegraph start, 1 = Telegraph about to end +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; + + +float4 Recolor(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + float3 color = uColor; + //this is the center of the sprite, coords work from 0 - 1 + float2 center = float2(0.5, 0.5); + //get the length of the doubled distance, so that 0 = at the center of the sprite and 1 = at the very edge of the circle + float distanceFromCenter = length(coords - center) * 2; + + //Crop the sprite into a circle + if (distanceFromCenter > 1) + return float4(0, 0, 0, 0); + + //Make the brightness increase towards the edge + float opacity = 0.1 + (0.2 + 0.35 * pow(uSaturation, 2)) * distanceFromCenter; + + //Brighten the very edge + if (distanceFromCenter > 0.995) + { + //Make the color get closer to the outline color. At halfway completion the transition is complete (so proud of them) + color = lerp(color, uSecondaryColor, min(uSaturation * 2, 1)); + + //Do the same for the opacity + opacity = lerp(opacity, 1, pow(uSaturation, 2)) * lerp(uOpacity, 1, min(uSaturation * 1.25, min(uOpacity + 0.1, 1))); + } + + else + opacity = opacity * uOpacity; + + color = color * opacity; + + return float4(color, opacity); +} + + +technique Technique1 +{ + pass TelegraphPass + { + PixelShader = compile ps_2_0 Recolor(); + } +} \ No newline at end of file diff --git a/Effects/CircularAoETelegraph.xnb b/Effects/CircularAoETelegraph.xnb new file mode 100644 index 0000000000000000000000000000000000000000..8b1186f3edc37cc42dabd72ddc17bd4ab4bee5de GIT binary patch literal 3404 zcmc&$O=x3P6h1HgNye$uD*nL~%yNVh+Sp15rnF8v)ne3|q#8shne?>@ljhZz_n1~h zB8s>WL}ow~7a5qv&~A#jP$)PHHv=QOk}h0!S+JnsMiRg8zIR{mgvlTxc#@lU&Ub$9 zIp_Z56<@h{b->C#EMk3Ty<9E3PQzLAQpI{HwcwUE?5mD@C6#gNo?Z7+m)6$ovX`?< ztF}9q>}CCeTiUEt%Z;(*>$cmdI`x^!)Hpw5$&6p~eAk|-+rH;Y~#;2y96_RyxNaUx}$NM8n41TOro%Ua`fPV;&evHvTjD8c~ z{KbvZx;-x1W-ihO%!$o}^Z~LkJi|s~1|)F^e#WUeu0%e!41@dmFn2$1m!0}*$=wc| zX-E1sc&J~_&p|qc;lH|BDp$R2g4%va8$fT`qfMBjgbtTHv^}!F(8HcR@pFzBSYKPw z@oPQo2WelZZrJkCpSs4IhAr2?5FrH=Wc-%z;jj7}fzcbY!)RTp!x{M$OmdBa{~^wosTFMhVVUh(oON%{P1H5cQ)Yxs8O zsOnPtD_?yFdrZgP`^P>LDtFe(-kEd;Lcy-t>pVnqshO1=8FZ%>HOhB?xg zQ}X!~hNg31E@%PIEJnqUo8Z4PbS6#TRyXTettc?%@=v#W1UXBGa;G6^A|@U zeo7@Ux>5!uKgQ2IMob1&kJ-DoFlq`LRM=LCg?GWOg&hzKDDFeiS>D~< ztfW`QCAw3S=W@>^U(DvS$$W*^Z8GC*Y*uSv&ZpAPrOr>KQ|al+NojXJu$FR{@>Z<4 z(C#coHT{OL#JDF^O_n6NozTrLhA;xu#7(VQ43xn7mMoi@>vL9l16~?TCJBxPz zMeXLD)!mowJF~mT-qyeA*%?{NGd6-(zsoM#*IJ!`DbJN4#Tn11Y)nXlPDJzuXJ7{}~GQ2WUlqrYB@?i`@% zS(}*yW3oTTpkWaI7R7UUO~og0i@#Qe-f zFfU`#pZUckjyVpM9&b}hACt4qemSe=vY=