kernel DisplacementMap < namespace : "sk.yoz"; vendor : "Yoz"; version : 1; description : "Displacement by bitmap map"; > { input image4 src; input image1 map; output pixel4 dst; parameter float dx < minValue: float(-1000.0); maxValue: float(1000.0); defaultValue: float(0.0); description: "The amount of displacement on x axis."; >; parameter float dy < minValue: float(-1000.0); maxValue: float(1000.0); defaultValue: float(0.0); description: "The amount of displacement on y axis."; >; void evaluatePixel() { float2 pos = outCoord(); float amount = sampleLinear(map, pos); float2 displacedPos = float2( pos.x + dx * amount, pos.y + dy * amount); dst = sampleLinear(src, displacedPos); } }