Weld removes vertices, but poly count stays the same

Software: Away3D 4.x

3dNewb, Sr. Member
Posted: 09 October 2012 09:13 AM   Total Posts: 105

For testing purposes, I have create a cube. I move some of the vertexData vertices to the same x,y,z coords (so they sit on top of each other)

I apply a Weld.apply().

Weld.verticesRemovedCount tells me 64 vertices were removed.

However, the Awaystats shows no difference in polygon count with or withou welding.

Are the number of polygons not related to the length of the vertextData array?

Maybe I am not using Weld for what it is intended. I am trying to get the amount of polygons down on a mesh by merging some of the vertices.

   

Avatar
theMightyAtom, Sr. Member
Posted: 09 October 2012 11:01 AM   Total Posts: 669   [ # 1 ]

Welding the vertices means you have less vertices to draw the same number of polygons (triangles). When you weld, if vertices have the same value, one is removed and the indices updated so as to point to the same vertex (as oppose to two separate vertices).

In a cube you will still have the same number of triangles, it just takes less data to draw them smile  This increases efficiency and speed and reduces memory needed, making room for more polygons…

 

   

3dNewb, Sr. Member
Posted: 09 October 2012 11:22 AM   Total Posts: 105   [ # 2 ]

Sounds fair enough, thanks for explaining!

 

   

NAZ, Newbie
Posted: 21 November 2012 01:14 PM   Total Posts: 9   [ # 3 ]

Hello Guys,

I’m experiencing some trouble with Welding and Merging geometries.

At first i just wanted to create an example where i could combine a series of cubes into one and then alter it’s vertices going into the Subgeomety’s vertex data, i found the MergeHelper from Matse in the forum which helped me have my 3 cubes in one container but when i wanted to alter the vertex data i saw the faces were actually independent from the whole, experimenting issues like the first 4 screenshots i put below.

Then i found about welding, and it seemed to be the last piece, but when i weld my container it seems to not do the job fully, the some faces where more connected some not, plus it distorted my merged container of boxes, like i show in the last 3 screenshots.

I tried also not merging but only welding the container and got the same result.

Can you give me some light from my issue?

I post the code where i merge and weld the 3 cubes, they all share the same geometry and colorMaterial

Thank you very much. smile

private function setupPrimitivesAndModels() : void {
   
var cWidth int 50;
   
_cubeGeometry = new CubeGeometry(cWidthcWidthcWidth);

   
_container = new ObjectContainer3D();

   
_nuBox1 = new CustomBox(_cubeGeometrymat);
   
_nuBox2 = new CustomBox(_cubeGeometrymat);
   
_nuBox3 = new CustomBox(_cubeGeometrymat);

   
_container.addChild(_nuBox1);
   
_container.addChild(_nuBox2);
   
_container.addChild(_nuBox3);

   
view.scene.addChild(_container);

   
_nuBox1.100;
   
_nuBox1.100;
   
_nuBox1.100;

   
_nuBox2.150;
   
_nuBox2.100;
   
_nuBox2.100;

   
_nuBox3.200;
   
_nuBox3.100;
   
_nuBox3.100;

   
MergeHelper.mergeContainer(_container);
   
Weld.apply(_container);    
  

 

   

NAZ, Newbie
Posted: 21 November 2012 01:16 PM   Total Posts: 9   [ # 4 ]

Hello Guys,

I’m experiencing some trouble with Welding and Merging geometries.

At first i just wanted to create an example where i could combine a series of cubes into one and then alter it’s vertices going into the Subgeomety’s vertex data, i found the MergeHelper from Matse in the forum which helped me have my 3 cubes in one container but when i wanted to alter the vertex data i saw the faces were actually independent from the whole, experimenting issues like the first 4 screenshots i put below.

Then i found about welding, and it seemed to be the last piece, but when i weld my container it seems to not do the job fully, the some faces where more connected some not, plus it distorted my merged container of boxes, like i show in the last 3 screenshots.

I tried also not merging but only welding the container and got the same result.

Can you give me some light from my issue?

I post the code where i merge and weld the 3 cubes, they all share the same geometry and colorMaterial

Thank you very much. smile

private function setupPrimitivesAndModels() : void {
   
var cWidth int 50;
   
_cubeGeometry = new CubeGeometry(cWidthcWidthcWidth);

   
_container = new ObjectContainer3D();

   
_nuBox1 = new CustomBox(_cubeGeometrymat);
   
_nuBox2 = new CustomBox(_cubeGeometrymat);
   
_nuBox3 = new CustomBox(_cubeGeometrymat);

   
_container.addChild(_nuBox1);
   
_container.addChild(_nuBox2);
   
_container.addChild(_nuBox3);

   
view.scene.addChild(_container);

   
_nuBox1.100;
   
_nuBox1.100;
   
_nuBox1.100;

   
_nuBox2.150;
   
_nuBox2.100;
   
_nuBox2.100;

   
_nuBox3.200;
   
_nuBox3.100;
   
_nuBox3.100;

   
MergeHelper.mergeContainer(_container);
   
Weld.apply(_container);    
  

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X