Advertisement
Guest User

DecalDiffuseShader

a guest
Nov 22nd, 2024
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.33 KB | None | 0 0
  1. Shader "Project/DecalDiffuse"
  2. {
  3.     Properties
  4.     {
  5.         _Color ("Color", Color) = (1,1,1,1)
  6.         _Emission("Emission", Color) = (0,0,0,0)
  7.         _MainTex ("Diffuse Texture", 2D) = "white" {}
  8.     }
  9.     SubShader
  10.     {
  11.         Tags
  12.         {
  13.             "RenderType" = "Opaque"
  14.             "IgnoreProjector" = "True"
  15.             "Queue" = "Geometry"
  16.             "LightMode" = "Deferred"
  17.         }
  18.         LOD 200
  19.  
  20.         CGPROGRAM
  21.         #pragma surface surf WrapLambert exclude_path:deferred decal:blend
  22.  
  23.  
  24.  
  25.         half4 LightingWrapLambert (SurfaceOutput s, half3 lightDir, half atten)
  26.         {
  27.             half NdotL = dot (s.Normal, lightDir);
  28.             half diff = NdotL * 0.5 + 0.5;
  29.             half4 c;
  30.             c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten);
  31.             c.a = s.Alpha;
  32.             return c;
  33.         }
  34.  
  35.         struct Input
  36.         {
  37.             float2 uv_MainTex;
  38.             half4 color : COLOR;
  39.         };
  40.    
  41.         sampler2D _MainTex;
  42.         fixed4 _Color;
  43.         fixed4 _Emission;
  44.  
  45.         void surf (Input IN, inout SurfaceOutput o)
  46.         {
  47.             fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
  48.             o.Albedo = c.rgb * IN.color.rgb;   
  49.             o.Alpha = c.a * IN.color.a;
  50.             o.Emission = _Emission;
  51.         }
  52.         ENDCG
  53.     }
  54. }
  55.  
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement