// Made with Amplify Shader Editor // Available at the Unity Asset Store - http://u3d.as/y3X Shader "PBRase/MaskMaterial" { Properties { _DiffuseTex("漫反射贴图", 2D) = "white" {} _DetailTex("细节贴图", 2D) = "white" {} [HDR]_DiffuseCol("漫反射颜色", Color) = (1,1,1,0) _MaskTex("多通道贴图", 2D) = "white" {} _MetalInt("金属强度", Range( 0 , 1)) = 1 _AmbientOcclusionInt("环境遮挡强度", Range( 0 , 1)) = 1 _SmoothnessInt("光滑度强度", Range( 0 , 1)) = 0 [Normal]_NormalTex("法线贴图", 2D) = "bump" {} _NormalInt("法线强度", Range( 0 , 5)) = 1 [Toggle]_NormalToggleSwitch("是否添加细节贴图", Float) = 0 [HideInInspector] _texcoord( "", 2D ) = "white" {} [HideInInspector] __dirty( "", Int ) = 1 } SubShader { Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" } Cull Back CGPROGRAM #include "UnityStandardUtils.cginc" #pragma target 3.0 #pragma surface surf Standard keepalpha addshadow fullforwardshadows struct Input { float2 uv_texcoord; }; uniform float _NormalToggleSwitch; uniform sampler2D _NormalTex; uniform float4 _NormalTex_ST; uniform float _NormalInt; uniform sampler2D _DetailTex; uniform float4 _DetailTex_ST; uniform sampler2D _DiffuseTex; uniform float4 _DiffuseTex_ST; uniform float4 _DiffuseCol; uniform sampler2D _MaskTex; uniform float4 _MaskTex_ST; uniform float _MetalInt; uniform float _SmoothnessInt; uniform float _AmbientOcclusionInt; void surf( Input i , inout SurfaceOutputStandard o ) { float2 uv_NormalTex = i.uv_texcoord * _NormalTex_ST.xy + _NormalTex_ST.zw; float3 tex2DNode2 = UnpackNormal( tex2D( _NormalTex, uv_NormalTex ) ); float3 appendResult19 = (float3(( tex2DNode2.r * _NormalInt ) , ( tex2DNode2.g * _NormalInt ) , tex2DNode2.b)); float2 uv_DetailTex = i.uv_texcoord * _DetailTex_ST.xy + _DetailTex_ST.zw; float4 tex2DNode20 = tex2D( _DetailTex, uv_DetailTex ); float2 appendResult32 = (float2(tex2DNode20.a , tex2DNode20.g)); float2 temp_output_1_0_g1 = appendResult32; float dotResult4_g1 = dot( temp_output_1_0_g1 , temp_output_1_0_g1 ); float3 appendResult10_g1 = (float3((temp_output_1_0_g1).x , (temp_output_1_0_g1).y , sqrt( ( 1.0 - saturate( dotResult4_g1 ) ) ))); float3 normalizeResult12_g1 = normalize( appendResult10_g1 ); o.Normal = (( _NormalToggleSwitch )?( BlendNormals( appendResult19 , normalizeResult12_g1 ) ):( appendResult19 )); float2 uv_DiffuseTex = i.uv_texcoord * _DiffuseTex_ST.xy + _DiffuseTex_ST.zw; o.Albedo = ( ( tex2D( _DiffuseTex, uv_DiffuseTex ) * _DiffuseCol ) * tex2DNode20.r ).rgb; float2 uv_MaskTex = i.uv_texcoord * _MaskTex_ST.xy + _MaskTex_ST.zw; float4 tex2DNode3 = tex2D( _MaskTex, uv_MaskTex ); o.Metallic = ( tex2DNode3.r * _MetalInt ); o.Smoothness = ( ( tex2DNode3.a * _SmoothnessInt ) * tex2DNode20.b ); o.Occlusion = ( tex2DNode3.g * _AmbientOcclusionInt ); o.Alpha = 1; } ENDCG } Fallback "Diffuse" CustomEditor "ASEMaterialInspector" } /*ASEBEGIN Version=18935 39;167;1241;684;1616.34;-888.7711;1;True;True Node;AmplifyShaderEditor.SamplerNode;2;-1233.923,1113.503;Inherit;True;Property;_NormalTex;法线贴图;7;1;[Normal];Create;False;0;0;0;False;0;False;-1;None;None;True;0;False;bump;LockedToTexture2D;True;Object;-1;Auto;Texture2D;8;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;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.RangedFloatNode;16;-1214.382,1337.48;Inherit;False;Property;_NormalInt;法线强度;8;0;Create;False;0;0;0;False;0;False;1;0;0;5;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;20;-2125.57,372.4261;Inherit;True;Property;_DetailTex;细节贴图;1;0;Create;False;0;0;0;False;0;False;-1;None;49180d88bfcb63c40acd5302ad001b0e;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;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;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;17;-830.0043,1073.13;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;18;-828.0043,1347.13;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.DynamicAppendNode;32;-1764.904,464.5345;Inherit;True;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0 Node;AmplifyShaderEditor.RangedFloatNode;11;-1158.155,841.9584;Inherit;False;Property;_SmoothnessInt;光滑度强度;6;0;Create;False;0;0;0;False;0;False;0;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.SamplerNode;3;-1176.2,283.1891;Inherit;True;Property;_MaskTex;多通道贴图;3;0;Create;False;0;0;0;False;0;False;-1;None;75eabed6cde30284d966fc1fe20e1acb;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;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;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.ColorNode;12;-1095.46,78.36996;Inherit;False;Property;_DiffuseCol;漫反射颜色;2;1;[HDR];Create;False;0;0;0;False;0;False;1,1,1,0;1,1,1,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.SamplerNode;1;-1181.961,-123.6071;Inherit;True;Property;_DiffuseTex;漫反射贴图;0;0;Create;False;0;0;0;False;0;False;-1;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;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;6;FLOAT;0;False;7;SAMPLERSTATE;;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4 Node;AmplifyShaderEditor.FunctionNode;33;-1478.494,536.7463;Inherit;True;Normal Reconstruct Z;-1;;1;63ba85b764ae0c84ab3d698b86364ae9;0;1;1;FLOAT2;0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.DynamicAppendNode;19;-573.0606,1238.846;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;10;-835.615,790.8665;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.RangedFloatNode;5;-1165.1,533.7504;Inherit;False;Property;_MetalInt;金属强度;4;0;Create;False;0;0;0;False;0;False;1;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.BlendNormalsNode;34;-376.0797,969.5897;Inherit;True;0;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.RangedFloatNode;7;-1163.245,679.9561;Inherit;False;Property;_AmbientOcclusionInt;环境遮挡强度;5;0;Create;False;0;0;0;False;0;False;1;0;0;1;0;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-826.7805,22.71531;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;COLOR;1,0,0,0;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;4;-831.3654,331.7525;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;24;-480.4872,79.0782;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;1;False;1;COLOR;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;25;-527.0924,600.0429;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.SimpleMultiplyOpNode;6;-830.3588,563.0101;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0 Node;AmplifyShaderEditor.ToggleSwitchNode;36;-33.42486,915.1946;Inherit;True;Property;_NormalToggleSwitch;是否添加细节贴图;9;0;Create;False;0;0;0;False;0;False;0;True;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0 Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;237.9179,407.6479;Float;False;True;-1;2;ASEMaterialInspector;0;0;Standard;PBRase/MaskMaterial;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Back;0;False;-1;0;False;-1;False;0;False;-1;0;False;-1;False;0;Opaque;0.5;True;True;0;False;Opaque;;Geometry;All;18;all;True;True;True;True;0;False;-1;False;0;False;-1;255;False;-1;255;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;-1;False;2;15;10;25;False;0.5;True;0;0;False;-1;0;False;-1;0;0;False;-1;0;False;-1;0;False;-1;0;False;-1;0;False;0;0,0,0,0;VertexOffset;True;False;Cylindrical;False;True;Relative;0;;-1;-1;-1;-1;0;False;0;0;False;-1;-1;0;False;-1;0;0;0;False;0.1;False;-1;0;False;-1;False;16;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0;False;9;FLOAT;0;False;10;FLOAT;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 WireConnection;17;0;2;1 WireConnection;17;1;16;0 WireConnection;18;0;2;2 WireConnection;18;1;16;0 WireConnection;32;0;20;4 WireConnection;32;1;20;2 WireConnection;33;1;32;0 WireConnection;19;0;17;0 WireConnection;19;1;18;0 WireConnection;19;2;2;3 WireConnection;10;0;3;4 WireConnection;10;1;11;0 WireConnection;34;0;19;0 WireConnection;34;1;33;0 WireConnection;13;0;1;0 WireConnection;13;1;12;0 WireConnection;4;0;3;1 WireConnection;4;1;5;0 WireConnection;24;0;13;0 WireConnection;24;1;20;1 WireConnection;25;0;10;0 WireConnection;25;1;20;3 WireConnection;6;0;3;2 WireConnection;6;1;7;0 WireConnection;36;0;19;0 WireConnection;36;1;34;0 WireConnection;0;0;24;0 WireConnection;0;1;36;0 WireConnection;0;3;4;0 WireConnection;0;4;25;0 WireConnection;0;5;6;0 ASEEND*/ //CHKSM=17ADAFFCEDBA4E991E4D5CCAE9B83D3E716C15C3