Performance problem with added MouseEvent3D and dynamicaly built primitives

Software: Away3D 4.x

MichaelS, Newbie
Posted: 12 January 2012 08:33 PM   Total Posts: 8

Hey there,

I’m at the beginning of new project and its my first time developing with Away3D 4. I know my way around in 3.6, but 4 is still kinda tricky for me, so some recommendations and hints would be greatly appreciated smile

Some background (just why I’m not just using the Away Colada parser, you could also skip this paragraph): Im trying to built a small framework which takes Colada Models, analyses the Scene, stores it in a MySql Database (some PHP stuff) and generates an easy to read XML for my SWF which then generates the 3D Content via Away. I choose this, because it seemed easier to access the individual containers and children and do whatever I want with them. So basically I use C4D and Collada to easily generate my own primitives and generate the scene and containers with properties and functions as I like.

So I got the Scene and everything set up with a Hovercontroller and two lights. The Scene has 5 ObjectContainer3D and 23 Primitives with 570 Polys all together (which does not seem much to me)

Im generating my own primitives with simple code which i put together from an other post (can’t post the link as it is detected as spam?) with the title “how to create your own primitives - like a plane with rounded edges?”

with added mouseEvent3D’s it looks basically like this (p_rawVertices receives the Vector3D points from its parent, which gets it out of the DB):

public class Room extends PrimitiveBase
 {
  
private var _rawVertices:Vector.<Number>;
  private 
var _rawIndices:Vector.<uint>;
  
  
public function Room(p_material:MaterialBase, p_rawVertices:Vector.<Number>, p_rawIndices:Vector.<uint>)
  
{
   super
(p_material);
   
this._rawVertices p_rawVertices;
   
this._rawIndices p_rawIndices;
   
   
this.mouseEnabled true;
   
this.addEventListener(MouseEvent3D.MOUSE_OVER,hoverIn);
   
this.addEventListener(MouseEvent3D.MOUSE_OUT,hoverOut);
  
}
  
  
private function hoverIn(e:MouseEvent3D){
   Tweener
.addTween(e.currentTarget,{y:20time:.5transition:"easeOutBack"});
  
}
  
  
private function hoverOut(e:MouseEvent3D){
   Tweener
.addTween(e.currentTarget,{y:0time:.5transition:"easeOutBack"});
  
}
  
  override protected function buildGeometry
(target:SubGeometry):void
  {
   
   target
.autoDeriveVertexNormals true;
   
target.autoDeriveVertexTangents true;
   
target.updateVertexData(_rawVertices);
   
target.updateIndexData(_rawIndices);
  
}
  
  override protected function buildUVs
(target:SubGeometry):void
  {
  } 

The material is bothsides = true and a colorMaterial which has both lights.

So the problem here is that I get poor performance (see Attachment), I don’t know what Im doing wrong, as I’m not so much of a 3D Specialist. I think this will increase to a level where it will suck, as the scene will grow with more Polys.

Can the problem be caused by the

target.autoDeriveVertexNormals = true;
target.autoDeriveVertexTangents = true;

?

Or is there a general performance problem (or just the way it is) with MouseEvents3D?

Any hints or tips would really be appreciated smile

Michael

 

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X