uniform sampler2D VisibleUnit; uniform sampler2D InfraRedUnit; uniform sampler2D WaterVaporUnit; uniform float Visible; uniform float InfraRed; uniform float WaterVapor; uniform float VisibleThreshold; uniform float InfraRedThreshold; uniform float WaterVaporThreshold; uniform float Brightness; void main() { vec3 visibleColor = texture2D( VisibleUnit, gl_TexCoord[0].st ).rgb; vec3 infraredColor = texture2D( InfraRedUnit, gl_TexCoord[0].st ).rgb; infraredColor = vec3(1.,1.,1.) - infraredColor; vec3 watervaporColor = texture2D( WaterVaporUnit, gl_TexCoord[0].st ).rgb; // float visibleLum = dot( visibleColor, Coefs ); // float infraredLum = dot( infraredColor, Coefs ); // float watervaporLum = dot( watervaporColor, Coefs ); // vec3 weights = vec3( Visible, InfraRed, WaterVapor ); // vec3 lums = vec3( visibleLum, infraredLum, watervaporLum ); // float t = clamp( dot( weights, lums ), 0., 1. ); // vec3 rgb = Rainbow( t ); vec3 rgb; if( visibleColor.r - visibleColor.g > .25 && visibleColor.r - visibleColor.b > .25 ) { rgb = vec3( 1., 1., 0. ); // state outlines become yellow } else { rgb = Visible*visibleColor + InfraRed*infraredColor + WaterVapor*watervaporColor; rgb /= 3.; vec3 coefs = vec3( 0.296, 0.240, 0.464 ); float visibleInten = dot(coefs,visibleColor); float infraredInten = dot(coefs,infraredColor); float watervaporInten = dot(coefs,watervaporColor); if( visibleInten > VisibleThreshold && infraredInten < InfraRedThreshold && watervaporInten > WaterVaporThreshold ) { rgb = vec3( 0., 1., 0. ); } else { rgb *= Brightness; rgb = clamp( rgb, 0., 1. ); } } gl_FragColor = vec4( rgb, 1. ); }