BoundingVolumeBase.fromGeometry() bug - causes disappearing polygons

Software: Away3D 4.x

NoseKills, Newbie
Posted: 05 June 2012 10:13 AM   Total Posts: 8

I had some problems with certain faces of my models disappearing when they clearly were still partly in the view.

After some debugging i noticed that the min and max vectors of the disappearing Mesh were incorrect and caused Away to think that the mesh wasn’t on screen.

One of them was a Blender made plane shape of 30 by 20 units and pivot in the center. I noticed that the minX and maxX were both negative.

Depending on the order of vertices this bounding box code in BoundingVolumeBase.fromGeometry() can produce faulty results.

minX minY minZ Number.POSITIVE_INFINITY;
   
maxX maxY maxZ Number.NEGATIVE_INFINITY;

   while( 
lenS {
    vertices 
subs[j++].vertexData;
    
lenV vertices.length;
    
0;
    while( 
lenV {
     v 
vertices[i++];
     if( 
minX minX v;
     else if( 
maxX maxX v;
     
vertices[i++];
     if( 
minY minY v;
     else if( 
maxY maxY v;
     
vertices[i++];
     if( 
minZ minZ v;
     else if( 
maxZ maxZ v;
    
}
   } 

I think it’s clear that if any of the vertice coordinates has it’s highest value in the first vertex (ie. the first vertex has an X of 1 and all other vertices have a smaller X) that highest value doesn’t get stored in the maxX.

Removing all the “else” words fixes the bug and my polygons show as expected.

I don’t know much about the format of vertex data in 3D models, so if there’s something I’m not getting, please let me know raspberry Otherwise i’ll file a bug soon.

   

Richard Olsson, Administrator
Posted: 16 June 2012 12:33 PM   Total Posts: 1192   [ # 1 ]

Thanks for reporting. This was tracked in the following issue report. It was recently fixed and will be in the stable (“gold”) release of Away3D 4.0.
https://github.com/away3d/away3d-core-fp11/issues/273

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X