Advertisement
Guest User

Untitled

a guest
Apr 20th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 6.00 KB | None | 0 0
  1. // Made with Amplify Shader Editor
  2. // Available at the Unity Asset Store - http://u3d.as/y3X
  3. Shader "Naelstrof/DecalProjector"
  4. {
  5.     Properties
  6.     {
  7.         _Decal("Decal", 2D) = "white" {}
  8.         _BaseColor("BaseColor", Color) = (1,1,1,1)
  9.  
  10.     }
  11.    
  12.     SubShader
  13.     {
  14.        
  15.        
  16.         Tags { "RenderType"="Opaque" }
  17.     LOD 100
  18.  
  19.         CGINCLUDE
  20.         #pragma target 3.0
  21.         ENDCG
  22.         Blend Off
  23.         Cull Off
  24.         ColorMask RGBA
  25.         ZWrite On
  26.         ZTest Always
  27.         Offset 0 , 0
  28.        
  29.        
  30.        
  31.         Pass
  32.         {
  33.             Name "Unlit"
  34.             Tags { "LightMode"="ForwardBase" }
  35.             CGPROGRAM
  36.  
  37.             #define ASE_ABSOLUTE_VERTEX_POS 1
  38.  
  39.  
  40.             #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
  41.             //only defining to not throw compilation error over Unity 5.5
  42.             #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
  43.             #endif
  44.             #pragma vertex vert
  45.             #pragma fragment frag
  46.             #pragma multi_compile_instancing
  47.             #include "UnityCG.cginc"
  48.             #define ASE_NEEDS_VERT_POSITION
  49.  
  50.  
  51.             struct appdata
  52.             {
  53.                 float4 vertex : POSITION;
  54.                 float4 color : COLOR;
  55.                 UNITY_VERTEX_INPUT_INSTANCE_ID
  56.                 float4 ase_texcoord1 : TEXCOORD1;
  57.             };
  58.            
  59.             struct v2f
  60.             {
  61.                 float4 vertex : SV_POSITION;
  62. #ifdef ASE_NEEDS_FRAG_WORLD_POSITION
  63.                 float3 worldPos : TEXCOORD0;
  64. #endif
  65.                 UNITY_VERTEX_INPUT_INSTANCE_ID
  66.                 UNITY_VERTEX_OUTPUT_STEREO
  67.                 float4 ase_texcoord1 : TEXCOORD1;
  68.             };
  69.  
  70.             uniform float4 _BaseColor;
  71.             uniform sampler2D _Decal;
  72.  
  73.            
  74.             v2f vert ( appdata v )
  75.             {
  76.                 v2f o;
  77.                 UNITY_SETUP_INSTANCE_ID(v);
  78.                 UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  79.                 UNITY_TRANSFER_INSTANCE_ID(v, o);
  80.  
  81.                 float2 uv17 = v.ase_texcoord1.xy * float2( 1,1 ) + float2( 0,0 );
  82.                 float4 appendResult8 = (float4(uv17 , 0.0 , 1.0));
  83.                
  84.                 float4 unityObjectToClipPos38 = UnityObjectToClipPos( v.vertex.xyz );
  85.                 float4 vertexToFrag32 = ( unityObjectToClipPos38 + float4( 0.5,0.5,0,0 ) );
  86.                 o.ase_texcoord1 = vertexToFrag32;
  87.                
  88.                 float3 vertexValue = float3(0, 0, 0);
  89.                 #if ASE_ABSOLUTE_VERTEX_POS
  90.                 vertexValue = v.vertex.xyz;
  91.                 #endif
  92.                 vertexValue = ( ( appendResult8 * float4( 2,-2,0,0 ) ) + float4( -1,1,0,0 ) ).xyz;
  93.                 o.vertex = float4(vertexValue.xyz,1);
  94.  
  95. #ifdef ASE_NEEDS_FRAG_WORLD_POSITION
  96.                 o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
  97. #endif
  98.                 return o;
  99.             }
  100.            
  101.             fixed4 frag (v2f i ) : SV_Target
  102.             {
  103.                 UNITY_SETUP_INSTANCE_ID(i);
  104.                 UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
  105.                 fixed4 finalColor;
  106. #ifdef ASE_NEEDS_FRAG_WORLD_POSITION
  107.                 float3 WorldPosition = i.worldPos;
  108. #endif
  109.                 float4 vertexToFrag32 = i.ase_texcoord1;
  110.                 float4 temp_output_40_0 = ( _BaseColor * tex2D( _Decal, vertexToFrag32.xy ) );
  111.                
  112.                
  113.                 finalColor = temp_output_40_0;
  114.                 return finalColor;
  115.             }
  116.             ENDCG
  117.         }
  118.     }
  119.     CustomEditor "ASEMaterialInspector"
  120.    
  121.    
  122. }
  123. /*ASEBEGIN
  124. Version=18000
  125. 36;207;1238;738;641.9648;426.9618;1.646955;True;False
  126. Node;AmplifyShaderEditor.PosVertexDataNode;37;-1503.841,-313.4268;Inherit;False;1;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  127. Node;AmplifyShaderEditor.UnityObjToClipPosHlpNode;38;-1233.169,-320.4389;Inherit;False;1;0;FLOAT3;0,0,0;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  128. Node;AmplifyShaderEditor.SimpleAddOpNode;34;-996.2613,-150.4235;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0.5,0.5,0,0;False;1;FLOAT4;0
  129. Node;AmplifyShaderEditor.TextureCoordinatesNode;7;-1346.113,236.3378;Inherit;False;1;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  130. Node;AmplifyShaderEditor.VertexToFragmentNode;32;-756.8855,-314.0611;Inherit;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0
  131. Node;AmplifyShaderEditor.DynamicAppendNode;8;-850.5953,285.5374;Inherit;False;FLOAT4;4;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;1;False;1;FLOAT4;0
  132. Node;AmplifyShaderEditor.SamplerNode;18;-415.8339,-420.1366;Inherit;True;Property;_Decal;Decal;0;0;Create;True;0;0;False;0;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  133. Node;AmplifyShaderEditor.ColorNode;39;-190.8542,-673.1726;Inherit;False;Property;_BaseColor;BaseColor;1;0;Create;True;0;0;False;0;1,1,1,1;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
  134. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-527.2792,314.288;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;2,-2,0,0;False;1;FLOAT4;0
  135. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;40;34.17314,-390.6841;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
  136. Node;AmplifyShaderEditor.BreakToComponentsNode;41;91.67751,-145.7817;Inherit;False;COLOR;1;0;COLOR;0,0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15
  137. Node;AmplifyShaderEditor.SimpleAddOpNode;10;-303.0933,290.0089;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;-1,1,0,0;False;1;FLOAT4;0
  138. Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;42;644.8629,-53.67207;Float;False;True;-1;2;ASEMaterialInspector;100;21;Naelstrof/DecalProjector;928f6a5fbd2e6444ea9bb91fa46f1aa9;True;Unlit;0;0;Unlit;2;True;0;1;False;-1;0;False;-1;0;1;False;-1;0;False;-1;True;0;False;-1;0;False;-1;True;False;True;2;False;-1;True;True;True;True;True;0;False;-1;True;False;255;False;-1;255;False;-1;255;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;7;False;-1;1;False;-1;1;False;-1;1;False;-1;True;1;False;-1;True;7;False;-1;True;True;0;False;-1;0;False;-1;True;1;RenderType=Opaque=RenderType;True;2;0;False;False;False;False;False;False;False;False;False;True;1;LightMode=ForwardBase;False;0;;0;0;Standard;1;Vertex Position,InvertActionOnDeselection;0;0;1;True;False;;0
  139. WireConnection;38;0;37;0
  140. WireConnection;34;0;38;0
  141. WireConnection;32;0;34;0
  142. WireConnection;8;0;7;0
  143. WireConnection;18;1;32;0
  144. WireConnection;9;0;8;0
  145. WireConnection;40;0;39;0
  146. WireConnection;40;1;18;0
  147. WireConnection;41;0;40;0
  148. WireConnection;10;0;9;0
  149. WireConnection;42;0;40;0
  150. WireConnection;42;1;10;0
  151. ASEEND*/
  152. //CHKSM=9E4330EB1CD66C6EBFA9923517F2ED354A50A59E
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement