Switching from Planes to Sprite3D in Away3DLite seems to have given me
some pretty dramatic speed increases. Since my particles don't have to
rotate this is a nice boost. Below is my updated quick 'n dirty test:
*** Away3DLite 1.0 ***
package
{
import away3dlite.containers.Scene3D;
import away3dlite.containers.View3D;
import away3dlite.primitives.Plane;
import away3dlite.sprites.Sprite3D;
import com.greensock.TweenLite;
import com.gskinner.utils.Rnd;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.utils.Timer;
import net.hires.debug.Stats;
[SWF(width="800", height="600", frameRate="24")]
public class Main extends Sprite
{
protected var _view : View3D;
protected var _timer : Timer;
public function Main()
{
_createView();
_createScene();
_createCamera();
}
protected function _createView() : void
{
// Create view and add it to the stage
_view = new View3D();
addChild(_view);
//Relocate center point of view to the center of an
800x600 stage.
_view.x = 400;
_view.y = 300;
//call the view render method on every frame of the
Flash movie
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
}
protected function _createScene() : void
{
// Create a new scene containing a trident and two cubes
var scene : Scene3D = new Scene3D();
var l:int = 1000;
for(var i:int = 0; i<l; ++i)
{
var particle:Sprite3D = new Sprite3D();
particle.width = 8;
particle.height = 8;
particle.x = Rnd.sign()*(400*Math.random());
particle.y = Rnd.sign()*(300*Math.random());
scene.addSprite(particle);
}
//Assign the new scene to the view
_view.scene = scene;
addChild(new Stats());
_timer = new Timer(50);
_timer.addEventListener(TimerEvent.TIMER, _onTick);
_timer.start();
}
protected function _createCamera() : void
{
}
protected function _onEnterFrame(ev : Event) : void
{
_view.render();
}
protected function _onTick(ev : Event) : void
{
TweenLite.to(_view.scene.sprites[int(499*Math.random())], 1,
{x:Rnd.sign()*(400*Math.random()), y:
Rnd.sign()*(300*Math.random())});
TweenLite.to(_view.scene.sprites[int(499*Math.random())], 1,
{x:Rnd.sign()*(400*Math.random()), y:
Rnd.sign()*(300*Math.random())});
TweenLite.to(_view.scene.sprites[int(499*Math.random())], 1,
{x:Rnd.sign()*(400*Math.random()), y:
Rnd.sign()*(300*Math.random())});
TweenLite.to(_view.scene.sprites[int(499*Math.random())], 1,
{x:Rnd.sign()*(400*Math.random()), y:
Rnd.sign()*(300*Math.random())});
}
}
}
On Jun 13, 1:45 pm, inchworm <[email protected]> wrote:
> I did a quick and dirty test today to compare Away3DLite to Away3D
> 3.5. I found that with 500 planes tweening in small groups the
> difference between the two libs was pretty small. Away3D 3.5 ran at
> about 18/24fps and Away3DLite ran at about 20/24fps. I'll post the
> code that I used for each test. I'm wondering if there are things that
> I can do to make everything run faster and push more polys.
>
> *** AWAY 3D 3.5 ***
>
> package
> {
> import away3d.containers.Scene3D;
> import away3d.containers.View3D;
> import away3d.materials.ColorMaterial;
> import away3d.primitives.Plane;
>
> import com.greensock.TweenLite;
> import com.gskinner.utils.Rnd;
>
> import flash.display.Sprite;
> import flash.events.Event;
> import flash.events.TimerEvent;
> import flash.utils.Timer;
>
> import net.hires.debug.Stats;
>
> [SWF(width="800", height="600", frameRate="24")]
>
> public class Main extends Sprite
> {
> protected var _view : View3D;
> protected var _timer : Timer;
>
> public function Main()
> {
> _createView();
> _createScene();
> _createCamera();
> }
>
> protected function _createView() : void
> {
> // Create view and add it to the stage
> _view = new View3D();
> addChild(_view);
>
> //Relocate center point of view to the center of an
> 800x600 stage.
> _view.x = 400;
> _view.y = 300;
>
> //call the view render method on every frame of the
> Flash movie
> addEventListener(Event.ENTER_FRAME, _onEnterFrame);
> }
>
> protected function _createScene() : void
> {
> // Create a new scene containing a trident and two
> cubes
> var scene : Scene3D = new Scene3D();
>
> var l:int = 500;
> for(var i:int = 0; i<l; ++i)
> {
> var particle:Plane = new Plane();
> particle.bothsides = false;
> particle.material = new
> ColorMaterial(0x00FF00);
> particle.width = 8;
> particle.height = 8;
> particle.rotationX = 90;
> particle.x = Rnd.sign()*(400*Math.random());
> particle.y = Rnd.sign()*(300*Math.random());
> scene.addChild(particle);
> }
>
> //Assign the new scene to the view
> _view.scene = scene;
>
> addChild(new Stats());
>
> _timer = new Timer(50);
> _timer.addEventListener(TimerEvent.TIMER, _onTick);
> _timer.start();
> }
>
> protected function _createCamera() : void
> {
>
> }
>
> protected function _onEnterFrame(ev : Event) : void
> {
> _view.render();
> }
>
> protected function _onTick(ev : Event) : void
> {
>
> TweenLite.to(_view.scene.children[int(499*Math.random())], 1,
> {x:Rnd.sign()*(400*Math.random()), y:
> Rnd.sign()*(300*Math.random())});
>
> TweenLite.to(_view.scene.children[int(499*Math.random())], 1,
> {x:Rnd.sign()*(400*Math.random()), y:
> Rnd.sign()*(300*Math.random())});
>
> TweenLite.to(_view.scene.children[int(499*Math.random())], 1,
> {x:Rnd.sign()*(400*Math.random()), y:
> Rnd.sign()*(300*Math.random())});
>
> TweenLite.to(_view.scene.children[int(499*Math.random())], 1,
> {x:Rnd.sign()*(400*Math.random()), y:
> Rnd.sign()*(300*Math.random())});
> }
> }
>
> }
>
> *** Away3DLite 1.0 ***
>
> package
> {
> import away3dlite.containers.Scene3D;
> import away3dlite.containers.View3D;
> import away3dlite.materials.WireColorMaterial;
> import away3dlite.primitives.Cube6;
> import away3dlite.primitives.Plane;
>
> import com.greensock.TweenLite;
> import com.gskinner.utils.Rnd;
>
> import flash.display.Sprite;
> import flash.events.Event;
> import flash.events.TimerEvent;
> import flash.utils.Timer;
>
> import net.hires.debug.Stats;
>
> [SWF(width="800", height="600", frameRate="24")]
>
> public class Main extends Sprite
> {
> protected var _view : View3D;
> protected var _timer : Timer;
>
> public function Main()
> {
> _createView();
> _createScene();
> _createCamera();
> }
>
> protected function _createView() : void
> {
> // Create view and add it to the stage
> _view = new View3D();
> addChild(_view);
>
> //Relocate center point of view to the center of an
> 800x600 stage.
> _view.x = 400;
> _view.y = 300;
>
> //call the view render method on every frame of the
> Flash movie
> addEventListener(Event.ENTER_FRAME, _onEnterFrame);
> }
>
> protected function _createScene() : void
> {
> // Create a new scene containing a trident and two
> cubes
> var scene : Scene3D = new Scene3D();
>
> var l:int = 500;
> for(var i:int = 0; i<l; ++i)
> {
> var particle:Plane = new Plane();
> particle.width = 8;
> particle.height = 8;
> particle.rotationX = 90;
> particle.x = Rnd.sign()*(400*Math.random());
> particle.y = Rnd.sign()*(300*Math.random());
> scene.addChild(particle);
> }
>
> //Assign the new scene to the view
> _view.scene = scene;
>
> addChild(new Stats());
>
> _timer = new Timer(50);
> _timer.addEventListener(TimerEvent.TIMER, _onTick);
> _timer.start();
> }
>
> protected function _createCamera() : void
> {
>
> }
>
> protected function _onEnterFrame(ev : Event) : void
> {
> _view.render();
> }
>
> protected function _onTick(ev : Event) : void
> {
>
> TweenLite.to(_view.scene.children[int(499*Math.random())], 1,
> {x:Rnd.sign()*(400*Math.random()), y:
> Rnd.sign()*(300*Math.random())});
>
> TweenLite.to(_view.scene.children[int(499*Math.random())], 1,
> {x:Rnd.sign()*(400*Math.random()), y:
> Rnd.sign()*(300*Math.random())});
>
> TweenLite.to(_view.scene.children[int(499*Math.random())], 1,
> {x:Rnd.sign()*(400*Math.random()), y:
> Rnd.sign()*(300*Math.random())});
>
> TweenLite.to(_view.scene.children[int(499*Math.random())], 1,
> {x:Rnd.sign()*(400*Math.random()), y:
> Rnd.sign()*(300*Math.random())});
> }
> }
>
> }
>
> On Jun 13, 1:24 pm, elguapoloco <[email protected]>
> wrote:
>
> > Lite is all about speed and small footprint at the expense of
> > features.
>
> > I did some demos using HYPE and Lite and you can crunch quite a few
> > polys so I would start with that and then go Particles if it doesn't
> > work :D