Advertisement
kadyr

BlackHole

Oct 12th, 2021
2,251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "ErbGameArt/BlackHole" {
  2.     Properties {
  3.         _EffectPower ("EffectPower", Range(0.5, 10)) = 2.4
  4.         _Speed ("Speed", Range(-2, 2)) = 1.2
  5.         _Spin ("Spin", Range(-20, 20)) = 8.4
  6.         _PowerOfLines ("PowerOfLines", Range(1, 7)) = 1.5
  7.         _Strensh ("Strensh", Range(0, 2)) = 0.41
  8.         _Color ("Color", Color) = (0,0,0,1)
  9.         _MultiLines ("MultiLines", Float ) = 0.5
  10.         _SpeenPower ("SpeenPower", Range(0.1, 1)) = 0.1
  11.     }
  12.     SubShader {
  13.         Tags {
  14.             "IgnoreProjector"="True"
  15.             "Queue"="Transparent"
  16.             "RenderType"="Transparent"
  17.         }
  18.         GrabPass{ }
  19.         Pass {
  20.             Name "FORWARD"
  21.             Tags {
  22.                 "LightMode"="ForwardBase"
  23.             }
  24.             ZWrite Off
  25.             Cull Off
  26.            
  27.             CGPROGRAM
  28.             #pragma vertex vert
  29.             #pragma fragment frag
  30.             #define UNITY_PASS_FORWARDBASE
  31.             #include "UnityCG.cginc"
  32.             #pragma multi_compile_fwdbase
  33.             #pragma multi_compile_fog
  34.             uniform sampler2D _GrabTexture;
  35.             uniform float4 _TimeEditor;
  36.             uniform float _EffectPower;
  37.             uniform float _Speed;
  38.             uniform float _Spin;
  39.             uniform float _PowerOfLines;
  40.             uniform float _Strensh;
  41.             uniform float4 _Color;
  42.             uniform float _MultiLines;
  43.             uniform float _SpeenPower;
  44.             struct VertexInput {
  45.                 float4 vertex : POSITION;
  46.                 float2 texcoord0 : TEXCOORD0;
  47.             };
  48.             struct VertexOutput {
  49.                 float4 pos : SV_POSITION;
  50.                 float2 uv0 : TEXCOORD0;
  51.                 float4 screenPos : TEXCOORD1;
  52.                 UNITY_FOG_COORDS(2)
  53.             };
  54.             VertexOutput vert (VertexInput v) {
  55.                 VertexOutput o = (VertexOutput)0;
  56.                 o.uv0 = v.texcoord0;
  57.                 o.pos = UnityObjectToClipPos(v.vertex );
  58.                 UNITY_TRANSFER_FOG(o,o.pos);
  59.                 o.screenPos = o.pos;
  60.                 return o;
  61.             }
  62.             float4 frag(VertexOutput i) : COLOR {
  63.                 #if UNITY_UV_STARTS_AT_TOP
  64.                     float grabSign = -_ProjectionParams.x;
  65.                 #else
  66.                     float grabSign = _ProjectionParams.x;
  67.                 #endif
  68.                 i.screenPos = float4( i.screenPos.xy / i.screenPos.w, 0, 0 );
  69.                 i.screenPos.y *= _ProjectionParams.x;
  70.                 float2 sceneUVs = float2(1,grabSign)*i.screenPos.xy*0.5+0.5;
  71.                 float4 sceneColor = tex2D(_GrabTexture, sceneUVs);
  72.                 float4 node_6404 = _Time + _TimeEditor;
  73.                 float node_5231 = saturate((1.0 - length(abs(((i.uv0-0.5)/0.5)))));
  74.                 float node_9521_ang = ((frac((node_6404.g*_Speed))*3.141592654)+(node_5231*_Spin));
  75.                 float node_9521_cos = cos(1.0*node_9521_ang);
  76.                 float node_9521_sin = sin(1.0*node_9521_ang);
  77.                 float2 node_9521 = (mul(i.uv0-float2(0.5,0.5),float2x2( node_9521_cos, -node_9521_sin, node_9521_sin, node_9521_cos))+float2(0.5,0.5));
  78.                 float2 node_7679 = abs(((node_9521-0.5)/0.5)).rg;
  79.                 float node_1380 = node_5231;
  80.                 float node_6699 = saturate(((saturate(frac(pow(((_MultiLines*atan2(node_7679.r,node_7679.g))*(_MultiLines*atan2(node_7679.g,node_7679.r))),_SpeenPower)))*pow(node_1380,_EffectPower))+pow(node_1380,_PowerOfLines)));
  81.                 float node_9822 = (_Strensh*node_6699);
  82.                 float node_2935_ang = (node_9822*node_9822);
  83.                 float node_2935_cos = cos(1.0*node_2935_ang);
  84.                 float node_2935_sin = sin(1.0*node_2935_ang);
  85.                 float2 node_2935_piv = float2(0.5,0.5);
  86.                 float2 node_2935 = (mul(sceneUVs.rg-node_2935_piv,float2x2( node_2935_cos, -node_2935_sin, node_2935_sin, node_2935_cos))+node_2935_piv);
  87.                 float3 finalColor = lerp(saturate(tex2D( _GrabTexture, node_2935).rgb),_Color.rgb,node_6699);
  88.                 fixed4 finalRGBA = fixed4(finalColor,1);
  89.                 UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
  90.                 return finalRGBA;
  91.             }
  92.             ENDCG
  93.         }
  94.     }
  95.     FallBack "Diffuse"
  96. }
  97.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement