#ifndef _GRADIENTDISSOLVE #define _GRADIENTDISSOLVE void GradientedDissolve_float( UnityTexture2D NoiseTexture, UnityTexture2D GUITexture, UnitySamplerState NoiseSS, half2 UV, float noiseScale, half NoisePow, half Width, half Th, out half4 _out ) { half noise = SAMPLE_TEXTURE2D(NoiseTexture, NoiseSS, UV * noiseScale).r; noise = pow(noise, NoisePow); //noise = noise * (1-UV.x); //Th = 1; noise += Th; _out = 0; half4 guiSample = SAMPLE_TEXTURE2D_LOD(GUITexture, NoiseSS, UV, 0); if (noise >= 1) { noise = 1.0; _out = guiSample; //if ((noise + Th Width ) >= 1.0) //{ //} //_out = half4(1,1,1,1); } else if ((noise + Width ) >= 1.0) { half4 guiSampleLow = SAMPLE_TEXTURE2D_LOD(GUITexture, NoiseSS, UV, 3); noise = (noise + Width - 1.0)/Width; _out = lerp(guiSampleLow, guiSampleLow, noise); //_out = half4(0,0,0,noise); } _out.a *= saturate(noise) * pow(Th, 0.3); } #endif