Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthorsandersnake
    • CommentTimeSep 16th 2008 edited
     
    In the examples I created over here I used 3 seperated Renderers for Red, Green and Blue.


    Adding a Blendmode ("add") to the renderer give's the nice colorfull effect.

    Downside for the colorfull effect is that i have to use 3 seperated renderers?
    Or is there a way giving a blendmode to an emitter?

    Here's the source code of 1 example


    package {
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.MouseEvent;
    import flash.filters.BlurFilter;
    import flash.geom.Rectangle;
    import flash.net.URLRequest;
    import flash.text.TextField;
    import flash.text.TextFormat;

    import org.flintparticles.common.actions.*;
    import org.flintparticles.common.counters.*;
    import org.flintparticles.common.displayObjects.*;
    import org.flintparticles.common.initializers.*;
    import org.flintparticles.threeD.actions.*;
    import org.flintparticles.threeD.emitters.Emitter3D;
    import org.flintparticles.threeD.geom.Vector3D;
    import org.flintparticles.threeD.initializers.*;
    import org.flintparticles.threeD.renderers.*;
    import org.flintparticles.threeD.renderers.controllers.*;
    import org.flintparticles.threeD.zones.*;

    public class RGBBlendDisc1 extends Sprite {
    private var w:uint = 400;
    private var h:uint = 400;
    private var amount:uint = 200;
    private var text:TextField;
    private var loader:Loader;

    public function RGBBlendDisc1(){
    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align = StageAlign.TOP_LEFT;

    createDisc(0xffff0000, 0xffffcc33, new Vector3D(0, 0, 0), new Vector3D(1, 0, 0));
    createDisc(0xff00ff00, 0xff33ffcc, new Vector3D(0, 0, 0), new Vector3D(0, 1, 0));
    createDisc(0xff0000ff, 0xffcc33ff, new Vector3D(0, 0, 0), new Vector3D(0, 0, 1));
    }

    private function createDisc(color1:uint, color2:uint, point1:Vector3D, point2:Vector3D):void {
    var emitter:Emitter3D = new Emitter3D();
    emitter.counter = new Blast( amount );

    emitter.addInitializer( new SharedImage( new Dot( 1 ) ) );
    emitter.addInitializer( new Position( new DiscZone(point1, point2, 100, 100 ) ) );
    emitter.addInitializer( new ColorInit( color1, color2) );
    emitter.addAction( new Move() );
    emitter.addAction( new GravityWell(5, new Vector3D(0, 0, 0) ) );

    var renderer:PixelRenderer = new PixelRenderer( new Rectangle( -200, -200, 400, 400 ), false );
    renderer.camera.dolly( -300 );
    renderer.camera.lift( 100 );
    renderer.camera.target = new Vector3D( 0, 0, 0 );
    renderer.camera.orbit(45 * Math.PI / 180);
    renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
    //renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.99,0 ] ) );
    renderer.addEmitter( emitter );
    renderer.x = w/2;
    renderer.y = h/2;
    renderer.blendMode = "add";
    addChild( renderer );

    emitter.position = new Vector3D( 0, 0, 0, 1 );
    emitter.start( );

    var orbitter:OrbitCamera = new OrbitCamera( stage, renderer.camera );
    orbitter.start();
    }
    }
    }
    • CommentAuthorRichard
    • CommentTimeSep 16th 2008 edited
     
    These examples are looking great. Have you found any bugs yet, or is it all working fine?

    Re: blendMode. Flash applies blend modes to display objects, so to separately apply blendModes to each emitter's output they have to use different display objects, hence needing a new renderer for each emitter.

    If you use display objects rather than pixels for the particles, you can apply a blend mode to each particle's image and it will be used when drawing the particle, but this means you can't use a pixel renderer - you have to use a bitmap renderer or display object renderer and use a display object of some form for each particle.

    I haven't created an initializer to do this, but probably will at some point. I am currently concentrating on the away3d and papervision3d renderers.
  1.  
    I think i just found one little bug with the explosion action.
    You have to fill in a very large number to get a bit of an explosion


    //emitter.addAction( new Explosion( 10000, new Vector3D(0, 0, 0)));


    Thanks for clearing out the blending mode stuff.
    If i have some time i'll dive into it.

    Good luck with the papervision3d renderers, really looking forward to it!
    • CommentAuthorRichard
    • CommentTimeSep 20th 2008
     
    I've fixed the explosion thing in Alpha 2 - An explosion of power 1 should have a visible effect now.