2012-08-07 54 views
1

我試圖用Pixel Bender着色器添加混合圖像的邊緣,但我無法完全弄清楚如何檢測邊緣本身。我試過這個,但它不工作:添加劑將圖像的邊緣與Pixel Bender混合

{ 
input image4 src; 
output pixel4 dst; 

void 
evaluatePixel() 
{ 
    if(outCoord().x == 0.0) 
    { 
     dst = sampleNearest(src, outCoord()); 
     dst.rgb = float3(255.0, 255.0, 255.0); // just a test to see if the left side will turn white 
    } 
    else 
    { 
     dst = sampleNearest(src, outCoord()); 
    } 
} 
} 

我不知道如何去檢測圖像的寬度和高度。

我試圖通過將前幾個像素加在一起來使圖像「發光」在邊緣周圍。 x:0將是1-4混合,2將是2-4混合,3將是3-4混合類型的東西。

一些指導?

回答

0

我認爲只有通過寬度和高度作爲來自as3的着色器參數的方式...