Bloodflare Dye

This commit is contained in:
Dominic authored and Cameron Ewell committed 2021-07-25 18:20:38 -04:00
1 parent 3adfe4a6cd
commit f3834cebfb
5 files changed
+81

No files matched your search

+44
View File
@@ -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();
}
}
Binary file not shown.
Binary file not shown.
+37
View File
@@ -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<Effect>(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<Bloodstone>(), 3);
recipe.AddTile(TileID.DyeVat);
recipe.SetResult(this, 2);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B