shaders innit
This commit is contained in:
1 parent
7d8cdb8d6e
commit
177f7bbbba
87 files changed
+3072
-14
No files matched your search
+108
@@ -0,0 +1,108 @@
|
||||
Shader "Skybox/PsychedelicBalatroSkybox"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
// _Color1 ("Color 1", Color) = (0.871, 0.267, 0.231, 1.0)
|
||||
// _Color2 ("Color 2", Color) = (0.0, 0.42, 0.706, 1.0)
|
||||
// _Color3 ("Color 3", Color) = (0.086, 0.137, 0.145, 1.0)
|
||||
|
||||
_Color1 ("Color 1", Color) = (0.05, 0.05, 0.08, 1)
|
||||
_Color2 ("Color 2", Color) = (0.2, 0.8, 1.0, 1)
|
||||
_Color3 ("Color 3", Color) = (1.0, 0.6, 0.2, 1)
|
||||
|
||||
_Contrast ("Contrast", Range(0.5, 6)) = 3.5
|
||||
_Lighting ("Lighting", Range(0.0, 2.0)) = 0.4
|
||||
_SpinAmount ("Spin Amount", Range(0, 1)) = 0.25
|
||||
_SpinSpeed ("Spin Speed", Range(0, 20)) = 7.0
|
||||
_Rotation ("Rotation", Range(-10, 10)) = -2.0
|
||||
_TimeScale ("Time Scale", Range(0, 2)) = 1.0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Transparent" "Queue"="Transparent" "PreviewType"="Skybox" }
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
Pass
|
||||
{
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float3 positionOS : POSITION;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float3 viewDirWS : TEXCOORD0;
|
||||
};
|
||||
|
||||
Varyings vert (Attributes v)
|
||||
{
|
||||
Varyings o;
|
||||
o.positionCS = TransformObjectToHClip(v.positionOS);
|
||||
o.viewDirWS = normalize(mul((float3x3)UNITY_MATRIX_M, v.positionOS));
|
||||
return o;
|
||||
}
|
||||
|
||||
float4 _Color1;
|
||||
float4 _Color2;
|
||||
float4 _Color3;
|
||||
float _Contrast;
|
||||
float _Lighting;
|
||||
float _SpinAmount;
|
||||
float _SpinSpeed;
|
||||
float _Rotation;
|
||||
float _TimeScale;
|
||||
|
||||
float3 ApplyPsychedelicEffect(float2 uv, float t)
|
||||
{
|
||||
float2 uv2 = uv;
|
||||
float speed = t * _SpinSpeed;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
uv2 += sin(max(uv.x, uv.y)) + uv;
|
||||
uv.x += 0.5 * cos(5.1123314 + 0.353 * uv2.y + speed * 0.131121);
|
||||
uv.y += 0.5 * sin(uv2.x - 0.113 * speed);
|
||||
uv -= cos(uv.x + uv.y) - sin(uv.x * 0.711 - uv.y);
|
||||
}
|
||||
|
||||
float contrast_mod = (0.25 * _Contrast + 0.5 * _SpinAmount + 1.2);
|
||||
float paint_res = saturate(length(uv) * 0.035 * contrast_mod);
|
||||
float c1p = saturate(1.0 - contrast_mod * abs(1.0 - paint_res));
|
||||
float c2p = saturate(1.0 - contrast_mod * abs(paint_res));
|
||||
float c3p = 1.0 - saturate(c1p + c2p);
|
||||
float light = (_Lighting - 0.2) * saturate(c1p * 5.0 - 4.0) + _Lighting * saturate(c2p * 5.0 - 4.0);
|
||||
|
||||
float3 col = (0.3 / _Contrast) * _Color1.rgb +
|
||||
(1.0 - 0.3 / _Contrast) * (_Color1.rgb * c1p + _Color2.rgb * c2p + c3p * _Color3.rgb) +
|
||||
light;
|
||||
return col;
|
||||
}
|
||||
|
||||
float4 frag(Varyings i) : SV_Target
|
||||
{
|
||||
float3 dir = normalize(i.viewDirWS);
|
||||
|
||||
// Convert direction to spherical UV coordinates
|
||||
float2 uv;
|
||||
uv.x = atan2(dir.z, dir.x) / (2.0 * 3.14159265) + 0.5;
|
||||
uv.y = asin(dir.y) / 3.14159265 + 0.5;
|
||||
uv = uv * 2.0 - 1.0;
|
||||
|
||||
float time = _Time.y * _TimeScale;
|
||||
float3 col = ApplyPsychedelicEffect(uv * 30.0, time);
|
||||
|
||||
return float4(col, 1.0);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
FallBack Off
|
||||
}
|
||||
Reference in new issue
Block a user