#ifndef HLSLTOON_CHANGETEX
#define HLSLTOON_CHANGETEX

	#ifdef _Change
	uniform sampler2D _ChangeTex;
	uniform sampler2D _ChangeRamp;
	uniform sampler2D _Noise;
	uniform half4 _EdgeColor;
	uniform half _ChangeRange;
	uniform half _EdgeWidth;
	uniform half _StartPoint;
	uniform half2 _NoiseT;
	half4 ChangeTex(half4 c,sampler2D Tex,half2 uv,half2 Noiseuv, half WPos,half4 EdgeColor)
	{
		half4 ChangeTex = tex2D(Tex, uv);
		half3 center = unity_ObjectToWorld._14_24_34;
		half Noise = tex2D(_Noise, Noiseuv*_NoiseT.xy).r;
		half ChangeRange = 1-saturate(abs(WPos-center.y-_StartPoint)-_ChangeRange);
		_EdgeWidth *= 1-step(0.99,ChangeRange);
		ChangeTex += lerp(EdgeColor,0,step(_EdgeWidth,(ChangeRange+Noise)));
		half range = step(0.7,(ChangeRange+Noise))*ChangeRange;
		c = lerp(c, ChangeTex, range);
		return c;
	}
	#endif
#endif

