kernel NewFilter < namespace : "Your Namespace"; vendor : "Your Vendor"; version : 1; description : "your description"; > { input image4 frontImage; input image4 backImage; output pixel4 dst; parameter float tolerance < minValue:float(0.0); maxValue:float(0.1); >; void evaluatePixel() { float4 frontPixel = sampleNearest(frontImage, outCoord()); float4 backPixel = sampleNearest(backImage, outCoord()); float redDistance = frontPixel.r - backPixel.r; redDistance = abs( redDistance ); float greenDistance = frontPixel.g - backPixel.g; greenDistance = abs( greenDistance ); float blueDistance = frontPixel.b - backPixel.b; blueDistance = abs( blueDistance ); if ( ( ( redDistance + greenDistance + blueDistance ) / 3.0 ) > tolerance ) { dst = frontPixel; } else { dst = pixel4(0,0,0,0); } } }