diff --git a/Effects/Dyes/BloodflareDyeShader.fx b/Effects/Dyes/BloodflareDyeShader.fx new file mode 100644 index 0000000000..8feb36ca88 --- /dev/null +++ b/Effects/Dyes/BloodflareDyeShader.fx @@ -0,0 +1,44 @@ +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; + +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. + float4 pixelBelow = tex2D(uImage0, coords); + float4 noiseColor = tex2D(uImage1, float2(coords.x, frac(frameY - uTime * 0.67)) * 0.5) * 1.5; + float verticalFlowMovement = (sin(coords.x * 14.71 + frameY * 13.5 - uTime * 5.6) * 0.5 + 0.5) * noiseColor.r; + if (pixelBelow.a == 0 && frameY < 0.96) + coords.y = saturate(coords.y + verticalFlowMovement / uSourceRect.w / 17); + float4 color = tex2D(uImage0, coords); + + // Prepare the dark outlines. + float outlineFade = pow(1 - (color.r + color.g + color.b) / 3, 2); + color = lerp(color, float4(uColor, 1), outlineFade) * color.a; + + // Prepare the bright in-lines. + color = lerp(color, float4(uSecondaryColor, 1), saturate(1 - outlineFade) * 0.8) * color.a; + + // Handle red fades based on noise. + color = lerp(color, float4(1, 0, 0, 1), pow(noiseColor.r, 3) * 0.3 + verticalFlowMovement * 0.3 + 0.16) * color.a; + + return color * (1 + (1 - outlineFade) * 0.25); +} +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/BloodflareDyeShader.xnb b/Effects/Dyes/BloodflareDyeShader.xnb new file mode 100644 index 0000000000..065af159a0 Binary files /dev/null and b/Effects/Dyes/BloodflareDyeShader.xnb differ diff --git a/Effects/Dyes/CosmicFlameShader.xnb b/Effects/Dyes/CosmicFlameShader.xnb index 0841b773cc..af374d73cd 100644 Binary files a/Effects/Dyes/CosmicFlameShader.xnb and b/Effects/Dyes/CosmicFlameShader.xnb differ diff --git a/Items/Dyes/BloodflareDye.cs b/Items/Dyes/BloodflareDye.cs new file mode 100644 index 0000000000..c48e0567da --- /dev/null +++ b/Items/Dyes/BloodflareDye.cs @@ -0,0 +1,37 @@ +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework; + +namespace CalamityMod.Items.Dyes +{ + public class BloodflareDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(new Ref(mod.GetEffect("Effects/Dyes/BloodflareDyeShader")), "DyePass"). + UseColor(new Color(122, 10, 60)).UseSecondaryColor(new Color(219, 102, 106)).UseImage("Images/Misc/Perlin"); + public override void SafeSetStaticDefaults() + { + DisplayName.SetDefault("Bloodflare Dye"); + } + + public override void SafeSetDefaults() + { + item.rare = ItemRarityID.Red; + item.Calamity().customRarity = CalamityRarity.PureGreen; + item.value = Item.sellPrice(0, 4, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.BottledWater, 2); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddTile(TileID.DyeVat); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + } + } +} \ No newline at end of file diff --git a/Items/Dyes/BloodflareDye.png b/Items/Dyes/BloodflareDye.png new file mode 100644 index 0000000000..aa7383fe1d Binary files /dev/null and b/Items/Dyes/BloodflareDye.png differ