Skip navigation
Currently Being Moderated

Alpha channel of BitmapData can not be used by pb3d?

Nov 2, 2011 12:56 AM

when you call setPixel32 of bitmapdata




the real data stored is    a  a/255*r  a/255*g  a/255*b


so you can set rgb data by this  setPixel32(x,y,0xff_r_g_b),

and setPixel(x,y,rgb)==setPixel32(x,y,0xff_r_g_b)


but if i want this  setPixel32(x,y,0x000f0f0f) , and use it as a texture ;


the shader will get the value 0  not  0x000f0f0f



Is there a way to store any uint value into BitmapData?

  • Currently Being Moderated
    Nov 3, 2011 10:44 AM   in reply to chh03

    Can you post the ActionScript code that you're using to set up the image as well as the Pixelbender code that you're trying to use to read it. The alpha channel should be passed through correctly, although you need to take into account that the uint values in Flash will be converted to float values in PixelBender.



    Mark as:
  • Currently Being Moderated
    Dec 12, 2011 3:42 PM   in reply to chh03

    I think I understand what's happening, and I don't think there's a way of fixing it. As you've noticed, the alpha value affects the rgb values so it's not possible to set four entirely independent values and have them passed through. That's a legacy of Pixel Bender's roots in image processing. I'm sorry, but Ithink you're going to have to find a different way of encoding the data to pass to PB.



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points