This commit is contained in:
SoulliesOfficial
2026-03-21 12:12:12 -04:00
parent a1b831ecbf
commit 7d3e8c2d5b
159 changed files with 4096 additions and 14430 deletions

View File

@@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
using UnityEngine.Rendering;
namespace Echovoid.Runtime.Behavior.Rendering
@@ -71,6 +71,16 @@ namespace Echovoid.Runtime.Behavior.Rendering
// --- Pixelate ---
public static readonly int _PixelateStrengthX = Shader.PropertyToID("_PixelateStrengthX");
public static readonly int _PixelateStrengthY = Shader.PropertyToID("_PixelateStrengthY");
// --- Hyper Tunnel ---
public static readonly int _HyperTunnelColor = Shader.PropertyToID("_HyperTunnelColor");
public static readonly int _HyperTunnelParams = Shader.PropertyToID("_HyperTunnelParams");
public static readonly int _HyperTunnelCenter = Shader.PropertyToID("_HyperTunnelCenter");
// --- Space Pulse ---
public static readonly int _SpacePulseColor = Shader.PropertyToID("_SpacePulseColor");
public static readonly int _SpacePulseParams = Shader.PropertyToID("_SpacePulseParams");
public static readonly int _SpacePulseCenter = Shader.PropertyToID("_SpacePulseCenter");
}
}
}

View File

