1 Reply Latest reply on Sep 28, 2009 10:13 PM by souldreamer

    Affect Pixels Bolow 0.0 only

    JorritS Level 1

      hi, im am working on this Quite simple Plugin, but now i ran into This Problem

       

      i have this High contrast filter, but i only want the Bright pixels to get higher the dark pixels of "AP" to be 0

      Here's the code:

       

      {
              parameter float Amount
          <
              minValue:1.0;
              maxValue:10.0;
              defaultValue:1.0;
              aeUIControl:"aeSlider";
              aeDisplayName: "Amount (1.0=)";
          >;
          
          input image4 src;
          output pixel4 dst;
      
          void
          evaluatePixel()
          {
              pixel4 OP = sampleNearest(src,outCoord());
              
              pixel4 AP = sampleNearest(src,outCoord());
              AP.rgb = (AP.rgb - 0.75)/(1.0 - 0.75);
              
              dst = OP + (AP*(Amount - 1.0));
      }
      
      
      

       

      so i basicly need the pixels from "AP" that are lower than 0.0 to be 0.0

       

      Thanks in Advanced

        • 1. Re: Affect Pixels Bolow 0.0 only
          souldreamer

          Just use

           

          float lessThan0 = 1.0 - float(any(lessThan(float3_vector_here, float3(0.0, 0.0, 0.0))));

           

          Though it's kind of rough like this, so some smoothing should be implemented.

           

          If I understood what you wanted correctly, then the change to your code would be to replace the dst = OP+... line with:

           

                  float lessThan0 = 1.0 - float(any(lessThan(AP.rgb, float3(0.0, 0.0, 0.0))));

                  float4 Add = AP*(Amount - 1.0)*lessThan0; Add.a = AP.a;

                  dst = OP+Add;