// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X 
Shader "StandardHSB"
{
	Properties
	{
		_Albedo("Albedo", 2D) = "white" {}
		_Metallic("Metallic", 2D) = "black" {}
		_HueShiftMask("Hue Shift Mask", 2D) = "white" {}
		_Hue("Hue", Range( 0 , 1)) = 0.1838896
		_Brightness("Brightness", Range( 0 , 1)) = 0.1838896
		_Saturation("Saturation", Range( 0 , 1)) = 0.1838896
		_BaseColor("Base Color", Color) = (0,0,0,0)
		[HideInInspector] _texcoord( "", 2D ) = "white" {}
		[HideInInspector] __dirty( "", Int ) = 1
	}

	SubShader
	{
		Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" }
		Cull Back
		CGPROGRAM
		#pragma target 3.0
		#pragma surface surf Standard keepalpha addshadow fullforwardshadows 
		struct Input
		{
			float2 uv_texcoord;
		};

		uniform float _Hue;
		uniform float4 _BaseColor;
		uniform float _Brightness;
		uniform float _Saturation;
		uniform sampler2D _HueShiftMask;
		uniform float4 _HueShiftMask_ST;
		uniform sampler2D _Albedo;
		uniform float4 _Albedo_ST;
		uniform sampler2D _Metallic;
		uniform float4 _Metallic_ST;


		float3 HSVToRGB( float3 c )
		{
			float4 K = float4( 1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0 );
			float3 p = abs( frac( c.xxx + K.xyz ) * 6.0 - K.www );
			return c.z * lerp( K.xxx, saturate( p - K.xxx ), c.y );
		}


		float3 RGBToHSV(float3 c)
		{
			float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
			float4 p = lerp( float4( c.bg, K.wz ), float4( c.gb, K.xy ), step( c.b, c.g ) );
			float4 q = lerp( float4( p.xyw, c.r ), float4( c.r, p.yzx ), step( p.x, c.r ) );
			float d = q.x - min( q.w, q.y );
			float e = 1.0e-10;
			return float3( abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
		}

		void surf( Input i , inout SurfaceOutputStandard o )
		{
			float3 hsvTorgb22 = RGBToHSV( _BaseColor.rgb );
			float3 hsvTorgb23 = HSVToRGB( float3(frac( ( _Hue + hsvTorgb22.x ) ),( saturate( ( ( _Brightness * -2.0 ) + 2.0 ) ) * ( _Saturation * hsvTorgb22.y ) ),( saturate( ( ( ( _Saturation * 0.5 ) + 0.5 ) * ( _Brightness * 2.0 ) ) ) * hsvTorgb22.z )) );
			float2 uv_HueShiftMask = i.uv_texcoord * _HueShiftMask_ST.xy + _HueShiftMask_ST.zw;
			float3 lerpResult17 = lerp( float3( 1,1,1 ) , hsvTorgb23 , tex2D( _HueShiftMask, uv_HueShiftMask ).r);
			float2 uv_Albedo = i.uv_texcoord * _Albedo_ST.xy + _Albedo_ST.zw;
			o.Albedo = ( float4( lerpResult17 , 0.0 ) * tex2D( _Albedo, uv_Albedo ) ).rgb;
			float2 uv_Metallic = i.uv_texcoord * _Metallic_ST.xy + _Metallic_ST.zw;
			float4 tex2DNode2 = tex2D( _Metallic, uv_Metallic );
			o.Metallic = tex2DNode2.r;
			o.Smoothness = tex2DNode2.a;
			o.Alpha = 1;
		}

		ENDCG
	}
	Fallback "Diffuse"
	CustomEditor "ASEMaterialInspector"
}
/*ASEBEGIN
Version=17704
310;73;1358;866;1716.336;2224.151;1.3;True;False
Node;AmplifyShaderEditor.RangedFloatNode;33;-2992.112,-1977.328;Inherit;False;Property;_Saturation;Saturation;5;0;Create;True;0;0;False;0;0.1838896;1;0;1;0;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;18;-2866.759,-1666.577;Inherit;False;Property;_Brightness;Brightness;4;0;Create;True;0;0;False;0;0.1838896;0.5;0;1;0;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;34;-2500.534,-1992.955;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;24;-2193.168,-1496.042;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0
Node;AmplifyShaderEditor.ColorNode;16;-3247.939,-906.8631;Inherit;False;Property;_BaseColor;Base Color;6;0;Create;True;0;0;False;0;0,0,0,0;1,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4
Node;AmplifyShaderEditor.SimpleAddOpNode;35;-2364.308,-1991.681;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;26;-1606.351,-1795.01;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;-2;False;1;FLOAT;0
Node;AmplifyShaderEditor.RangedFloatNode;7;-1350.986,-2052.209;Inherit;False;Property;_Hue;Hue;3;0;Create;True;0;0;False;0;0.1838896;0.12;0;1;0;1;FLOAT;0
Node;AmplifyShaderEditor.RGBToHSVNode;22;-2502.946,-1092.962;Inherit;False;1;0;FLOAT3;1,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;36;-1997.407,-1534.973;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleAddOpNode;27;-1453.993,-1803.674;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0
Node;AmplifyShaderEditor.SaturateNode;28;-1314.427,-1765.6;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;37;-1467.943,-1588.373;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SaturateNode;25;-1752.202,-1499.102;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleAddOpNode;31;-792.6593,-1742.866;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0
Node;AmplifyShaderEditor.FractNode;32;-657.5515,-1722.161;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;29;-852.332,-1098.698;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.SimpleMultiplyOpNode;30;-845.9149,-1356.56;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0
Node;AmplifyShaderEditor.HSVToRGBNode;23;-356.2728,-1399.751;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3
Node;AmplifyShaderEditor.SamplerNode;4;-7.558812,-829.1608;Inherit;True;Property;_HueShiftMask;Hue Shift Mask;2;0;Create;True;0;0;False;0;-1;None;110af7b4908d98744a0585e7b24e41c9;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.LerpOp;17;589.933,-1025.322;Inherit;False;3;0;FLOAT3;1,1,1;False;1;FLOAT3;1,1,1;False;2;FLOAT;0;False;1;FLOAT3;0
Node;AmplifyShaderEditor.SamplerNode;1;25.74623,-496.3041;Inherit;True;Property;_Albedo;Albedo;0;0;Create;True;0;0;False;0;-1;None;a855ea6e75d376a4c9d0b574455891fa;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.SamplerNode;2;606.5829,-395.9324;Inherit;True;Property;_Metallic;Metallic;1;0;Create;True;0;0;False;0;-1;None;e46d9a17617a1d14c984b2dd1868e419;True;0;False;black;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.SimpleMultiplyOpNode;15;865.3665,-780.3469;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0
Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;1295.449,-535.882;Float;False;True;-1;2;ASEMaterialInspector;0;0;Standard;StandardHSB;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;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;34;0;33;0
WireConnection;24;0;18;0
WireConnection;35;0;34;0
WireConnection;26;0;18;0
WireConnection;22;0;16;0
WireConnection;36;0;35;0
WireConnection;36;1;24;0
WireConnection;27;0;26;0
WireConnection;28;0;27;0
WireConnection;37;0;33;0
WireConnection;37;1;22;2
WireConnection;25;0;36;0
WireConnection;31;0;7;0
WireConnection;31;1;22;1
WireConnection;32;0;31;0
WireConnection;29;0;25;0
WireConnection;29;1;22;3
WireConnection;30;0;28;0
WireConnection;30;1;37;0
WireConnection;23;0;32;0
WireConnection;23;1;30;0
WireConnection;23;2;29;0
WireConnection;17;1;23;0
WireConnection;17;2;4;1
WireConnection;15;0;17;0
WireConnection;15;1;1;0
WireConnection;0;0;15;0
WireConnection;0;3;2;0
WireConnection;0;4;2;4
ASEEND*/
//CHKSM=793DBA78B49BB7A563C165421ECDB5DD3E535972