1 Reply Latest reply on Mar 2, 2010 9:47 AM by PankajN

    Filter error

    jeff_vrenois

      Hi, I´m just learning and developing my first filter for After Effects I found something really weird.

       

      I´m just making an easy zoom in and zoom out effect using 2 imput images, it seems to work OK in Pixel Bender.

       

      this is my code:

       

      <languageVersion : 1.0;>

       

      kernel TwoImagesZooming
      <   namespace : "blablabla";
          vendor : "Meh";
          version : 1;
          description : "zoom in zoom out with 2 images";
          displayname : "Pixel Displacement Complex";
          category : "AE filter category";
      >
      {
          input image4 src;
          input image4 src2;
          output pixel4 dst;
         
         
          parameter float ZoomA
          <
          minValue:0.0;
          maxValue:1.0;
          defaultValue:1.0;
          >;
          parameter float ZoomB
          <
          minValue:0.0;
          maxValue:1.0;
          defaultValue:0.0;
          >;

       

          void
          evaluatePixel()
          {
              pixel4 dst2 = sampleNearest(src,outCoord()/float2(DisplacementA, DisplacementA));
              pixel4 dst3 = sampleNearest(src2,outCoord()/float2(DisplacementB, DisplacementB));
              dst=dst2+dst3;
          }
      }

       

      but when I taste it in AE (CS4 by the way), it shows me these error:

       

      Picture 1.png

       

      Can Somebody help me to find whats going on....Please

        • 1. Re: Filter error
          PankajN Adobe Employee

          Hi,

           

          The error gives a hint what might be going on.

           

          In below two calls you are diving outCoord() with DisplacementA & DisplacementB. If any of them is zero, you will get "division by zero" error.

           

          pixel4 dst2 = sampleNearest(src,outCoord()/float2(DisplacementA, DisplacementA));

          pixel4 dst3 = sampleNearest(src2,outCoord()/float2(DisplacementB, DisplacementB));

           

          To fix it, you should make sure values of DisplacementA & DisplacementB are never zero. There are several ways of doing that: either you can set minValue of those parameters to be greater than zero or you can do things differently if their value is zero.

           

          Hope that helps.