Hi Guys. Here is the simplified and improved version of my class.

In this class i have 4 tests:

Test 1: In this test the cubes are added to *one* single mesh (with a null 
material) in each iteration, by using Merge.apply() method and keepMaterial 
set to true (I've created this to show how it handles a null material in the 
"parent" mesh);

Test 2: This test is the same as Test 1, but the "parent" mesh has a 
material attached to it;

Test 3: In this test it uses 2 meshes (one for each type of cube, with the 
correct material added) and it adds each cube to the correct mesh in each 
iteration, by using Merge.apply() method and keepMaterial set to false;

Test 4: Finally, in this test, the cubes are added to *one* single container 
in each iteration, and at the end it uses Merge.applyToContainer() and 
keepMaterial is set to true (this test is like John Brookes example)

This time i've organized the tests in functions, so to try one, simply 
uncomment it :-).

*Camera Controls:*
W: Increases Y
S: Decreases Y
A: Increases X
D: Decreases X
E: Increases Z
Q: Decreases Z

Here are my results:
Test1:

     *Memory:* in Windows Task Manager shows 600mb and fires a time-out 
error (i've set the Script time limit to 120 seconds, so, 2 minutes)

Test2:

     *Memory:* around 500 - 510 mb
     *FPS Average:* 25
     *Poly count:* 2134714, that explains why the map gets distorted
     *Loop time:* around 51 seconds
     *Total time:* the same as Loop time

Test3:

*     Memory:* 8.4 and stable
     *FPS Average:* 25
     *Poly count:* 8868
     *Loop time:* around 230-240 ms
     *Total time:* the same as Loop time

Test4:

*     Memory:* 12.8 and stable
     *FPS Average:* 25
     *Poly count:* 8844
     *Loop time:* around 60 ms
     *Total time:* around 300 ms

So, as you can see, Test 3 is the fastest and who has the best performance. 
But it implies that i have to create a Mesh for each cube type, but i would 
prefer having all in the same mesh, as it saves more code.

So my question is:
Do i have to use multiple meshes to get the max performance?

@Fabrice Sorry, i know you've already told me lots of times about offSetting 
uvs... But i dont understand what you mean with that... Do i have to move 
the uvs? Sorry

Attachment: MergeTester.as
Description: Binary data

Reply via email to