Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Unlit/Directional Tint"
{
Properties
{
_MainTex("MainTex", 2D) = "white" {}
_Color("Color", Color) = (1,1,1,1)
_ColorA("ColorA", Color) = (1,1,1,1)
_ColorB("ColorB", Color) = (1,1,1,1)
_ColorC("ColorC", Color) = (1,1,1,1)
[HideInInspector] _texcoord( "", 2D ) = "white" {}
[HideInInspector] __dirty( "", Int ) = 1
}
SubShader
{
Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" "IsEmissive" = "true" }
Cull Back
CGINCLUDE
#include "UnityPBSLighting.cginc"
#include "Lighting.cginc"
#pragma target 3.0
struct Input
{
float2 uv_texcoord;
float3 worldNormal;
};
uniform sampler2D _MainTex;
uniform float4 _MainTex_ST;
uniform float4 _Color;
uniform float4 _ColorA;
uniform float4 _ColorB;
uniform float4 _ColorC;
inline half4 LightingUnlit( SurfaceOutput s, half3 lightDir, half atten )
{
return half4 ( 0, 0, 0, s.Alpha );
}
void surf( Input i , inout SurfaceOutput o )
{
float2 uv_MainTex = i.uv_texcoord * _MainTex_ST.xy + _MainTex_ST.zw;
float3 ase_worldNormal = i.worldNormal;
float3 ase_normWorldNormal = normalize( ase_worldNormal );
float3 appendResult10 = (float3(( ase_normWorldNormal.x * ase_normWorldNormal.x ) , ( ase_normWorldNormal.y * ase_normWorldNormal.y ) , ( ase_normWorldNormal.z * ase_normWorldNormal.z )));
float4 temp_output_9_0 = ( _Color * _ColorA );
float3 layeredBlendVar13 = appendResult10;
float4 layeredBlend13 = ( lerp( lerp( lerp( temp_output_9_0 , ( _Color * _ColorB ) , layeredBlendVar13.x ) , temp_output_9_0 , layeredBlendVar13.y ) , ( _Color * _ColorC ) , layeredBlendVar13.z ) );
o.Emission = ( tex2D( _MainTex, uv_MainTex ) * layeredBlend13 ).rgb;
o.Alpha = 1;
}
ENDCG
CGPROGRAM
#pragma surface surf Unlit keepalpha fullforwardshadows
ENDCG
Pass
{
Name "ShadowCaster"
Tags{ "LightMode" = "ShadowCaster" }
ZWrite On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 3.0
#pragma multi_compile_shadowcaster
#pragma multi_compile UNITY_PASS_SHADOWCASTER
#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2
#include "HLSLSupport.cginc"
#if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )
#define CAN_SKIP_VPOS
#endif
#include "UnityCG.cginc"
#include "Lighting.cginc"
#include "UnityPBSLighting.cginc"
struct v2f
{
V2F_SHADOW_CASTER;
float2 customPack1 : TEXCOORD1;
float3 worldPos : TEXCOORD2;
float3 worldNormal : TEXCOORD3;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
v2f vert( appdata_full v )
{
v2f o;
UNITY_SETUP_INSTANCE_ID( v );
UNITY_INITIALIZE_OUTPUT( v2f, o );
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );
UNITY_TRANSFER_INSTANCE_ID( v, o );
Input customInputData;
float3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
half3 worldNormal = UnityObjectToWorldNormal( v.normal );
o.worldNormal = worldNormal;
o.customPack1.xy = customInputData.uv_texcoord;
o.customPack1.xy = v.texcoord;
o.worldPos = worldPos;
TRANSFER_SHADOW_CASTER_NORMALOFFSET( o )
return o;
}
half4 frag( v2f IN
#if !defined( CAN_SKIP_VPOS )
, UNITY_VPOS_TYPE vpos : VPOS
#endif
) : SV_Target
{
UNITY_SETUP_INSTANCE_ID( IN );
Input surfIN;
UNITY_INITIALIZE_OUTPUT( Input, surfIN );
surfIN.uv_texcoord = IN.customPack1.xy;
float3 worldPos = IN.worldPos;
half3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );
surfIN.worldNormal = IN.worldNormal;
SurfaceOutput o;
UNITY_INITIALIZE_OUTPUT( SurfaceOutput, o )
surf( surfIN, o );
#if defined( CAN_SKIP_VPOS )
float2 vpos = IN.pos;
#endif
SHADOW_CASTER_FRAGMENT( IN )
}
ENDCG
}
}
Fallback "Diffuse"
CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=18800
0;405;1616;623;2613.215;539.9244;1.484565;True;True
Node;AmplifyShaderEditor.WorldNormalVector;3;-1652.79,142.5352;Inherit;False;True;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;5;-1334.145,110.5352;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;6;-1334.62,218.6138;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;4;-1334.159,333.7232;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.ColorNode;8;-1985.963,-495.4834;Inherit;False;Property;_Color;Color;1;0;Create;False;0;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.ColorNode;15;-1993.453,-318.1729;Inherit;False;Property;_ColorA;ColorA;2;0;Create;True;0;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.ColorNode;16;-1986.728,-153.9374;Inherit;False;Property;_ColorB;ColorB;3;0;Create;False;0;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.ColorNode;17;-1992.666,15.30307;Inherit;False;Property;_ColorC;ColorC;4;0;Create;False;0;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.DynamicAppendNode;10;-1129.963,179.5168;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;9;-1355.537,-264.0898;Inherit;False;2;2;0;COLOR;1,1,1,0;False;1;COLOR;1,1,1,1;False;1;COLOR;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;12;-1354.9,-142.7483;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0.6320754,0.6320754,0.6320754,1;False;1;COLOR;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-1354.9,-45.28372;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0.4811321,0.4811321,0.4811321,1;False;1;COLOR;0
Node;AmplifyShaderEditor.SamplerNode;7;-890.2168,-399.0827;Inherit;True;Property;_MainTex;MainTex;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.LayeredBlendNode;13;-809.9631,-108.4832;Inherit;False;6;0;FLOAT3;0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;FLOAT;0;False;1;COLOR;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;14;-465.9862,-123.5176;Inherit;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;101.2507,-47.25032;Float;False;True;-1;2;ASEMaterialInspector;0;0;Unlit;Unlit/PSX Shader;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;14;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;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;15;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;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;5;0;3;1
WireConnection;5;1;3;1
WireConnection;6;0;3;2
WireConnection;6;1;3;2
WireConnection;4;0;3;3
WireConnection;4;1;3;3
WireConnection;10;0;5;0
WireConnection;10;1;6;0
WireConnection;10;2;4;0
WireConnection;9;0;8;0
WireConnection;9;1;15;0
WireConnection;12;0;8;0
WireConnection;12;1;16;0
WireConnection;11;0;8;0
WireConnection;11;1;17;0
WireConnection;13;0;10;0
WireConnection;13;1;9;0
WireConnection;13;2;12;0
WireConnection;13;3;9;0
WireConnection;13;4;11;0
WireConnection;14;0;7;0
WireConnection;14;1;13;0
WireConnection;0;2;14;0
ASEEND*/
//CHKSM=62FBB715FC082D97BD402F28E53DF700E7340C10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment