hell ball
This commit is contained in:
1 parent
b92fb0fa4d
commit
3051b216b4
5 files changed
+91
-17
No files matched your search
@@ -179,6 +179,7 @@ namespace CalamityMod.Effects
|
||||
#region Aqua's Shaders
|
||||
internal static Effect CircularGradientWithEdge;
|
||||
internal static Effect WavyOpacity;
|
||||
internal static Effect HellBall;
|
||||
#endregion
|
||||
|
||||
//
|
||||
@@ -397,6 +398,8 @@ namespace CalamityMod.Effects
|
||||
RegisterMiscShader(CircularGradientWithEdge, "CircularGradientWithEdgePass", "CircularGradientWithEdge");
|
||||
WavyOpacity = LoadShader("WavyOpacity");
|
||||
RegisterMiscShader(WavyOpacity, "WavyOpacityPass", "WavyOpacity");
|
||||
HellBall = LoadShader("HellBall");
|
||||
RegisterScreenShader(HellBall, "HellBallPass", "HellBall");
|
||||
#endregion
|
||||
|
||||
#region Loading Amber's Shaders
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
float time;
|
||||
float blowUpPower; //The power the blow up effect is set as. Ideally betwen 0 and 1
|
||||
float blowUpSize; //The strenght of the expansion caused by the blow up effect
|
||||
float3 shieldColor;
|
||||
float shieldOpacity;
|
||||
float3 shieldEdgeColor;
|
||||
float shieldEdgeBlendStrenght;
|
||||
float noiseScale;
|
||||
float resolution;
|
||||
|
||||
texture sampleTexture;
|
||||
sampler2D Texture1Sampler = sampler_state { texture = <sampleTexture>; magfilter = LINEAR; minfilter = LINEAR; mipfilter = LINEAR; AddressU = wrap; AddressV = wrap; };
|
||||
|
||||
float4 main(float2 uv : TEXCOORD) : COLOR
|
||||
{
|
||||
//Pixelate?
|
||||
//uv.x -= uv.x % (1 / resolution);
|
||||
//uv.y -= uv.y % (1 / resolution);
|
||||
|
||||
//Crop in a circle
|
||||
float distanceFromCenter = length(uv - float2(0.5, 0.5)) * 2;
|
||||
if (distanceFromCenter > 1)
|
||||
return float4(0, 0, 0, 0);
|
||||
|
||||
//"Blow up" the noise map so it looks circular.
|
||||
float blownUpUVX = pow((abs(uv.x - 0.5)) * 2, blowUpPower);
|
||||
float blownUpUVY = pow((abs(uv.y - 0.5)) * 2, blowUpPower);
|
||||
float2 blownUpUV = float2(-blownUpUVY * blowUpSize * 0.5 + uv.x * (1 + blownUpUVY * blowUpSize), -blownUpUVX * blowUpSize * 0.5 + uv.y * (1 + blownUpUVX * blowUpSize));
|
||||
|
||||
//Rescale
|
||||
blownUpUV *= noiseScale;
|
||||
//Scroll effect
|
||||
blownUpUV.y = (blownUpUV.y + time) % 1;
|
||||
|
||||
//Get the noise color
|
||||
float4 noiseColor = tex2D(Texture1Sampler, blownUpUV);
|
||||
|
||||
//Apply a layers of fake fresnel
|
||||
noiseColor += pow(distanceFromCenter, 6); // + pow(distanceFromCenter, 3) * 0.6; <- Brings us over into ps 3.0 territory if we have pixelation on.
|
||||
//Fade the edges
|
||||
if (distanceFromCenter > 0.95)
|
||||
noiseColor *= (1 - ((distanceFromCenter - 0.95) / 0.05));
|
||||
|
||||
return noiseColor * float4(lerp(shieldColor, shieldEdgeColor, pow(distanceFromCenter, shieldEdgeBlendStrenght)), shieldOpacity);
|
||||
}
|
||||
|
||||
technique Technique1
|
||||
{
|
||||
pass HellBallPass
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.CalPlayer;
|
||||
@@ -12,6 +13,8 @@ using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Graphics.Effects;
|
||||
using Terraria.GameContent;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
@@ -20,10 +23,9 @@ namespace CalamityMod.Projectiles.Boss
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterSpawn");
|
||||
public static readonly SoundStyle DroneSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneMonsterDrone");
|
||||
|
||||
public Texture2D screamTex;
|
||||
private float speedAdd = 0f;
|
||||
private float speedLimit = 0f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.Calamity().DealsDefenseDamage = true;
|
||||
@@ -37,6 +39,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
Projectile.timeLeft = 36000;
|
||||
Projectile.Opacity = 0f;
|
||||
CooldownSlot = ImmunityCooldownID.Bosses;
|
||||
screamTex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/ScreamyFace").Value;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
@@ -166,22 +169,37 @@ namespace CalamityMod.Projectiles.Boss
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
lightColor.R = (byte)(255 * Projectile.Opacity);
|
||||
Main.spriteBatch.End();
|
||||
Effect shieldEffect = Filters.Scene["CalamityMod:HellBall"].GetShader().Shader;
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, shieldEffect, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
if (CalamityGlobalNPC.SCal != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.SCal].active)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.SCal].ModNPC<SupremeCalamitas>().cirrus)
|
||||
{
|
||||
tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Boss/BrimstoneMonsterII").Value;
|
||||
lightColor.B = (byte)(255 * Projectile.Opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
float noiseScale = 0.6f;
|
||||
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
|
||||
// Define shader parameters
|
||||
|
||||
shieldEffect.Parameters["time"].SetValue(Projectile.timeLeft / 60f * 0.24f);
|
||||
shieldEffect.Parameters["blowUpPower"].SetValue(3.2f);
|
||||
shieldEffect.Parameters["blowUpSize"].SetValue(0.4f);
|
||||
shieldEffect.Parameters["noiseScale"].SetValue(noiseScale);
|
||||
|
||||
float opacity = Projectile.Opacity;
|
||||
shieldEffect.Parameters["shieldOpacity"].SetValue(opacity);
|
||||
shieldEffect.Parameters["shieldEdgeBlendStrenght"].SetValue(4f);
|
||||
|
||||
Color edgeColor = Color.Black * opacity;
|
||||
Color shieldColor = Color.Red * opacity;
|
||||
|
||||
// Define shader parameters for ball color
|
||||
shieldEffect.Parameters["shieldColor"].SetValue(shieldColor.ToVector3());
|
||||
shieldEffect.Parameters["shieldEdgeColor"].SetValue(edgeColor.ToVector3());
|
||||
|
||||
Vector2 pos = Projectile.Center - Main.screenPosition;
|
||||
|
||||
float scale = 0.715f;
|
||||
Main.spriteBatch.Draw(screamTex, pos, null, Color.White, 0, screamTex.Size() * 0.5f, scale * Projectile.scale, 0, 0);
|
||||
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user