Perlin
Perlin is a modifier that displaces vertices based on color values within a perlin noise bitmap.
Example
Instructions
- Import stack, modifier, 3D engine library
import com.as3dmod.ModifierStack; import com.as3dmod.modifiers.Perlin; import com.as3dmod.plugins.pv3d.LibraryPv3d;
- Declare
private var stack :ModifierStack;
- Initialize
stack = new ModifierStack(lib3d, mesh);
Parameter Default Description lib3d NONE 3D engine library mesh NONE 3D object - Add
stack.addModifier(new Perlin(f, n, a));
Parameter Default Description f 1 force perlin noise n null source instance a true offset each apply - Apply
stack.apply();
Code
package { import com.as3dmod.ModifierStack; import com.as3dmod.modifiers.Perlin; import com.as3dmod.plugins.pv3d.LibraryPv3d; import flash.events.Event; import org.papervision3d.materials.WireframeMaterial; import org.papervision3d.objects.primitives.Plane; import org.papervision3d.view.BasicView; public class AS3DmodPerlin extends BasicView { private var object :Plane; private var stack :ModifierStack; public function AS3DmodPerlin() { super(); var material :WireframeMaterial = new WireframeMaterial(0x000000); material.doubleSided = true; object = new Plane(material, 500, 500, 10, 10); scene.addChild(object); stack = new ModifierStack(new LibraryPv3d(), object); stack.addModifier(new Perlin(20)); startRendering(); } protected override function onRenderTick(e:Event=null):void { stack.apply(); super.onRenderTick(e); } } }