July 21st, 2008
I fell in love with DisplacementMapFilter as it first time appeared in Flash 8. All tree demos you see here are remakes of some old AS2 experiments; in AS3 performance should not be such issue - actually the only performance test I took was when I displaced 800×600 bitmap with itself back in AS2 and that was a limit that time; here we use AS3 and we are using much smaller maps.
My tips:
- I always use red channel when dealing with artificial displacement maps (DisplacementMapFilter.componentX = BitmapDataChannel.RED). The neutral color is then 0×800000 (R:128, G:0, B:0), any brighter or darker (red) color will affect the filter.
- To apply filter temporary (you can remove or change it later) pass it to the ‘filters’ array of any DisplayObject, to apply it permanently use applyFilter method of appropriate BitmapData object.
Wave (ripple) displacement effect
The idea is very simple, I draw wave like gradient, then scale it and apply it as a displacement filter. I hope someone will create more realistic gradient and send me a link :). In top left corner you can see preview of the displacement map - the fill color is neutral (0×800000) and the wave is using full red to black gradient.
read more
May 19th, 2008
![Cylinder radial segment primitive object for Papervision3D]()
For my latest project I needed to display 3D cylinder slices - Papervision was an obvious choice. Unfortunately the primitive cylinder class does not work this way, the cylinder is built as a square mesh with no option for segment slices. So I had to help myself, I started to play with the almost undocumented PV3D primitives, step by step modifying the original cylinder class and after couple hours I dig out what is what and derived my RadialSegment class. It follows the original concept with one material for whole object, supports UV mapping and inherit all other properties. Here it is, use it as you wish.

Code and live example in full article
read more