86 lines
2.7 KiB
Plaintext
Executable File
86 lines
2.7 KiB
Plaintext
Executable File
Shader "Skybox/PsychedelicSkyboxURP_SineFlow"
|
|
{
|
|
Properties
|
|
{
|
|
_BaseColor ("Base Color", Color) = (0.05, 0.05, 0.08, 1)
|
|
_AccentColor ("Accent Color", Color) = (0.2, 0.8, 1.0, 1)
|
|
_SecondaryColor ("Secondary Color", Color) = (1.0, 0.6, 0.2, 1)
|
|
_Intensity ("Emission Intensity", Range(0, 10)) = 2.5
|
|
_Speed ("Animation Speed", Range(0.1, 5)) = 1.0
|
|
_WarpStrength ("Warp Strength", Range(0.0, 2.0)) = 0.6
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags { "RenderType"="Background" "Queue"="Background" "PreviewType"="Skybox" }
|
|
Cull Off ZWrite Off ZTest Always
|
|
|
|
Pass
|
|
{
|
|
Name "SkyboxPass"
|
|
Tags { "LightMode"="UniversalForward" }
|
|
|
|
HLSLPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
|
|
// === Properties ===
|
|
float4 _BaseColor;
|
|
float4 _AccentColor;
|
|
float4 _SecondaryColor;
|
|
float _Intensity;
|
|
float _Speed;
|
|
float _WarpStrength;
|
|
|
|
struct Attributes
|
|
{
|
|
float4 positionOS : POSITION;
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
float4 positionCS : SV_POSITION;
|
|
float3 viewDirWS : TEXCOORD0;
|
|
};
|
|
|
|
Varyings vert(Attributes v)
|
|
{
|
|
Varyings o;
|
|
o.positionCS = TransformObjectToHClip(v.positionOS.xyz);
|
|
o.viewDirWS = GetSkyboxViewDirWS(v.positionOS.xyz);
|
|
return o;
|
|
}
|
|
|
|
half4 frag(Varyings i) : SV_Target
|
|
{
|
|
// Convert 3D direction to a 2D UV projection
|
|
float3 dir = normalize(i.viewDirWS);
|
|
float2 uv = dir.xy / max(1e-3, (1.0 + dir.z)); // spherical projection
|
|
|
|
float time = _Time.y * _Speed;
|
|
|
|
// --- Warping loop (GLSL style port) ---
|
|
float2 warped = uv;
|
|
[unroll(9)]
|
|
for (float j = 1.0; j < 10.0; j++)
|
|
{
|
|
warped.x += _WarpStrength / j * cos(j * 2.5 * warped.y + time);
|
|
warped.y += _WarpStrength / j * cos(j * 1.5 * warped.x + time);
|
|
}
|
|
|
|
float glow = 0.1 / abs(sin(time - warped.y - warped.x));
|
|
glow = saturate(glow * 5.0);
|
|
|
|
float3 col = lerp(_BaseColor.rgb, _AccentColor.rgb, glow);
|
|
col = lerp(col, _SecondaryColor.rgb, pow(glow, 3.0));
|
|
|
|
return half4(col * _Intensity, 1.0);
|
|
}
|
|
ENDHLSL
|
|
}
|
|
}
|
|
|
|
FallBack Off
|
|
}
|