191 lines
8.6 KiB
GLSL
191 lines
8.6 KiB
GLSL
// Made with Amplify Shader Editor
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "Cheng/MeshTex"
|
|
{
|
|
Properties
|
|
{
|
|
_MianColor("MianColor", Color) = (1,1,1,1)
|
|
_MainTex("MainTex", 2D) = "white" {}
|
|
[Enum(ON,0,OFF,1)]_Float7("通道开关", Float) = 0
|
|
[Enum(UnityEngine.Rendering.CullMode)]_Float0("单双面切换", Float) = 0
|
|
[Toggle]_Float1("深度", Float) = 0
|
|
[Enum(UnityEngine.Rendering.BlendOp)]_Float4("Blend OP", Float) = 0
|
|
[Enum(UnityEngine.Rendering.BlendMode)]_Float2("Blend RGB_S", Float) = 5
|
|
[Enum(UnityEngine.Rendering.BlendMode)]_Float3("Blend RGB_D", Float) = 10
|
|
_Float5("颜色强度", Float) = 1
|
|
_Float6("透明度", Float) = 1
|
|
_Mask("Mask", 2D) = "white" {}
|
|
[HideInInspector] _texcoord( "", 2D ) = "white" {}
|
|
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
|
|
|
|
Tags { "RenderType"="Opaque" }
|
|
LOD 100
|
|
|
|
CGINCLUDE
|
|
#pragma target 3.0
|
|
ENDCG
|
|
Blend [_Float2] [_Float3] , DstColor SrcColor
|
|
BlendOp [_Float4]
|
|
Cull [_Float0]
|
|
ColorMask RGBA
|
|
ZWrite [_Float1]
|
|
ZTest LEqual
|
|
Offset 0 , 0
|
|
|
|
|
|
|
|
Pass
|
|
{
|
|
Name "Unlit"
|
|
Tags { "LightMode"="ForwardBase" }
|
|
CGPROGRAM
|
|
|
|
|
|
|
|
#ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
|
|
//only defining to not throw compilation error over Unity 5.5
|
|
#define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
|
|
#endif
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma multi_compile_instancing
|
|
#include "UnityCG.cginc"
|
|
|
|
|
|
struct appdata
|
|
{
|
|
float4 vertex : POSITION;
|
|
float4 color : COLOR;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
};
|
|
|
|
struct v2f
|
|
{
|
|
float4 vertex : SV_POSITION;
|
|
#ifdef ASE_NEEDS_FRAG_WORLD_POSITION
|
|
float3 worldPos : TEXCOORD0;
|
|
#endif
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
};
|
|
|
|
uniform float _Float5;
|
|
uniform sampler2D _MainTex;
|
|
uniform float4 _MainTex_ST;
|
|
uniform float4 _MianColor;
|
|
uniform float _Float7;
|
|
uniform float _Float6;
|
|
uniform sampler2D _Mask;
|
|
uniform float4 _Mask_ST;
|
|
|
|
|
|
v2f vert ( appdata v )
|
|
{
|
|
v2f o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
|
|
o.ase_texcoord1.xy = v.ase_texcoord.xy;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord1.zw = 0;
|
|
float3 vertexValue = float3(0, 0, 0);
|
|
#if ASE_ABSOLUTE_VERTEX_POS
|
|
vertexValue = v.vertex.xyz;
|
|
#endif
|
|
vertexValue = vertexValue;
|
|
#if ASE_ABSOLUTE_VERTEX_POS
|
|
v.vertex.xyz = vertexValue;
|
|
#else
|
|
v.vertex.xyz += vertexValue;
|
|
#endif
|
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
|
|
|
#ifdef ASE_NEEDS_FRAG_WORLD_POSITION
|
|
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
|
|
#endif
|
|
return o;
|
|
}
|
|
|
|
fixed4 frag (v2f i ) : SV_Target
|
|
{
|
|
UNITY_SETUP_INSTANCE_ID(i);
|
|
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
|
fixed4 finalColor;
|
|
#ifdef ASE_NEEDS_FRAG_WORLD_POSITION
|
|
float3 WorldPosition = i.worldPos;
|
|
#endif
|
|
float2 uv_MainTex = i.ase_texcoord1.xy * _MainTex_ST.xy + _MainTex_ST.zw;
|
|
float4 tex2DNode1 = tex2D( _MainTex, uv_MainTex );
|
|
float4 temp_output_20_0 = ( tex2DNode1 * tex2DNode1.a );
|
|
float4 temp_cast_1 = (tex2DNode1.a).xxxx;
|
|
float4 lerpResult35 = lerp( temp_output_20_0 , temp_cast_1 , _Float7);
|
|
float4 temp_output_33_0 = ( lerpResult35 * _MianColor.a * _Float6 );
|
|
float4 appendResult34 = (float4(( _Float5 * temp_output_20_0 * _MianColor ).rgb , temp_output_33_0.r));
|
|
float2 uv_Mask = i.ase_texcoord1.xy * _Mask_ST.xy + _Mask_ST.zw;
|
|
float4 tex2DNode40 = tex2D( _Mask, uv_Mask );
|
|
float4 appendResult44 = (float4(( appendResult34 * temp_output_33_0 * tex2DNode40 * tex2DNode40.a ).xyz , tex2DNode40.a));
|
|
|
|
|
|
finalColor = appendResult44;
|
|
return finalColor;
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
CustomEditor "ASEMaterialInspector"
|
|
|
|
|
|
}
|
|
/*ASEBEGIN
|
|
Version=18100
|
|
826;58;1838;1301;235.7075;617.2347;1;True;False
|
|
Node;AmplifyShaderEditor.SamplerNode;1;-1221.07,-199.5698;Inherit;True;Property;_MainTex;MainTex;1;0;Create;True;0;0;False;0;False;-1;None;81ac70e0609249442b64331fae15b3c6;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
|
|
Node;AmplifyShaderEditor.RangedFloatNode;36;-702.6547,92.8035;Inherit;False;Property;_Float7;通道开关;2;1;[Enum];Create;False;2;ON;0;OFF;1;0;False;0;False;0;1;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;20;-782.338,-197.1717;Inherit;True;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;32;-430.9952,256.7792;Inherit;False;Property;_Float6;透明度;9;0;Create;False;0;0;False;0;False;1;1;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.LerpOp;35;-507.2549,21.50353;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.ColorNode;30;-1101.89,89.06865;Inherit;False;Property;_MianColor;MianColor;0;0;Create;True;0;0;False;0;False;1,1,1,1;1,1,1,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RangedFloatNode;31;-439.3312,-226.9386;Inherit;False;Property;_Float5;颜色强度;8;0;Create;False;0;0;False;0;False;1;2;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;33;-233.5052,165.252;Inherit;False;3;3;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;29;-251.8548,-162.0964;Inherit;False;3;3;0;FLOAT;0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SamplerNode;40;-197.6788,277.1613;Inherit;True;Property;_Mask;Mask;10;0;Create;True;0;0;False;0;False;-1;None;5e443555f21819043a6b6586128de6e5;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
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;34;9.97242,-172.8609;Inherit;True;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;43;409.9349,-51.86198;Inherit;True;4;4;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;5;324.5998,-317.3999;Inherit;False;Property;_Float0;单双面切换;3;1;[Enum];Fetch;False;0;1;UnityEngine.Rendering.CullMode;True;0;False;0;2;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;44;703.8525,136.8019;Inherit;True;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;27;665.2452,-415.697;Inherit;False;Property;_Float3;Blend RGB_D;7;1;[Enum];Fetch;False;0;1;UnityEngine.Rendering.BlendMode;True;0;False;10;10;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;26;645.6453,-334.4965;Inherit;False;Property;_Float2;Blend RGB_S;6;1;[Enum];Fetch;False;0;1;UnityEngine.Rendering.BlendMode;True;0;False;5;7;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;28;331.2453,-396.0964;Inherit;False;Property;_Float4;Blend OP;5;1;[Enum];Fetch;False;0;1;UnityEngine.Rendering.BlendOp;True;0;False;0;28;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;25;321.8452,-238.8964;Inherit;False;Property;_Float1;深度;4;1;[Toggle];Fetch;False;0;1;UnityEngine.Rendering.CompareFunction;True;0;False;0;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;24;988.1425,139.2501;Float;False;True;-1;2;ASEMaterialInspector;100;1;Cheng/MeshTex;0770190933193b94aaa3065e307002fa;True;Unlit;0;0;Unlit;2;True;2;5;True;26;10;True;27;7;2;False;-1;3;False;-1;True;0;True;28;0;False;-1;True;False;True;0;True;5;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;2;True;25;True;3;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;1;0;1;True;False;;0
|
|
WireConnection;20;0;1;0
|
|
WireConnection;20;1;1;4
|
|
WireConnection;35;0;20;0
|
|
WireConnection;35;1;1;4
|
|
WireConnection;35;2;36;0
|
|
WireConnection;33;0;35;0
|
|
WireConnection;33;1;30;4
|
|
WireConnection;33;2;32;0
|
|
WireConnection;29;0;31;0
|
|
WireConnection;29;1;20;0
|
|
WireConnection;29;2;30;0
|
|
WireConnection;34;0;29;0
|
|
WireConnection;34;3;33;0
|
|
WireConnection;43;0;34;0
|
|
WireConnection;43;1;33;0
|
|
WireConnection;43;2;40;0
|
|
WireConnection;43;3;40;4
|
|
WireConnection;44;0;43;0
|
|
WireConnection;44;3;40;4
|
|
WireConnection;24;0;44;0
|
|
ASEEND*/
|
|
//CHKSM=11CBDD6A78084A317B0E80CD230BAF32CB853E05 |