Stage3DProxy in Worker

Software: Away3D 4.x

Beek, Member
Posted: 31 January 2016 02:52 AM   Total Posts: 67

I’m attempting to put an Away3d in a worker to separate the 3D and the UI and reduce performance lag on mobile.

As soon as the Away3D attempts to get a free proxy

stage3DProxy stage3DManager.getFreeStage3DProxy(); 

I get the error

Too many Stage3D instances used!
    
at away3d.core.managers::Stage3DManager/getFreeStage3DProxy()[C:\workspace\flash\libs\lib_pano_away3d\src\away3d\core\managers\Stage3DManager.as:98]
    at away3d
.containers::View3D/onAddedToStage()[C:\workspace\flash\libs\lib_pano_away3d\src\away3d\containers\View3D.as:931]
    at flash
.display::DisplayObjectContainer/addChild() 

Does anyone know if there are issues with loading Stage3D in a Worker?

   

therealloft, Member
Posted: 01 February 2016 01:03 AM   Total Posts: 65   [ # 1 ]

Not sure if it would be possible really, i done plenty of work with workers and away3d, I create 3 workers 1. to handle physics. 2. I/O operations such as loading models, 3. as a task scheduler for AI, BSP etc

   

Beek, Member
Posted: 01 February 2016 01:05 AM   Total Posts: 67   [ # 2 ]

Yeah thanks I’ve realised now that workers can’t access the stage.. so may be useful for complex heavy loads but can’t help with freezing UI cos theres too much going on the stage. Will have to rethink. Thanks.

   

therealloft, Member
Posted: 01 February 2016 01:10 AM   Total Posts: 65   [ # 3 ]

i found most of the lag is caused by loading models on the main thread thats why i try to load them on the background thread then pass the raw geometry data to the main via a MessageChannel

   

Beek, Member
Posted: 01 February 2016 01:14 AM   Total Posts: 67   [ # 4 ]

Hmm my lag seems to be caused by loading textures.. can you pass these via the messaging channel?

   

therealloft, Member
Posted: 01 February 2016 01:18 AM   Total Posts: 65   [ # 5 ]

i not tried textures through it as away3d classes are not serializable but you could try a number of things convert images to ATF format, texture atlas. the later one will speed it up the most, and it be good practice to use just ATF files

   

Beek, Member
Posted: 01 February 2016 01:46 AM   Total Posts: 67   [ # 6 ]

Hmm convert the jpgs into ATF in the worker? Seems like a good idea - is it possible to convert JPEG to ATF at runtime?

   

therealloft, Member
Posted: 01 February 2016 04:19 PM   Total Posts: 65   [ # 7 ]

you wanted to do it in run time you could use native process but i would pre-convert them.

   

rdoi, Member
Posted: 02 February 2016 07:23 PM   Total Posts: 86   [ # 8 ]

1. Well, AFAIK, you can’t allocate more than one instance of Stage3D in mobile, thats why your worker can’t access it. You can share it though, but I don’t think you can access its proxy instance from a worker.

2. Also, I don’t think you will get much benefit with workers for IO heavy operations, most of devices are not powerfull enough to handle parallel processing things, so it will lag your main process anyway.

3. Converting to ATF in realtime is not a good idea, its really a heavy proccess. ATF is intended to be used pre-converted and optimized for a target device, replacing your original image assets.

My sugestion, if possible, is to group all your textures in one big (ATF) atlas, joining all ui textures, 3d difuse/normals maps. You just have to load and upload to gpu once, and you will have better performance by reducing drastically the draw calls.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X