PerlinNoiseEffect for PV3D
写了个PerlinNoiseEffect类,但效率很差,对于较大的bitmapData运行起来会比较累。
Code:
scene.addChild(dae);
var bfx:BitmapEffectLayer = new BitmapEffectLayer(viewport, viewportWidth, viewportHeight, true, 0, BitmapClearMode.CLEAR_PRE, false, false);
viewport.containerSprite.addLayer(bfx);
bfx.addDisplayObject3D(dae, true);
bfx.blendMode = BlendMode.ADD;
var perlinNoise_bmd:BitmapData = new BitmapData(bfx.width, bfx.height);
bfx.addEffect(new PerlinNoiseEffect(perlinNoise_bmd, new DisplacementMapFilter(perlinNoise_bmd, new Point(), 1, 1, 2, 3, DisplacementMapFilterMode.COLOR), 10, 15, 1));
bfx.addEffect(new BitmapColorEffect(1, .9, .85, .95));
var bfx:BitmapEffectLayer = new BitmapEffectLayer(viewport, viewportWidth, viewportHeight, true, 0, BitmapClearMode.CLEAR_PRE, false, false);
viewport.containerSprite.addLayer(bfx);
bfx.addDisplayObject3D(dae, true);
bfx.blendMode = BlendMode.ADD;
var perlinNoise_bmd:BitmapData = new BitmapData(bfx.width, bfx.height);
bfx.addEffect(new PerlinNoiseEffect(perlinNoise_bmd, new DisplacementMapFilter(perlinNoise_bmd, new Point(), 1, 1, 2, 3, DisplacementMapFilterMode.COLOR), 10, 15, 1));
bfx.addEffect(new BitmapColorEffect(1, .9, .85, .95));
Download:PerlinNoiseEffect.as