You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
5.5 KiB

  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "ASESampleShaders/Stencil Example/AnimatedRefraction"
  4. {
  5. Properties
  6. {
  7. _PortalColor("PortalColor", Color) = (0.003838672,0.5220588,0.243292,0)
  8. _Distortion("Distortion", Range( 0 , 1)) = 0.292
  9. _BrushedMetalNormal("BrushedMetalNormal", 2D) = "bump" {}
  10. [HideInInspector] _texcoord( "", 2D ) = "white" {}
  11. [HideInInspector] __dirty( "", Int ) = 1
  12. }
  13. SubShader
  14. {
  15. Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+100" "IgnoreProjector" = "True" "IsEmissive" = "true" }
  16. Cull Back
  17. GrabPass{ }
  18. CGPROGRAM
  19. #include "UnityShaderVariables.cginc"
  20. #pragma target 3.0
  21. #pragma surface surf Standard alpha:fade keepalpha addshadow fullforwardshadows
  22. struct Input
  23. {
  24. float4 screenPos;
  25. float2 uv_texcoord;
  26. };
  27. uniform sampler2D _GrabTexture;
  28. uniform sampler2D _BrushedMetalNormal;
  29. uniform float4 _BrushedMetalNormal_ST;
  30. uniform float _Distortion;
  31. uniform float4 _PortalColor;
  32. void surf( Input i , inout SurfaceOutputStandard o )
  33. {
  34. float4 ase_screenPos = float4( i.screenPos.xyz , i.screenPos.w + 0.00000000001 );
  35. float4 ase_screenPos39 = ase_screenPos;
  36. #if UNITY_UV_STARTS_AT_TOP
  37. float scale39 = -1.0;
  38. #else
  39. float scale39 = 1.0;
  40. #endif
  41. float halfPosW39 = ase_screenPos39.w * 0.5;
  42. ase_screenPos39.y = ( ase_screenPos39.y - halfPosW39 ) * _ProjectionParams.x* scale39 + halfPosW39;
  43. ase_screenPos39.xyzw /= ase_screenPos39.w;
  44. float4 normalizedClip21 = ase_screenPos39;
  45. float2 uv_BrushedMetalNormal = i.uv_texcoord * _BrushedMetalNormal_ST.xy + _BrushedMetalNormal_ST.zw;
  46. float cos33 = cos( _Time.y );
  47. float sin33 = sin( _Time.y );
  48. float2 rotator33 = mul( uv_BrushedMetalNormal - float2( 0.5,0.5 ) , float2x2( cos33 , -sin33 , sin33 , cos33 )) + float2( 0.5,0.5 );
  49. float4 screenColor8 = tex2Dproj( _GrabTexture, UNITY_PROJ_COORD( ( normalizedClip21 + float4( ( UnpackNormal( tex2D( _BrushedMetalNormal, rotator33 ) ) * _Distortion ) , 0.0 ) ) ) );
  50. o.Emission = ( screenColor8 * _PortalColor ).rgb;
  51. o.Alpha = 1;
  52. }
  53. ENDCG
  54. }
  55. Fallback "Diffuse"
  56. CustomEditor "ASEMaterialInspector"
  57. }
  58. /*ASEBEGIN
  59. Version=13803
  60. 566;511;900;507;252.9078;123.9781;1.324137;True;False
  61. Node;AmplifyShaderEditor.Vector2Node;35;-1152,304;Float;False;Constant;_Vector0;Vector 0;-1;0;0.5,0.5;0;3;FLOAT2;FLOAT;FLOAT
  62. Node;AmplifyShaderEditor.TextureCoordinatesNode;34;-1152,176;Float;False;0;29;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT
  63. Node;AmplifyShaderEditor.TimeNode;36;-1153.522,435.0121;Float;False;0;5;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  64. Node;AmplifyShaderEditor.RotatorNode;33;-831.5794,259.398;Float;False;3;0;FLOAT2;0,0;False;1;FLOAT2;0.5,0.5;False;2;FLOAT;1.0;False;1;FLOAT2
  65. Node;AmplifyShaderEditor.GrabScreenPosition;39;-521.3355,-27.96944;Float;False;0;0;5;FLOAT4;FLOAT;FLOAT;FLOAT;FLOAT
  66. Node;AmplifyShaderEditor.RangedFloatNode;31;-544,400;Float;False;Property;_Distortion;Distortion;1;0;0.292;0;1;0;1;FLOAT
  67. Node;AmplifyShaderEditor.SamplerNode;29;-542.58,195.399;Float;True;Property;_BrushedMetalNormal;BrushedMetalNormal;2;0;None;True;0;True;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;1.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;FLOAT3;FLOAT;FLOAT;FLOAT;FLOAT
  68. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;32;-128.7738,261.0988;Float;False;2;2;0;FLOAT3;0.0,0,0;False;1;FLOAT;0.0,0,0;False;1;FLOAT3
  69. Node;AmplifyShaderEditor.RegisterLocalVarNode;21;-256,-16;Float;False;normalizedClip;-1;False;1;0;FLOAT4;0.0,0,0,0;False;1;FLOAT4
  70. Node;AmplifyShaderEditor.SimpleAddOpNode;30;36.62508,137.2995;Float;False;2;2;0;FLOAT4;0.0,0,0,0;False;1;FLOAT3;0;False;1;FLOAT4
  71. Node;AmplifyShaderEditor.ScreenColorNode;8;224.0004,85.8997;Float;False;Global;_ScreenGrab0;Screen Grab 0;-1;0;Object;-1;False;1;0;FLOAT4;0,0,0,0;False;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
  72. Node;AmplifyShaderEditor.ColorNode;37;231.2177,270.9001;Float;False;Property;_PortalColor;PortalColor;0;0;0.003838672,0.5220588,0.243292,0;0;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
  73. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;38;504.2176,117.4984;Float;False;2;2;0;COLOR;0.0,0,0,0;False;1;COLOR;0.0,0,0,0;False;1;COLOR
  74. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;704.4994,-13;Float;False;True;2;Float;ASEMaterialInspector;0;0;Standard;ASESampleShaders/Stencil Example/AnimatedRefraction;False;False;False;False;False;False;False;False;False;False;False;False;False;False;True;False;False;Back;0;3;False;0;0;Transparent;0.5;True;True;100;False;Transparent;Transparent;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;False;0;255;255;0;0;0;0;0;0;0;0;False;0;4;10;25;False;0.5;True;2;SrcAlpha;OneMinusSrcAlpha;0;Zero;Zero;Add;Add;0;False;0;0,0,0,0;VertexOffset;False;Cylindrical;False;Relative;0;;-1;-1;-1;-1;0;0;0;False;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0.0;False;9;FLOAT;0.0;False;10;FLOAT;0.0;False;13;FLOAT3;0,0,0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
  75. WireConnection;33;0;34;0
  76. WireConnection;33;1;35;0
  77. WireConnection;33;2;36;2
  78. WireConnection;29;1;33;0
  79. WireConnection;32;0;29;0
  80. WireConnection;32;1;31;0
  81. WireConnection;21;0;39;0
  82. WireConnection;30;0;21;0
  83. WireConnection;30;1;32;0
  84. WireConnection;8;0;30;0
  85. WireConnection;38;0;8;0
  86. WireConnection;38;1;37;0
  87. WireConnection;0;2;38;0
  88. ASEEND*/
  89. //CHKSM=6D6C321FB02BE457256E5A07C6464863BCD261AD