Files
BABA_YAGA/Assets/Shaders/SukunaProjectile.shader

80 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

2026-03-26 20:40:28 +07:00
Shader "Sukuna/ProjectileSlash"
{
Properties
{
[Header(Colors)]
[HDR] _MainColor("Core Color", Color) = (0, 0, 0, 1)
[HDR] _EdgeColor("Edge Glow", Color) = (10, 0, 0, 1)
_EdgeWidth("Edge Width", Range(0, 1)) = 0.3
[Header(Movement)]
_FlowSpeed("Flow Speed", Float) = 2.0
_NoiseMap("Noise Map", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
Pass
{
ZWrite Off
Cull Off
Blend SrcAlpha One
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
};
float4 _MainColor;
float4 _EdgeColor;
float _EdgeWidth;
float _FlowSpeed;
sampler2D _NoiseMap;
float4 _NoiseMap_ST;
Varyings vert(Attributes input)
{
Varyings output;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
output.uv = input.uv;
return output;
}
half4 frag(Varyings input) : SV_Target
{
float x = input.uv.x;
float y = input.uv.y;
// Shape: Nhọn ở đầu (x=1), phình ở giữa
float shape = (1.0 - abs(y * 2.0 - 1.0)) * pow(x, 2.0);
// Hiệu ứng "cuộn" bên trong lưỡi đao
float2 noiseUV = input.uv * _NoiseMap_ST.xy + _NoiseMap_ST.zw;
noiseUV.x -= _Time.y * _FlowSpeed;
float noise = tex2D(_NoiseMap, noiseUV).r;
float4 finalColor = lerp(_MainColor, _EdgeColor, smoothstep(1.0 - _EdgeWidth, 1.0, shape * noise));
finalColor.a = shape;
return finalColor;
}
ENDHLSL
}
}
}