1 Reply Latest reply on Nov 4, 2010 11:51 PM by tkalayci

    sketch shader?

    lreadl Level 1

      Does anyone know of a pixel bender shader for making an image look like it was sketched with paper-and-pencil, or chalk-and-charcoal, or crayon, etc?  Photoshop has filters like that, but I haven't found any for pixel bender.

        • 1. Re: sketch shader?
          tkalayci

          Hi,

          We recently worked on an image effects software and used an algorithm similar to the following for sketch conversion:

           

              evaluatePixel()
              {
                  float4 colorAccumulator = float4(0.0, 0.0, 0.0, 0.0);     
                  float2 singlePixel = pixelSize(src);
                  colorAccumulator += sampleNearest(src, outCoord() + float2(-singlePixel.x, 0.0));
                  colorAccumulator += sampleNearest(src, outCoord() + float2(singlePixel.x, 0.0));
                  colorAccumulator += sampleNearest(src, outCoord() + float2(0.0, -singlePixel.y));
                  colorAccumulator += sampleNearest(src, outCoord() + float2(0.0, singlePixel.y));
                  colorAccumulator -= sampleNearest(src, outCoord());
                  colorAccumulator -= sampleNearest(src, outCoord());
                  colorAccumulator -= sampleNearest(src, outCoord());
                  colorAccumulator -= sampleNearest(src, outCoord());
                  colorAccumulator *= 5.0;
                  colorAccumulator = clamp (colorAccumulator,0.0,1.0);
                  colorAccumulator = 1.0 - colorAccumulator;
                  colorAccumulator *= colorAccumulator;
                  dst =  colorAccumulator;
              }

           

          This script can be compiled with Pixel Bender Toolkit 2 (which I'm not experienced with so it's hardly optimized).

          Best,

          Tolga KALAYCI

          www.buraks.com