Disable alpha interpolation in render ?

  • ypuech

    ypuech - 2007-10-02

    Hi all,

    How to disable alpha interpolation ?

    I want to have just 0 or 255 as alpha value in the resulting tif image of a render. How to setup the render to do that ?
    ShadingInterpolation, PixelFilter ??
    Or do i need to post-process the render ?

    Yannick Puech

    • George Harker

      George Harker - 2007-10-02

      Hi Yannick,

      If I understand correctly,

      Display "filename.tif" "file" "rgba"

      should do the trick.

      You'll get an rgba image with the alpha in it.  You could also render out the alpha to a separate file

      Display "+additionalfilename.tif" "file" "a"

      You can also specify quantization on the display line

      Display "filename.tif" "file" "a" "float[4] quantize" [zeroval oneval minval maxval]



    • ypuech

      ypuech - 2007-10-02

      Thanks for the quick answer George.

      I think I have to use quantize(?) because I want to have only alpha value equals to 0 or 255. Not 12, 127, 223 etc. that is resulting from anti-aliasing. Setting PixelSamples 1 1, alpha values are only 0 or 255 but using PixelSamples 2 2 they are interpolated. Can I prevent that using quantize ?

      Yannick Puech

      • Moritz Moeller

        Moritz Moeller - 2007-10-02

        I think you want

          Quantize "a" 1 0 1 0

        This will give you a 1 bit alpha. You can't get a 0- and 255-only 8 bit alpha unless you swith pixel filtering off by setting PixelFilter "box" 1 1 and make sure you don't have any semiopaque primitives.
        Probably easier & better (since your color is still nicely pixel-filtered) to promote the 1 bit alpha up to 8 bits after rendering is finsihed, using an imaging application.
        Note that I switched of dithering in above statement -- this will give you 'nicer' edges on a 1 bit image.

        You can also use:

          DisplayChannel "rgb" "quantize" [ 0 255 0 255 ] "dither" [ 0.5 ]
          DisplayChannel "a" "quantize" [ 0 1 0 1 ] "dither" [ 0 ]
          Display "foo.tif" "rgb,a"

        Haven't tested this though.

        Also see this page: http://www.dotcsw.com/doc/quantize.html


        • ypuech

          ypuech - 2007-10-02

          Thanks for the answer Moritz. Ill' try this solution.

          Yannick Puech

    • ypuech

      ypuech - 2007-10-03

      In fact I only need the Z buffer data not the alpha. How to ouput a file with Z buffer information ?
      It seems Pixie does not support zfile but tsm or other formats (tx?). I'm a bit confused with shadow and other display configurations.
      And as I have to parse this file, how the file is built ? chunks, float data etc.

      Yannick Puech

      • George Harker

        George Harker - 2007-10-03

        You can output z using

          Display "+file.tif" "file" "z"

        Which is different to doing

          Display "+file.tx" "shadow" "z"

        which premakes a pixie shadowmap.

        The file is in standard tiff format, and can be read with libtiff, the data is float by default.



    • ypuech

      ypuech - 2007-10-03

      Thanks for the answer George.
      I can read this file and get the z depth float values as expected.

      Yannick Puech


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks