2500 at one time is still really "pushing" it. Maybe try Away3Dlite?

-Pete

On Mon, Jul 12, 2010 at 9:30 AM, Crabar <[email protected]> wrote:

> AwayStats show "30000 polygons". I think it mean "faces".
> Scene is big and in one moment camera sees no more then 2500.
>
> On 12 июл, 16:22, Michael Iv <[email protected]> wrote:
> > 30000 polygons or triangles? Anyhow this is too much Man... You must
> reduce
> > it
> >
> >
> >
> >
> >
> > On Mon, Jul 12, 2010 at 4:16 PM, Crabar <[email protected]> wrote:
> > > Hello, developers!
> >
> > > I have a problem with a performance of own scene.
> > > I try to build about 10 000 objects on scene with away3d. Now i have
> > > over 30 000 polygons, a visible at once is about 500-2000. It required
> > > ~230 mb of RAM (Internet Explorer, AwayStats shows ~160 mb) and have
> > > 5-10 fps while camera is moving. It's to much RAM is using and to low
> > > fps rate to me. I would be pleased for help in optimization of my
> > > engine and for some advices about optimization tricks. As well I would
> > > be pleased for pointing out my mistakes.
> >
> > > There are some screens:
> > >http://imageshost.ru/photo/74374/id21221.html
> > >http://imageshost.ru/photo/80867/id21220.html
> >
> > > I'm using Rectangle Clipping, obectCulling = true, Renderer = BASIC.
> > > Material is ShadingColorMAterial with one light source.
> > > I think about using LODObject, but it probably will be used more RAM
> > > or not?
> >
> > > To limit the range of visibility i'm using following event code (on
> > > move):
> >
> > >                public function onMove(e:KSEvents):void
> > >                {
> > >                        for each (var Obj3D:Object3D in
> > > baseAway.view.scene.children)
> > >                        {
> > >                                if
> > > (baseCamera.position.distance(Obj3D.position)>DistanceOfView)
> > >                                {
> > >                                        Obj3D.visible = false;
> > >                                }
> > >                                else
> > >                                {
> > >                                        Obj3D.visible = true;
> > >                                }
> > >                        }
> > >                }
> >
> > > Creating view code:
> >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:UIComponent xmlns:mx="http://www.adobe.com/2006/mxml"; width="100%"
> > > height="100%">
> > >        <mx:Script>
> > >                <![CDATA[
> > >                        import away3d.containers.Scene3D;
> > >                        import away3d.containers.View3D;
> > >                        import away3d.core.clip.FrustumClipping;
> > >                        import away3d.core.clip.RectangleClipping;
> > >                        import away3d.core.render.*;
> >
> > >                        public var view:View3D;
> > >                        public var scene:Scene3D;
> >
> > >                        override protected function
> createChildren():void
> > >                        {
> > >                                super.createChildren();
> > >                                scene = new Scene3D();
> > >                                view = new View3D();
> > >                                view.scene = scene;
> > >                                view.renderer = Renderer.BASIC;
> > >                                addChild(view);
> > >
>  view.addEventListener(Event.ADDED_TO_STAGE,
> > > update); // Make sure
> > > the first frame is rendered
> > >                        }
> >
> > >                        override protected function
> > > updateDisplayList(unscaledWidth:Number,
> > > unscaledHeight:Number):void
> > >                        {
> > >                                super.updateDisplayList(unscaledWidth,
> > > unscaledHeight);
> > >                                update();
> > >                        }
> > >                        private function update(e:* = null):void
> > >                        {
> > >                                if(view.stage){
> > >                                        view.x = unscaledWidth/2;
> > >                                        view.y = unscaledHeight/2;
> > >                                        view.clipping = new
> > > RectangleClipping({minX:-unscaledWidth/
> > > 2,minY:-unscaledHeight/2,maxX:unscaledWidth/2,maxY:unscaledHeight/2});
> > >                                        view.clipping.objectCulling =
> true;
> > >                                        view.render();
> > >                                }
> > >                        }
> > >                ]]>
> > >        </mx:Script>
> > > </mx:UIComponent>
> >
> > > Some code of class my object's class:
> >
> > >        public class Tube extends KSMesh
> > >        {
> > >        ...
> >
> > > Building faces:
> >
> > >                for (var i:int = 0; i< (VertexArray[j] as
> > > Vector.<Vertex>).length-1;
> > > i++)
> > >                {
> > >                        // first triangle of quad
> > >                        var FirstFace:Face = new Face();
> > >                        FirstFace.v0 = (VertexArray[j] as
> > > Vector.<Vertex>)[i];
> > >                        FirstFace.v1 = (VertexArray[j] as
> > > Vector.<Vertex>)[i+1];
> > >                        FirstFace.v2 = (VertexArray[j+1] as
> > > Vector.<Vertex>)[i];
> > >                        this.addFace(FirstFace);
> > >                        FirstFace = null;
> > >                        // second triangle of quad
> > >                        var SecondFace:Face = new Face();
> > >                        SecondFace.v0 = (VertexArray[j] as
> > > Vector.<Vertex>)[i+1];
> > >                        SecondFace.v1 = (VertexArray[j+1] as
> > > Vector.<Vertex>)[i+1];
> > >                        SecondFace.v2 = (VertexArray[j+1] as
> > > Vector.<Vertex>)[i];
> > >                        this.addFace(SecondFace);
> > >                        SecondFace = null;
> > >                }
> > >                ...
> >
> > > constructor
> >
> > >                public function Tube(Points:Vector.<Number3D>,
> > > Radius:Number,
> > > PipeKey:Number)
> > >                {
> > >                        super(null);
> > >                        this.diameter = Radius*2;
> > >                        this.ObjKey = PipeKey;
> >
> > >                        var ComplexPoints:Array = new Array;
> > >                        var TwoDots:Array = new Array();
> >
> > >                        for (var i:int = 0; i<Points.length-1; i++)
> > >                        {
> > >                                //
> > >                                TwoDots = GetFanCoords(Points[i],
> > > Points[i+1], 4, Radius);
> > >                                ComplexPoints[ComplexPoints.length] =
> > > TwoDots[0];
> > >                                ComplexPoints[ComplexPoints.length] =
> > > TwoDots[1];
> > >                        }
> >
> > >                        //
> > >                        BuildFaces(ComplexPoints);
> > >                        //
> > >                        this.centerPivot();
> > >                        this.material = new
> ShadingColorMaterial(0x555555);
> > >                        this.invertFaces();
> > >                        this.bothsides = true;
> > >                        // welding
> > >                        var weld:Weld = new Weld(false);
> > >                        weld.apply(this);
> > >                        //
> > >                        weld = null;
> > >                        TwoDots = null;
> > >                        ComplexPoints = null;
> > >                }
> >
> > > Tnx for help.
> >
> > --
> > Michael Ivanov ,Programmer
> > Neurotech Solutions Ltd.
> > Flex|Air
> |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://
> www.meetup.com/GO3D-Games-Opensource-3D/
> > Tel:054-4962254
> > [email protected]
> > [email protected]




-- 
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM

Reply via email to