3 Replies Latest reply on Apr 5, 2011 2:38 PM by AIF Bob

    Pixel Size bug with multiple inputs

    Christian Lett Level 3

      Hi,

       

      As part of a bigger project I've written a simple kernel to take one image (with alpha) and composite it over a second image.

       

      I'm testing it using images with different pixel aspect ratios. For example input image 1 has square pixels (1050x576), input image 2 has non-square (720x576 @ 1.46 PAR).

       

      In order to sample the second image properly I need to divide the current coordinate by the pixelSize of the background (which should be float2(1.46, 1.0))

       

      kernel Over

      <   namespace : "quarterlightpictures.com";

          vendor : "Quarterlight Pictures";

          version : 1;

      >

      {

          input image4 fg;

          input image4 bg;

          output pixel4 dst;

       

          void evaluatePixel() {

              float2 coord = outCoord();

       

              pixel4 pFG = sampleNearest(fg, coord);

              pixel4 pBG = sampleLinear(bg, coord / pixelSize(bg));

       

              dst = pFG + pBG * pBG.a * (1.0 - pFG.a);

          }

      }

      This doesn't work, because for some reason the pixel size for the bg image is considered to be (1.0, 1.0).

       

      Am I missing something obvious, or is this a bug?

       

      I'm testing this in After Effects CS5, by the way.

       

      Thanks,

       

      Christian