@@ -0,0 +1,127 @@
Shader "SLS/Postprocessing/HyperTunnel"
{
SubShader
{
Tags
{
"RenderType" = "Opaque"
"RenderPipeline" = "UniversalPipeline"
}
ZWrite Off Cull Off ZTest Always
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
float4 _HyperTunnelColor;
// x: speed, y: intensity, z: radial blur amount, w: CA intensity
float4 _HyperTunnelParams;
float2 _HyperTunnelCenter;
// --- Fast Mobile-friendly Simplex Noise ---
float3 mod2D289(float3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
float2 mod2D289(float2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
float3 permute(float3 x) { return mod2D289(((x * 34.0) + 1.0) * x); }
float snoise(float2 v)
{
const float4 C = float4(0.211324865, 0.366025403, -0.577350269, 0.024390243);
float2 i = floor(v + dot(v, C.yy));
float2 x0 = v - i + dot(i, C.xx);
float2 i1 = (x0.x > x0.y) ? float2(1.0, 0.0) : float2(0.0, 1.0);
float4 x12 = x0.xyxy + C.xxzz; x12.xy -= i1;
i = mod2D289(i);
float3 p = permute(permute(i.y + float3(0.0, i1.y, 1.0)) + i.x + float3(0.0, i1.x, 1.0));
float3 m = max(0.5 - float3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
m = m * m; m = m * m;
float3 x = 2.0 * frac(p * C.www) - 1.0;
float3 h = abs(x) - 0.5;
float3 ox = floor(x + 0.5);
float3 a0 = x - ox;
m *= 1.792842914 - 0.85373472 * (a0 * a0 + h * h);
float3 g;
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
return 130.0 * dot(m, g);
}
half4 Fragment(Varyings input) : SV_Target
{
float2 uv = input.texcoord;
// parameter unpacking setup
float speed = _HyperTunnelParams.x;
float lineIntensity = _HyperTunnelParams.y;
float blurAmount = _HyperTunnelParams.z;
float caIntensity = _HyperTunnelParams.w;
float2 center = _HyperTunnelCenter;
// distance vector from center
float2 dir = uv - center;
float dist = length(dir);
float2 normDir = dir / (dist + 0.0001); // avoid div zero
// Mask out the center (Tunnel illusion)
// No blur or lines in the exact center focus point
float centerMask = smoothstep(0.05, 0.4, dist);
// ===================================
// 1. Radial Blur + Chromatic Aberration
// ===================================
// Mobile Optimization: Interleaved 4 loop calculation
int samples = 4;
float intensityMultiplier = centerMask;
half3 finalColor = half3(0, 0, 0);
// Unroll loop for mobile shader registers
UNITY_UNROLL
for(int i = 0; i < 4; ++i)
{
float t = (float)i / (3.0);
float2 offsetBlur = dir * t * blurAmount * intensityMultiplier;
// CA offsets are tangent along the line
float2 uvR = uv - offsetBlur + normDir * caIntensity * intensityMultiplier * 0.005;
float2 uvG = uv - offsetBlur;
float2 uvB = uv - offsetBlur - normDir * caIntensity * intensityMultiplier * 0.005;
half r = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uvR).r;
half g = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uvG).g;
half b = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uvB).b;
finalColor += half3(r, g, b);
}
finalColor *= 0.25;
// ===================================
// 2. Hyper Speed Lines Overlay
// ===================================
// Convert to Polar coordinates
float angle = atan2(dir.y, dir.x);
float timeScaled = _Time.y * speed;
float2 noiseUV = float2(angle * 15.0, timeScaled + dist * 5.0);
float noiseVal = snoise(noiseUV) * 0.5 + 0.5; // [-1,1] to [0,1]
// Power curve for intense sharp lines
float lines = pow(noiseVal, 9.0) * lineIntensity;
lines *= centerMask;
half3 hcColor = _HyperTunnelColor.rgb * (_HyperTunnelColor.a * lines);
return half4(finalColor + hcColor, 1.0);
}
ENDHLSL
Pass
{
Name "Hyper Tunnel Pass"
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Fragment
ENDHLSL
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1c1785f44ec0db8468bb44679c8a79cf
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,101 @@
Shader "SLS/Postprocessing/SpacePulse"
{
SubShader
{
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" }
ZWrite Off Cull Off ZTest Always
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
float4 _SpacePulseColor;
// x: progress [0..1..1.5], y: thickness, z: distortion, w: CA
float4 _SpacePulseParams;
float2 _SpacePulseCenter;
half4 Fragment(Varyings input) : SV_Target
{
float2 uv = input.texcoord;
float progress = _SpacePulseParams.x;
float thickness = _SpacePulseParams.y;
float distStr = _SpacePulseParams.z;
float caStr = _SpacePulseParams.w;
float2 center = _SpacePulseCenter;
// Distance from center
float2 dir = uv - center;
// Correct the aspect ratio for circular rings rather than elliptical
// _ScreenParams.x / _ScreenParams.y giving the width scaling
float aspect = _ScreenParams.x / _ScreenParams.y;
float2 aspectDir = dir;
aspectDir.x *= aspect;
float dist = length(aspectDir);
float2 normDir = dir / (dist + 0.0001); // pure original direction for UV offsets
// -----------------------------------
// Pulse Profiling (Bell Curve / Wave)
// -----------------------------------
// How far is this pixel from the current growing radius 'progress'?
float waveDist = abs(dist - progress);
// waveMask = 1.0 at peak, 0.0 at 'thickness' distance from peak
float waveMask = 1.0 - smoothstep(0.0, thickness, waveDist);
// -----------------------------------
// Refraction / Space Fold Distortion
// -----------------------------------
// To make it look like a shockwave pushing the camera pixels,
// we calculate the derivative (slope) of the wave curve.
// Pixels inside the wave push outward, pixels outside pull inward.
float distortDir = (dist - progress) / thickness;
// Scale by the magnitude and custom parameter
float distortionMask = waveMask * distortDir * distStr;
float caMask = waveMask * caStr;
// Final warped UV
float2 offsetUV = uv + normDir * distortionMask;
// -----------------------------------
// Chromatic Aberration 3-Tap
// -----------------------------------
float2 uvR = offsetUV + normDir * caMask;
float2 uvG = offsetUV;
float2 uvB = offsetUV - normDir * caMask;
half r = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uvR).r;
half g = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uvG).g;
half b = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uvB).b;
half3 sceneColor = half3(r, g, b);
// -----------------------------------
// Emissive Glowing Overdrive
// -----------------------------------
// Fade logic to prevent abrupt pop-in near 0, and smoothly die off-screen
float spawnFade = smoothstep(0.0, 0.1, progress);
float deathFade = 1.0 - smoothstep(1.0, 1.5, progress);
// Using a sharper mask (pow) for the light core, so it glows brightest at exact center of the wave
float lightCore = pow(waveMask, 3.0);
half3 emission = _SpacePulseColor.rgb * _SpacePulseColor.a * lightCore * spawnFade * deathFade;
return half4(sceneColor + emission, 1.0);
}
ENDHLSL
Pass
{
Name "Space Pulse Pass"
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Fragment
ENDHLSL
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b2f9ca12ccf5e1142a04eaabecd8300f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,51 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSUtilities.Rendering.PostProcessing
{
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Hyper Tunnel")]
public class HyperTunnel : ScriptablePostProcessorVolume
{
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess;
// Run after basic effects, probably before UI
public override int OrderInInjectionPoint => 55;
[Header("Global Pulse Color")]
[Tooltip("Emission Color of the Speed Lines. Alpha controls opacity multiplier.")]
public ColorParameter color = new(new Color(0f, 1f, 1f, 1f), true, true, true);
[Header("Speed Lines Effect")]
[Tooltip("Luminosity of the speed lines.")]
public ClampedFloatParameter lineIntensity = new(0f, 0f, 10f);
[Tooltip("The speed at which the lines fly out of the center.")]
public FloatParameter baseSpeed = new(30f);
[Header("Distortion & Blur")]
[Tooltip("How strongly the environment is pulled into a radial motion blur.")]
public ClampedFloatParameter radialBlurAmount = new(0f, 0f, 0.2f);
[Tooltip("RGB split dispersion amount when pulsing.")]
public ClampedFloatParameter chromaticAberration = new(0f, 0f, 5f);
[Header("VFX Center")]
[Tooltip("The vanishing point (0.5, 0.5 is the exact screen center)")]
public Vector2Parameter vfxCenter = new(new Vector2(0.5f, 0.5f));
public override string GetShaderName() => "SLS/Postprocessing/HyperTunnel";
public override bool IsActive() => (lineIntensity.value > 0f || radialBlurAmount.value > 0f || chromaticAberration.value > 0f);
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle target)
{
if (material == null) return;
material.SetColor(InternalShaderHelpers.ID._HyperTunnelColor, color.value);
Vector4 p = new Vector4(baseSpeed.value, lineIntensity.value, radialBlurAmount.value, chromaticAberration.value);
material.SetVector(InternalShaderHelpers.ID._HyperTunnelParams, p);
material.SetVector(InternalShaderHelpers.ID._HyperTunnelCenter, vfxCenter.value);
Blitter.BlitCameraTexture(cmd, source, target, material, 0);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ca9aea411b88f2f40b0c49fe96b99c59

View File

@@ -0,0 +1,51 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSUtilities.Rendering.PostProcessing
{
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Space Pulse (Shockwave)")]
public class SpacePulse : ScriptablePostProcessorVolume
{
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess;
public override int OrderInInjectionPoint => 56;
[Header("Animation")]
[Tooltip("The progress of the pulse. 0 = far center, 1+ = hits the camera and disappears. Drive this value using C#/Timeline.")]
public ClampedFloatParameter pulseProgress = new(0f, 0f, 2f);
[Header("Appearance")]
[Tooltip("Emission Color of the pulse shockwave. Alpha controls the core brightness.")]
public ColorParameter color = new(new Color(0f, 1f, 1f, 1f), true, true, true);
[Tooltip("Thickness of the shockwave ring.")]
public ClampedFloatParameter thickness = new(0.1f, 0.01f, 0.5f);
[Header("Distortion")]
[Tooltip("How strongly it warps/refracts the background pixels (positive pushes out, negative pulls in).")]
public ClampedFloatParameter distortion = new(0.05f, -0.2f, 0.2f);
[Tooltip("Chromatic aberration split on the edges of the pulse.")]
public ClampedFloatParameter chromaticAberration = new(0.02f, 0f, 0.1f);
[Header("Center")]
[Tooltip("The vanishing point from where the pulse originates (0.5, 0.5 is screen center).")]
public Vector2Parameter vfxCenter = new(new Vector2(0.5f, 0.5f));
public override string GetShaderName() => "SLS/Postprocessing/SpacePulse";
public override bool IsActive() => pulseProgress.value > 0f && pulseProgress.value < 1.5f;
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle target)
{
if (material == null) return;
material.SetColor(InternalShaderHelpers.ID._SpacePulseColor, color.value);
// Pack params into Vector4 for single pass
Vector4 p = new Vector4(pulseProgress.value, thickness.value, distortion.value, chromaticAberration.value);
material.SetVector(InternalShaderHelpers.ID._SpacePulseParams, p);
material.SetVector(InternalShaderHelpers.ID._SpacePulseCenter, vfxCenter.value);
Blitter.BlitCameraTexture(cmd, source, target, material, 0);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 16decd3846371234ba1b06a688844914