daily pastebin goal
24%
SHARE
TWEET

Demo 34 - Cosmic effect

tonynogo Jul 6th, 2017 1,896 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/CosmicEffect"
  2. {
  3.     Properties
  4.     {
  5.         _MainTex ("Texture", 2D) = "white" {}
  6.         _Zoom ("Zoom", Range(0.5, 20)) = 1
  7.         _Speed ("Speed", Range(0.01, 10)) = 1
  8.     }
  9.     SubShader
  10.     {
  11.         Pass
  12.         {
  13.             CGPROGRAM
  14.             #pragma vertex vert
  15.             #pragma fragment frag
  16.             #include "UnityCG.cginc"
  17.  
  18.             float4 vert (appdata_base v) : SV_POSITION
  19.             {
  20.                 return mul(UNITY_MATRIX_MVP, v.vertex);
  21.             }
  22.            
  23.             sampler2D _MainTex;
  24.             half _Zoom;
  25.             half _Speed;
  26.  
  27.             fixed4 frag (float4 i : VPOS) : SV_Target
  28.             {
  29.                 return tex2D(_MainTex, float2((i.xy/ _ScreenParams.xy) + float2(_CosTime.x * _Speed, _SinTime.x * _Speed) / _Zoom));
  30.             }
  31.             ENDCG
  32.         }
  33.     }
  34. }
RAW Paste Data
Top