float xll_saturate(float x) { return clamp(x, 0.0, 1.0); } vec3 xll_saturate(vec3 x) { return clamp(x, 0.0, 1.0); } uniform sampler2D _MainTex; uniform sampler2D _BurntTex; uniform mediump float _EmberFadeEnd; uniform mediump float _EmberFadeStart; lowp vec4 frag (mediump vec2 uv) { lowp vec3 base = texture2D(_MainTex, uv).xyz; lowp vec3 burn = texture2D(_BurntTex, uv).xyz; lowp vec3 t; t = vec3( xll_saturate( ((_EmberFadeStart - 0.05) / (_EmberFadeStart - _EmberFadeEnd)) ) ); return vec4(mix(base, burn, t), 1.0); } varying mediump vec2 xlv_TEXCOORD0; void main() { gl_FragColor = frag(xlv_TEXCOORD0); }