ピクセル ベンダー カーネル内の主な機能はループであり、カーネルによって評価されるピクセルごとに呼び出されます。これは、必要なことを正確に行う方法に関するチュートリアルへのリンクです(複数の入力を使用して作業する)。
http://www.adobe.com/devnet/pixelbender/articles/creating_effects_pt09.html#articlecontentAdobe_numberedheader
基本的には、2 つの入力を定義するだけです。
<languageVersion : 1.0;>
kernel blendy
< namespace : "com.adobe.devnet.pixelbender";
vendor : "Kevin's Filters";
version : 1;
description : "mashes two inputs together";
>
{
input image4 src; //Input image 1 as image4 (RGBA)
input image4 src2; //Input image 2 as image4 (RGBA)
output pixel4 dst; //Single pixel data type/represents single pixel value (RGBA)
void evaluatePixel()
{
dst = sampleNearest(src,outCoord());
}
}
sampleNearest の 2 つのパラメーターは、ソース イメージと、サンプリングするピクセルの座標であることに注意してください。outCoord() は単にループ内の現在のピクセルだと思います。前述のように、evaludatePixel (私の理解では) は、入力に存在するピクセルごとに 1 回呼び出されます。両方の入力の値を同時に読み取る上記のコード (リンクから) の修正版を次に示します。
<languageVersion : 1.0;>
kernel blendy
< namespace : "com.adobe.devnet.pixelbender";
vendor : "Kevin's Filters";
version : 1;
description : "mashes two inputs together";
>
{
input image4 src; //Input image 1 as image4 (RGBA)
input image4 src2; //Input image 2 as image4 (RGBA)
output pixel4 dst; //Output image
void evaluatePixel()
{
dst = sampleNearest(src2,outCoord()) + sampleNearest(src, outCoord());
}
}
ピクセルがどのように機能するかについて詳しく説明する 2 つのビデオ チュートリアルを次に示します。
http://gotoandlearn.com/play.php?id=83
http://gotoandlearn.com/play.php?id=84
http://www.gotoandlearn.com/play.php?id=95