Away3D : Problem FPS descending

18 views
Skip to first unread message

Alexandre Bais

unread,
Feb 24, 2010, 2:22:44 AM2/24/10
to Away3D.dev
Hi there,

I meet a problem with my Away3D scene...

I have a gallery with 3D Thumbs, which have a bitmapFileMaterial (low
jpg). For the moment, i have only 2 different JPG, a green one fore
directories, and a red/pink for images.
When i click one, the camera zoom on it and I change the material into
a MovieMaterial...
For the moment, my MovieClip is simple : an animated ring, and has
background, i put my low image, darked by a black transparent shape...
When i click in the exterior of my zoomed thumbs, the camera return
back, and I re-apply my low material...

My problem ? When I click on a thumbs, return back, re-click, return
back etc..., there is a decreasing of performance... I don't
understand what is wrong...
Do this test in my third level of my gallery (click the 1st thumbs in
first level, and the fourth in the 2nd level)

=> http://urfman.free.fr/fhw/ilotAbais/test_23fev2010.html

My simplified code of my thumbs3D Class ( extends Plane ) :

______________________________________________________________
public class thumbs3D extends Plane
{
private var mapLow:BitmapFileMaterial;
private var mapInteractive:MovieMaterial;
private var interactiveMC:vignetteSprite;

public function thumbs3D(_lowUrl:String, init:Object = null)
{
super(init);
mapLow = new BitmapFileMaterial(_lowUrl);
this.material = mapLow;
}

public function activeHdMap():void
{
interactiveMC = new vignetteSprite();
interactiveMC.buildMap(mapLow.bitmap,null,null);
mapInteractive = new MovieMaterial(interactiveMC);
mapInteractive.interactive = true;
this.material = mapInteractive;
}

public function desactiveHdMap():void
{
this.material = mapLow;
interactiveMC = null;
mapInteractive = null;
}
}
______________________________________________________________

Does the " = null" is not enough ?
Any Idea ?

Thank you.

Alexandre.

Michael Iv

unread,
Feb 24, 2010, 4:08:36 AM2/24/10
to away3...@googlegroups.com
I have tested your App and did not find any FPS drop - stable 25-26
--
Michael Ivanov ,Programmer
Neurotech Solutions Ltd.
Flex|Flash |Air |Games|OS|
Tel-0526237969
explo...@gmail.com
sup...@neurotech.co.il

Alexandre Bais

unread,
Feb 24, 2010, 5:41:24 AM2/24/10
to Away3D.dev
Maybe your CPU is too powerfull...

I forget to ask to do not re-click in the same thumbs all time, but in
its neighbors too...
All my friends who try it has confirmed the FPS decreasing...

On my computer, when i focus a thumbs of my 3rd level, I have 20-22
FPS...
After 10-15 crazy click, i fall to 10 FPS (it's regular)

I don't solve this, but i found an other way to do what i wan't...
Now, I make only one instance of my movieClip, so it's the same which
is applied on all thumbs when they are targeted...
I add function on this movieclip to change itself...
==> It is a success, my CPU thanks me :)

Maybe i was stupid to believe that " = null" was enough to relieve
CPU.. ?

Tanks for your answer

Alexandre.

Michael Iv

unread,
Feb 24, 2010, 5:52:58 AM2/24/10
to away3...@googlegroups.com
Do you code in Flex IDE? . if you do ,you can easily monitor memory leaks of your App with Profiler

And yes , my PC is quad Core so may be that is the reason I did not feel FPS dropdown

Good Luck

Alexandre Bais

unread,
Feb 24, 2010, 6:23:43 AM2/24/10
to Away3D.dev
I code with FlashDevelop (+FlexSDK)...
Maybe they are a monitor, but if they are, I don't know where :\

I will search for that, it will be very usefull (if I know how to use
it !)

Thank you again ;)

Michael Iv

unread,
Feb 24, 2010, 6:29:38 AM2/24/10
to away3...@googlegroups.com
I really don't know if there is a Profiler in FlashDevelop but I would highly recommend you to develop 3d stuff in IDE that has it .
Flash Builder or FDT .
In this field of programming optimization issues are critical and rapid . And profiler , it is like a gift from the God for that matter.

banal

unread,
Feb 24, 2010, 7:34:16 AM2/24/10
to Away3D.dev
If you look at the stats, you see that memory increases with every
opening of the thumbs. So you got a memory allocation/cleanup problem
somewhere. Maybe you're constantly creating new "thumbs3D" objects,
without removing the old ones from the scene?
Instead of re-allocating memory all the time (by calling "new") try to
re-use stuff. Pool your objects for later usage, or make sure they get
disposed correctly.

Joshua Granick

unread,
Feb 24, 2010, 8:32:45 AM2/24/10
to away3...@googlegroups.com
It's pretty to do this yourself as well. The key is usually areas where you are creating or destroying instances ... try to use trace() statements to determine if objects are really being destroyed. For example, make sure that you have removed all of your event handlers or other strong references to the object.

Away3D also slows down once it reaches "critical mass" in terms of objects. If you always have the same number of objects, you should probably be fine, but at a certain point you'll have too many objects for it to render in real-time and then it will begin slowing down quickly. Make sure your objects are being destroyed, or remove code that relies on removeChild and addChild and replace it with .visible or something else. The cause of slow performance usually isn't having too many objects in memory, but rendering too many objects at once.

Finally, depending on your project, you can toggle between rendering modes or push objects into their own View object so that you can render them separately from the rest of the scene. There's a number of things you can do to play with maximizing performance.


On Wed, 24 Feb 2010 03:29:38 -0800, Michael Iv <explo...@gmail.com> wrote:

> I really don't know if there is a Profiler in FlashDevelop but I would
> highly recommend you to develop 3d stuff in IDE that has it .
> Flash Builder or FDT .
> In this field of programming optimization issues are critical and rapid .
> And profiler , it is like a gift from the God for that matter.
>
> On Wed, Feb 24, 2010 at 1:23 PM, Alexandre Bais <bais.al...@gmail.com>wrote:
>
>> I code with FlashDevelop (+FlexSDK)...
>> Maybe they are a monitor, but if they are, I don't know where :\
>>
>> I will search for that, it will be very usefull (if I know how to use
>> it !)
>>
>> Thank you again ;)
>>
>
>
>


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply all
Reply to author
Forward
0 new messages