Question about re-use meshes in Blender


#1

Hi! I’m a newbie in game engine I had try using UE4 b4. In UE4 tutorial online, someone saids that no matter how many you duplicate the same mesh in the scene the computer will calculate as one mesh. Does it apply in Armory 3d too?


#2

The general principal is the same in Armory, however it’s not exactly true in any game engine that one mesh duplicated 10,000 times takes the same processing power as one mesh. It will take a heck of a lot less than 10,000 different meshes though if it’s done through something like instancing on the GPU.

Anyway, the short version is that what you’re talking about, while a bit inaccurate, is a general principal of 3D in general, not one specific game engine, although different engines will usually implement anything somewhat differently to others.


#3

Usually what you have is 10,000 references to just one set of mesh-data (with a “reference-count” equal to 10,000). This is the “instancing” concept mentioned in the post which follows this one: the data is referred-to, not copied.

But remember, “whatever is now visible to the camera” represents “more work for the game engine,” regardless, no matter how it is represented in memory. (Data which is not visible but which is presented to it anyway requires some time for “culling” as the engine decides that you can’t see it.)

You always want to practice the Mamma Bear Rule: “Not too much, not too little, just right.”

For instance, consider creating objects and then “reaping” them later when they pass sufficiently out of view. Or, keep a small stable of “nasties” and move them back into view ahead of the player once he leaves them behind – the viewer will never know, but the hardware will. Don’t keep a bunch of stuff in memory if it’s not being used or likely to be used very soon. And, don’t use more mesh-detail than you must have to successfully put on the show.


#4

Here is an Armory instancing example. In Armory, to get it to use the same mesh data for many duplicates of your mesh, you have to do an instanced copy inside of blender. Instanced copies are made by duplicating with Alt+D. Shift+D on the other hand will create duplicate that copies the mesh data to its own unique data.

For example, if I start with the Blender startup scene, and I duplicate the cube in the center of the scene with Alt+D I have two cube objects, but if I go into edit mode and change the mesh of either one, both will be updated. Also in the mesh data panel, you will be able to see that they both point to the same mesh data object:

The first object Cube ( green arrow ) has its mesh data set to Cube ( yellow arrow ) in the mesh data panel ( blue arrow ):

image

Note: Mesh data objects in Blender can have the same name as another object data object, as in the example above where the object is named “Cube” and the mesh that the object contains is named “Cube”.

The second Cube.001 which was duplicated from the first cube with Alt+D also has the same mesh data object, Cube:

image

If two objects share the same mesh object in Blender, then the objects in Armory will share the mesh.

There is also an “Instanced children” option in the object panel:

image

I don’t fully understand what that does, but I’m guessing it is something like the GPU instancing that Armored blob mentioned.


#5

Thank you Guys!!! That sounds great on me. That way is a lot easier and saving times than export the objects one by one to create a scene in another file. :blush:


#6

Documentation about “instanced children” is here: