Advertisement
EvgenBelov

Untitled

Aug 1st, 2022
1,374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "PBRMaskTint"
  2. {
  3.     Properties
  4.     {
  5.         _MainTex("Albedo", 2D) = "white" {}
  6.         _Mask("Mask", 2D) = "white" {}
  7.         _NormalMap("Normal", 2D) = "bump" {}
  8.         _Metallic("SAM", 2D) = "white" {}
  9.  
  10.         _ColorTint1("Color01", Color) = (0,0.1394524,0.8088235,0)
  11.         _ColorTint2("Color02", Color) = (0.4557808,0,0.6176471,0)
  12.         _ColorTint3("Color03", Color) = (0.4557808,0,0.6176471,0)
  13.         _Color01Power("Color01Power", Range( 0 , 2)) = 1
  14.         _Color02Power("Color02Power", Range( 0 , 4)) = 2
  15.         _Color03Power("Color03Power", Range( 0 , 2)) = 1
  16.         _Brightness("Brightness", Range( 0 , 4)) = 1
  17.         [HideInInspector] _texcoord( "", 2D ) = "white" {}
  18.         [HideInInspector] __dirty( "", Int ) = 1
  19.     }
  20.  
  21.     SubShader
  22.     {
  23.         Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" }
  24.         Cull Back
  25.         CGPROGRAM
  26.         #pragma target 3.0
  27.         #pragma surface surf Standard keepalpha addshadow fullforwardshadows
  28.         struct Input
  29.         {
  30.             float2 uv_texcoord;
  31.         };
  32.  
  33.         uniform sampler2D _NormalMap;
  34.         uniform float4 _NormalMap_ST;
  35.         uniform sampler2D _MainTex;
  36.         uniform float4 _MainTex_ST;
  37.         uniform sampler2D _Mask;
  38.         uniform float4 _Mask_ST;
  39.         uniform float4 _ColorTint1;
  40.         uniform float _Color01Power;
  41.         uniform float4 _ColorTint2;
  42.         uniform float _Color02Power;
  43.         uniform float4 _ColorTint3;
  44.         uniform float _Color03Power;
  45.         uniform float _Brightness;
  46.         uniform sampler2D _Metallic;
  47.         uniform float4 _Metallic_ST;
  48.  
  49.         void surf( Input i , inout SurfaceOutputStandard o )
  50.         {
  51.             float2 uv_Normal = i.uv_texcoord * _NormalMap_ST.xy + _NormalMap_ST.zw;
  52.             o.Normal = UnpackNormal( tex2D( _NormalMap, uv_Normal ) );
  53.             float2 uv_Albedo = i.uv_texcoord * _MainTex_ST.xy + _MainTex_ST.zw;
  54.             float4 tex2DNode2 = tex2D( _MainTex, uv_Albedo );
  55.             float2 uv_Mask = i.uv_texcoord * _Mask_ST.xy + _Mask_ST.zw;
  56.             float4 tex2DNode5 = tex2D( _Mask, uv_Mask );
  57.             float4 temp_cast_0 = (tex2DNode5.r).xxxx;
  58.             float4 temp_cast_1 = (tex2DNode5.g).xxxx;
  59.             float4 temp_cast_2 = (tex2DNode5.b).xxxx;
  60.             float4 blendOpSrc20 = tex2DNode2;
  61.             float4 blendOpDest20 = ( ( min( temp_cast_0 , _ColorTint1 ) * _Color01Power ) + ( min( temp_cast_1 , _ColorTint2 ) * _Color02Power ) + ( min( temp_cast_2 , _ColorTint3 ) * _Color03Power ) );
  62.             float4 lerpResult19 = lerp( tex2DNode2 , ( ( saturate( ( blendOpSrc20 * blendOpDest20 ) )) * _Brightness ) , ( tex2DNode5.r + tex2DNode5.g + tex2DNode5.b ));
  63.             o.Albedo = lerpResult19.rgb;
  64.             float2 uv_SAM = i.uv_texcoord * _Metallic_ST.xy + _Metallic_ST.zw;
  65.             float4 tex2DNode4 = tex2D( _Metallic, uv_SAM );
  66.             o.Metallic = tex2DNode4.b;
  67.             o.Smoothness = 0.5;// tex2DNode4.r;
  68.             o.Occlusion = 1;//tex2DNode4.g;
  69.             o.Alpha = 1;
  70.         }
  71.  
  72.         ENDCG
  73.     }
  74.     Fallback "Diffuse"
  75.     //CustomEditor "ASEMaterialInspector"
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement