Guest User

Unity Standard Shader

a guest
Jun 1st, 2020
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/UniversalFlag"
  2. {
  3.     Properties
  4.     {
  5.         _Color ("Color", Color) = (1,1,1,1)
  6.         _Detail("Detail (RGB)",2D) = "gray" {}
  7.         _MainTex ("MainTex (RGB)", 2D) = "white" {}
  8.     }
  9.     SubShader
  10.     {
  11.         Tags { "RenderType"="Opaque" }
  12.         LOD 200
  13.  
  14.         CGPROGRAM
  15. // Upgrade NOTE: excluded shader from DX11; has structs without semantics (struct v2f members uv_MainTex)
  16. #pragma exclude_renderers d3d11
  17.         // Physically based Standard lighting model, and enable shadows on all light types
  18.         #pragma surface surf Standard fullforwardshadows
  19.  
  20.         // Use shader model 3.0 target, to get nicer looking lighting
  21.         #pragma target 3.0
  22.  
  23.         struct Input{
  24.             float2 uv_MainTex : TEXCOORD0;
  25.             float2 uv2_Detail : TEXCOORD1;
  26.         };
  27.        
  28.         sampler2D _MainTex;
  29.         sampler2D _Detail;
  30.  
  31.         half _Glossiness;
  32.         half _Metallic;
  33.         fixed4 _Color;
  34.  
  35.         // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  36.         // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  37.         // #pragma instancing_options assumeuniformscaling
  38.         UNITY_INSTANCING_BUFFER_START(Props)
  39.             // put more per-instance properties here
  40.         UNITY_INSTANCING_BUFFER_END(Props)
  41.  
  42.         void surf (Input IN, inout SurfaceOutputStandard o)
  43.         {
  44.             // Albedo comes from a texture tinted by color
  45.             fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  46.             o.Albedo = c.rgb;
  47.             o.Albedo *= tex2D (_Detail, IN.uv2_Detail).rgb;
  48.  
  49.             o.Alpha = c.a;
  50.            
  51.            
  52.         }
  53.         ENDCG
  54.     }
  55.     FallBack "Diffuse"
  56. }
Add Comment
Please, Sign In to add comment