views:

238

answers:

1

According to the pixel bender specs a shader can have one or more outputs. The pixel bender toolkit, whose "export to flash" option tends to be preety strict about the flash specific do's and dont's, would even compile such a shader without complaints.

However actionscript's shader related classes seem to be geared toward single output shaders. Is there any way to have multiple shader outputs in flash?

+1  A: 

There are some workarounds, listed from easiest to hardest.

1) Use different channels (if you have grey-scale outputs)

2) Double the output width, then do copyRect on the bitmapData to separate them. (assuming that's what you're using)

3) I haven't tried this yet, but it shows some promise, and is the closest to what you want: Use pixel bender assembler to specify two outputs. More info is here: http://www.adobe.com/devnet/flex/articles/flashbuilder4_pixelbender_06.html http://www.ncannasse.fr/projects/pbj (Haxe-specific, but has useful general info)

DarthShader