3 Replies Latest reply on Dec 12, 2011 12:14 PM by AIF Bob

    pixel bender edges problem

    yossialush Level 1

      i'm trying to make simple light shader, here is my code:

       

      <languageVersion : 1.0;>

       

       

      kernel SimpleLight

      <   namespace : "Your Namespace";

          vendor : "Yossi";

          version : 1;

      >

       

      {

          input image4 src;

          output pixel4 dst;

       

       

          parameter float3 lightPosition

              <

                 defaultValue: float3(0,0,-100);

              >;

       

          void

          evaluatePixel()

          {

              pixel4 pixel = sampleNearest(src,outCoord());

              float3 Normal = float3(0.0,0.0,-1.0);

       

              float3 pixelPos = float3(0.0,0.0,0.0);

              float3 Kd = float3(pixel.r,pixel.g,pixel.b);

              float3 lightDir = lightPosition - pixelPos;

              float diffuse = dot(Normal,normalize(lightDir)); 

              float3 res = Kd * (diffuse + specular);

              dst = pixel4(res.x,res.y,res.z,pixel.a);

          }

      }

       

      now here is the source image:

       

      http://tinypic.com/view.php?pic=2w3nw2q&s=5

       

      and here is the resault:

       

      http://tinypic.com/r/245bxtv/5

       

      instead of getting clean pic i get this thin white line on the right.

      when i run it on "GPU" or "CPU" it's ok, but on "FLASH" i get this.

      can anyone explane how to solve it?

       

      thank you.

        • 1. Re: pixel bender edges problem
          unique_screenname_here Level 3

          Please provide a working version of your filter. Thanks.

          • 2. Re: pixel bender edges problem
            yossialush Level 1

            i'm very sorry here is the code (working) :

             

            <languageVersion : 1.0;>

             

             

            kernel SimpleLight

            <   namespace : "Your Namespace";

                vendor : "Yossi";

                version : 1;

            >

             

            {

                input image4 src;

                output pixel4 dst;

             

             

                parameter float3 lightPosition

                    <

                       defaultValue: float3(0,0,-100);

                    >;

             

                void

                evaluatePixel()

                {

                    pixel4 pixel = sampleNearest(src,outCoord());

                    float3 Normal = float3(0.0,0.0,-1.0);

             

                    float3 pixelPos = float3(0.0,0.0,0.0);

                    float3 Kd = float3(pixel.r,pixel.g,pixel.b);

                    float3 lightDir = lightPosition - pixelPos;

                    float diffuse = dot(Normal,normalize(lightDir));

                    float3 res = Kd * (diffuse);

                    dst = pixel4(res.x,res.y,res.z,pixel.a);

                }

            }

            • 3. Re: pixel bender edges problem
              AIF Bob Level 3

              I think that the white line is simply part of the background to the image - does the output exactly match the size of the input?

               

              Bob