212 lines
11 KiB
Plaintext
212 lines
11 KiB
Plaintext
// Made with Amplify Shader Editor
|
|
// Available at the Unity Asset Store - http://u3d.as/y3X
|
|
Shader "MS/PBR_NormalMaping_3000"
|
|
{
|
|
Properties
|
|
{
|
|
_Matcap("Matcap", 2D) = "white" {}
|
|
_HightLight("HightLight", Range( 0 , 1)) = 0
|
|
_MainTex("MainTex", 2D) = "white" {}
|
|
_ao("ao", 2D) = "white" {}
|
|
[HDR]_Color0("Color 0", Color) = (0.2181381,0.3047386,0.3584906,0)
|
|
_CutVolue("CutVolue", Float) = -10
|
|
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
|
|
|
|
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
|
|
LOD 100
|
|
|
|
CGINCLUDE
|
|
#pragma target 3.0
|
|
ENDCG
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
AlphaToMask Off
|
|
Cull Back
|
|
ColorMask RGBA
|
|
ZWrite Off
|
|
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"
|
|
#include "UnityShaderVariables.cginc"
|
|
|
|
|
|
struct appdata
|
|
{
|
|
float4 vertex : POSITION;
|
|
float4 color : COLOR;
|
|
float3 ase_normal : NORMAL;
|
|
float4 ase_texcoord : TEXCOORD0;
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct v2f
|
|
{
|
|
float4 vertex : SV_POSITION;
|
|
#ifdef ASE_NEEDS_FRAG_WORLD_POSITION
|
|
float3 worldPos : TEXCOORD0;
|
|
#endif
|
|
float4 ase_texcoord1 : TEXCOORD1;
|
|
float4 ase_texcoord2 : TEXCOORD2;
|
|
float4 ase_texcoord3 : TEXCOORD3;
|
|
float4 ase_color : COLOR;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
uniform float _CutVolue;
|
|
uniform sampler2D _Matcap;
|
|
uniform float _HightLight;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _ao;
|
|
uniform float4 _Color0;
|
|
|
|
|
|
v2f vert ( appdata v )
|
|
{
|
|
v2f o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
|
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
|
|
|
float3 ase_worldNormal = UnityObjectToWorldNormal(v.ase_normal);
|
|
o.ase_texcoord2.xyz = ase_worldNormal;
|
|
|
|
o.ase_texcoord1 = v.vertex;
|
|
o.ase_texcoord3.xy = v.ase_texcoord.xy;
|
|
o.ase_texcoord3.zw = v.ase_texcoord1.xy;
|
|
o.ase_color = v.color;
|
|
|
|
//setting value to unused interpolator channels and avoid initialization warnings
|
|
o.ase_texcoord2.w = 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
|
|
float4 transform26 = mul(unity_ObjectToWorld,i.ase_texcoord1);
|
|
float clampResult31 = clamp( step( transform26.y , _CutVolue ) , 0.0 , 1.0 );
|
|
float4 appendResult30 = (float4(1.0 , 1.0 , 1.0 , ( 1.0 - clampResult31 )));
|
|
float3 ase_worldNormal = i.ase_texcoord2.xyz;
|
|
float temp_output_12_0 = (1.0 + (_HightLight - 0.0) * (6.0 - 1.0) / (1.0 - 0.0));
|
|
float4 appendResult11 = (float4(temp_output_12_0 , temp_output_12_0 , temp_output_12_0 , 1.0));
|
|
float4 lerpResult15 = lerp( ( tex2D( _Matcap, ( ( mul( UNITY_MATRIX_V, float4( ase_worldNormal , 0.0 ) ).xyz * 0.5 ) + 0.5 ).xy ) * appendResult11 * tex2D( _MainTex, i.ase_texcoord3.xy ) * tex2D( _ao, i.ase_texcoord3.zw ).r * i.ase_color ) , _Color0 , tex2D( _ao, i.ase_texcoord3.xy ).g);
|
|
|
|
|
|
finalColor = ( appendResult30 * lerpResult15 );
|
|
return finalColor;
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
CustomEditor "ASEMaterialInspector"
|
|
|
|
|
|
}
|
|
/*ASEBEGIN
|
|
Version=18707
|
|
-1061;647;1061;558;713.903;201.617;1.857227;True;True
|
|
Node;AmplifyShaderEditor.ViewMatrixNode;3;-695.53,-129.8829;Inherit;False;0;1;FLOAT4x4;0
|
|
Node;AmplifyShaderEditor.WorldNormalVector;4;-775.718,-35.74901;Inherit;False;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
|
|
Node;AmplifyShaderEditor.PosVertexDataNode;25;-1064.956,-518.3449;Inherit;False;1;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RangedFloatNode;5;-547.8042,28.27785;Float;False;Constant;_Float0;Float 0;-1;0;Create;True;0;0;False;0;False;0.5;0;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;6;-536.9868,-100.097;Inherit;False;2;2;0;FLOAT4x4;0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.ObjectToWorldTransfNode;26;-832.8857,-516.8096;Inherit;False;1;0;FLOAT4;0,0,0,1;False;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.RangedFloatNode;29;-795.4564,-270.5203;Inherit;False;Property;_CutVolue;CutVolue;5;0;Create;True;0;0;False;0;False;-10;-10;0;0;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-369.7345,-63.65111;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.RangedFloatNode;10;-615.5436,169.4051;Inherit;False;Property;_HightLight;HightLight;1;0;Create;True;0;0;False;0;False;0;1;0;1;0;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.TexCoordVertexDataNode;21;-372.632,648.4438;Inherit;False;1;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.TexCoordVertexDataNode;19;-374.3962,437.3229;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.TFHCRemapNode;12;-252.4938,177.6341;Inherit;False;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;3;FLOAT;1;False;4;FLOAT;6;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SimpleAddOpNode;8;-194.425,-13.57423;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0
|
|
Node;AmplifyShaderEditor.StepOpNode;27;-591.8059,-397.3843;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;13;-48.31607,338.7628;Inherit;True;Property;_MainTex;MainTex;2;0;Create;True;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.SamplerNode;2;1.020034,-55.75792;Inherit;True;Property;_Matcap;Matcap;0;0;Create;True;0;0;False;0;False;-1;None;a0b7e90efcc72a44894a5557f5d00d93;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;8;0;SAMPLER2D;0,0;False;1;FLOAT2;1,0;False;2;FLOAT;1;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.SamplerNode;20;-80.90918,590.3995;Inherit;True;Property;_ao;ao;3;0;Create;True;0;0;False;0;False;-1;None;4d387475870114d4da7f14933cba56f7;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.DynamicAppendNode;11;14.92013,161.3675;Inherit;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;1;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.ClampOpNode;31;-410.6335,-361.9196;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.VertexColorNode;34;181.2804,472.5563;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.OneMinusNode;32;-148.6706,-312.9736;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
|
|
Node;AmplifyShaderEditor.SamplerNode;23;-96.89731,809.7769;Inherit;True;Property;_TextureSample0;Texture Sample 0;3;0;Create;True;0;0;False;0;False;-1;None;7cd77d5f6519c1645b8b37af8b1dea8d;True;0;False;white;Auto;False;Instance;20;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;9;456.8713,107.1184;Inherit;False;5;5;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0;False;4;COLOR;0,0,0,0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.ColorNode;17;390.3818,291.5215;Inherit;False;Property;_Color0;Color 0;4;1;[HDR];Create;True;0;0;False;0;False;0.2181381,0.3047386,0.3584906,0;1,1,1,1;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
|
|
Node;AmplifyShaderEditor.DynamicAppendNode;30;129.5956,-357.0128;Inherit;False;FLOAT4;4;0;FLOAT;1;False;1;FLOAT;1;False;2;FLOAT;1;False;3;FLOAT;0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.LerpOp;15;770.8395,249.1743;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0
|
|
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;33;979.1266,120.7104;Inherit;False;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0
|
|
Node;AmplifyShaderEditor.TemplateMultiPassMasterNode;24;1173.456,158.2145;Float;False;True;-1;2;ASEMaterialInspector;100;1;MS/PBR_NormalMaping_3000;0770190933193b94aaa3065e307002fa;True;Unlit;0;0;Unlit;2;True;2;5;False;-1;10;False;-1;0;1;False;-1;0;False;-1;True;0;False;-1;0;False;-1;False;False;False;False;False;False;True;0;False;-1;True;0;False;-1;True;True;True;True;True;0;False;-1;False;False;False;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;False;-1;True;3;False;-1;True;True;0;False;-1;0;False;-1;True;2;RenderType=Transparent=RenderType;Queue=Transparent=Queue=0;True;2;0;False;False;False;False;False;False;False;False;False;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;;False;0
|
|
WireConnection;6;0;3;0
|
|
WireConnection;6;1;4;0
|
|
WireConnection;26;0;25;0
|
|
WireConnection;7;0;6;0
|
|
WireConnection;7;1;5;0
|
|
WireConnection;12;0;10;0
|
|
WireConnection;8;0;7;0
|
|
WireConnection;8;1;5;0
|
|
WireConnection;27;0;26;2
|
|
WireConnection;27;1;29;0
|
|
WireConnection;13;1;19;0
|
|
WireConnection;2;1;8;0
|
|
WireConnection;20;1;21;0
|
|
WireConnection;11;0;12;0
|
|
WireConnection;11;1;12;0
|
|
WireConnection;11;2;12;0
|
|
WireConnection;31;0;27;0
|
|
WireConnection;32;0;31;0
|
|
WireConnection;23;1;19;0
|
|
WireConnection;9;0;2;0
|
|
WireConnection;9;1;11;0
|
|
WireConnection;9;2;13;0
|
|
WireConnection;9;3;20;1
|
|
WireConnection;9;4;34;0
|
|
WireConnection;30;3;32;0
|
|
WireConnection;15;0;9;0
|
|
WireConnection;15;1;17;0
|
|
WireConnection;15;2;23;2
|
|
WireConnection;33;0;30;0
|
|
WireConnection;33;1;15;0
|
|
WireConnection;24;0;33;0
|
|
ASEEND*/
|
|
//CHKSM=EC163D1004135001E3971B848F6304B9C115E3F2 |