// Made with Amplify Shader Editor
// Available at the Unity Asset Store -
http://u3d.as/y3X Shader "ASETemplateShaders/DefaultUnlit"
{
Properties
{
_MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_BumpMap("BumpMap", 2D) = "bump" {}
[HideInInspector] _texcoord( "", 2D ) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" "LightMode" = "ForwardBase" }
LOD 100
Cull Off
Pass
{
CGPROGRAM
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float4 texcoord : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;
UNITY_VERTEX_INPUT_INSTANCE_ID
float4 ase_tangent : TANGENT;
float4 ase_normal : NORMAL;
};
struct v2f
{
float4 vertex : SV_POSITION;
float4 texcoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
float4 ase_texcoord1 : TEXCOORD1;
float4 ase_texcoord2 : TEXCOORD2;
float4 ase_texcoord3 : TEXCOORD3;
};
uniform sampler2D _MainTex;
uniform fixed4 _Color;
uniform sampler2D _BumpMap;
uniform float4 _BumpMap_ST;
v2f vert ( appdata v )
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.texcoord.xy = v.texcoord.xy;
o.texcoord.zw = v.texcoord1.xy;
// ase common template code
float3 worldTangent = UnityObjectToWorldDir(v.ase_tangent);
float3 worldNormal = UnityObjectToWorldNormal(v.ase_normal);
float tangentSign = v.ase_tangent.w * unity_WorldTransformParams.w;
float3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;
float3 tanToWorld0 = float3( worldTangent.x, worldBinormal.x, worldNormal.x );
o.ase_texcoord1.xyz = tanToWorld0;
float3 tanToWorld1 = float3( worldTangent.y, worldBinormal.y, worldNormal.y );
o.ase_texcoord2.xyz = tanToWorld1;
float3 tanToWorld2 = float3( worldTangent.z, worldBinormal.z, worldNormal.z );
o.ase_texcoord3.xyz = tanToWorld2;
//setting value to unused interpolator channels and avoid initialization warnings
o.ase_texcoord1.w = 0;
o.ase_texcoord2.w = 0;
o.ase_texcoord3.w = 0;
v.vertex.xyz += float3(0,0,0) ;
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag (v2f i ) : SV_Target
{
fixed4 myColorVar;
// ase common template code
float2 uv_BumpMap = i.texcoord.xy * _BumpMap_ST.xy + _BumpMap_ST.zw;
float3 tanToWorld0 = i.ase_texcoord1.xyz;
float3 tanToWorld1 = i.ase_texcoord2.xyz;
float3 tanToWorld2 = i.ase_texcoord3.xyz;
float3 worldNormal2 = float3(dot(tanToWorld0,tex2D( _BumpMap, uv_BumpMap ).rgb), dot(tanToWorld1,tex2D( _BumpMap, uv_BumpMap ).rgb), dot(tanToWorld2,tex2D( _BumpMap, uv_BumpMap ).rgb));
myColorVar = float4( worldNormal2 , 0.0 );
return myColorVar;
}
ENDCG
}
}
CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=14301
-1343;87;1319;968;878.5;309;1;True;False
Node;AmplifyShaderEditor.SamplerNode;1;-564.5,27;Float;True;Property;_BumpMap;BumpMap;0;0;Create;True;None;None;True;0;False;bump;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.WorldNormalVector;2;-242.5,31;Float;False;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
Node;AmplifyShaderEditor.TemplateMasterNode;0;-39,30;Float;False;True;2;Float;ASEMaterialInspector;0;2;ASETemplateShaders/DefaultUnlit;6e114a916ca3e4b4bb51972669d463bf;ASETemplateShaders/DefaultUnlit;Off;2;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;0
WireConnection;2;0;1;0
WireConnection;0;0;2;0
ASEEND*/
//CHKSM=2081BFEFDF9F19EB744316F835B7B938165C958A